class RhetButler::CommandLine

Public Class Methods

shared_options() click to toggle source
# File lib/rhet-butler/command-line.rb, line 8
def self.shared_options
  method_option :sources, :type => :array
  method_option :root_slide, :type => :string
end

Public Instance Methods

author() click to toggle source
# File lib/rhet-butler/command-line.rb, line 94
def author
  require 'rhet-butler/web/main-app'

  file_manager = FileManager.new(options)
  app = Web::MainApp.new(file_manager)
  app.presentation_app_class = Web::PresentationApp
  app.assets_app_class = Web::AssetsApp
  app.check
  app.start
end
check() click to toggle source
# File lib/rhet-butler/command-line.rb, line 75
def check
  require 'rhet-butler/web/main-app'

  file_manager = FileManager.new(options)
  app = Web::MainApp.new(file_manager)
  app.presentation_app_class = Web::MemoizedPresentationApp
  app.assets_app_class = Web::MemoizedAssetsApp
  app.check

  slide_count = app.viewer_app.root_step.each_slide.inject(0) do |count, slide|
    count + 1
  end
  say "Slides loaded and parsed"
  say "  #{slide_count} slides loaded"
  say "  Serving slides and assets found in: #{app.slides}"
end
import(url, target) click to toggle source
# File lib/rhet-butler/command-line.rb, line 55
def import(url, target)
  require 'rhet-butler/resource-localizer'
  file_manager = FileManager.new(options)
  localizer = ResourceLocalizer.new

  case options[:role]
  when "presenter", "viewer"
    localizer.files = file_manager.aspect_search_path(options[:role])
  else
    localizer.files = file_manager.all_files
  end
  localizer.source_uri = url
  localizer.target_path = target
  localizer.store_log = $stderr unless options[:quiet]

  localizer.go!
end
init() click to toggle source
# File lib/rhet-butler/command-line.rb, line 15
def init
  require 'fileutils'

  file_manager = FileManager.new(options)

  FileUtils.mkdir_p "assets"
  FileUtils.mkdir_p "presenter/assets"
  FileUtils.mkdir_p "viewer/assets"

  skels = file_manager.all_files.sub_set("skels")

  %w{slides.yaml}.each do |path|
    unless Dir.glob(path).empty?
      puts "Refusing to clobber existing: #{path}"
      next
    end

    File::open(path, "w") do |file|
      file.write skels.contents(path)
    end
  end
end
serve() click to toggle source
# File lib/rhet-butler/command-line.rb, line 107
def serve
  require 'rhet-butler/web/main-app'

  file_manager = FileManager.new(options)
  app = Web::MainApp.new(file_manager)
  app.presentation_app_class = Web::MemoizedPresentationApp
  app.assets_app_class = Web::MemoizedAssetsApp
  app.check
  app.start
end
static() click to toggle source
# File lib/rhet-butler/command-line.rb, line 42
def static
  require 'rhet-butler/static-generator'

  file_manager = FileManager.new(options)
  generator = StaticGenerator.new(file_manager)
  generator.store_log = $stderr unless options[:quiet]

  generator.go!
end