Class: RhetButler::StaticGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/rhet-butler/static-generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_manager) ⇒ StaticGenerator

Returns a new instance of StaticGenerator.



6
7
8
9
# File 'lib/rhet-butler/static-generator.rb', line 6

def initialize(file_manager)
  @file_manager = file_manager
  @target_valise = file_manager.target_valise
end

Instance Attribute Details

#store_logObject

Returns the value of attribute store_log.



12
13
14
# File 'lib/rhet-butler/static-generator.rb', line 12

def store_log
  @store_log
end

#target_valiseObject (readonly)

Returns the value of attribute target_valise.



11
12
13
# File 'lib/rhet-butler/static-generator.rb', line 11

def target_valise
  @target_valise
end

Instance Method Details

#appObject



14
15
16
17
18
19
20
21
# File 'lib/rhet-butler/static-generator.rb', line 14

def app
  web_app = Web::MainApp.new(@file_manager)
  web_app.presentation_app_class = Web::MemoizedPresentationApp
  web_app.assets_app_class = Web::MemoizedAssetsApp
  web_app.capture_exceptions = false
  web_app.check
  web_app.builder.to_app
end

#go!Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rhet-butler/static-generator.rb', line 23

def go!
  app_url = "http://example.com/"
  transform_queue = Stasis::TransformQueue.new
  transform_queue.loader = Stasis::RackLoader.new(app_url, app)
  transform_queue.mapping = Stasis::ResourceMapping.new
  transform_queue.mapping.default_uri = app_url
  transform_queue.writer = Stasis::ValiseWriter.new(@target_valise)
  transform_queue.writer.store_log = store_log

  transform_queue.add(nil, "/")
  transform_queue.go
end