Class: RhetButler::CommandLine
- Inherits:
-
Thor
- Object
- Thor
- RhetButler::CommandLine
- Defined in:
- lib/rhet-butler/command-line.rb
Class Method Summary collapse
Instance Method Summary collapse
- #author ⇒ Object
- #check ⇒ Object
- #import(url, target) ⇒ Object
- #init ⇒ Object
- #serve ⇒ Object
- #static ⇒ Object
Class Method Details
.shared_options ⇒ Object
8 9 10 11 |
# File 'lib/rhet-butler/command-line.rb', line 8 def self. method_option :sources, :type => :array method_option :root_slide, :type => :string end |
Instance Method Details
#author ⇒ Object
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/rhet-butler/command-line.rb', line 94 def require 'rhet-butler/web/main-app' file_manager = FileManager.new() app = Web::MainApp.new(file_manager) app.presentation_app_class = Web::PresentationApp app.assets_app_class = Web::AssetsApp app.check app.start end |
#check ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/rhet-butler/command-line.rb', line 75 def check require 'rhet-butler/web/main-app' file_manager = FileManager.new() app = Web::MainApp.new(file_manager) app.presentation_app_class = Web::MemoizedPresentationApp app.assets_app_class = Web::MemoizedAssetsApp app.check = app.viewer_app.root_step..inject(0) do |count, | count + 1 end say "Slides loaded and parsed" say " #{} slides loaded" say " Serving slides and assets found in: #{app.}" end |
#import(url, target) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rhet-butler/command-line.rb', line 55 def import(url, target) require 'rhet-butler/resource-localizer' file_manager = FileManager.new() localizer = ResourceLocalizer.new case [:role] when "presenter", "viewer" localizer.files = file_manager.aspect_search_path([:role]) else localizer.files = file_manager.all_files end localizer.source_uri = url localizer.target_path = target localizer.store_log = $stderr unless [:quiet] localizer.go! end |
#init ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rhet-butler/command-line.rb', line 15 def init require 'fileutils' file_manager = FileManager.new() 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 ⇒ Object
107 108 109 110 111 112 113 114 115 116 |
# File 'lib/rhet-butler/command-line.rb', line 107 def serve require 'rhet-butler/web/main-app' file_manager = FileManager.new() app = Web::MainApp.new(file_manager) app.presentation_app_class = Web::MemoizedPresentationApp app.assets_app_class = Web::MemoizedAssetsApp app.check app.start end |
#static ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/rhet-butler/command-line.rb', line 42 def static require 'rhet-butler/static-generator' file_manager = FileManager.new() generator = StaticGenerator.new(file_manager) generator.store_log = $stderr unless [:quiet] generator.go! end |