Class: Muwu::Viewer

Inherits:
Object
  • Object
show all
Includes:
Muwu
Defined in:
lib/muwu/viewer/viewer.rb

Constant Summary

Constants included from Muwu

GEM_HOME_LIB, GEM_HOME_LIB_MUWU, VERSION

Instance Method Summary collapse

Methods included from Muwu

debug, read

Constructor Details

#initialize(project) ⇒ Viewer

Returns a new instance of Viewer.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/muwu/viewer/viewer.rb', line 8

def initialize(project)
  document_home = project.manifest.find_document_html_by_index(0).filename
  document_home_path = File.join(project.path_compiled, document_home)
  if File.exists?(document_home_path)
    begin
      system "lynx #{document_home_path}", exception: true
    rescue Errno::ENOENT
      raise ProjectExceptionHandler::Fatal.new(ProjectException::LynxNotAvailable.new)
    end
  else
    puts "Compiled document not found: #{document_home_path}"
  end
end