Sha256: 62999ebc4b858f17e20cfb6920b7c402263e0329c9946949f9cf57fa3d2b1def

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require 'rhet-butler/web/main-app'
require 'rhet-butler/stasis'

module RhetButler
  class StaticGenerator
    def initialize(file_manager)
      @file_manager = file_manager
      @target_valise = file_manager.target_valise
    end

    attr_reader :target_valise
    attr_accessor :store_log

    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

    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("/")
      transform_queue.go
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rhet-butler-0.11.1 lib/rhet-butler/static-generator.rb
rhet-butler-0.11.0 lib/rhet-butler/static-generator.rb
rhet-butler-0.10.0 lib/rhet-butler/static-generator.rb
rhet-butler-0.9.0 lib/rhet-butler/static-generator.rb