Class: Lurker::Cli
- Inherits:
-
Thor
- Object
- Thor
- Lurker::Cli
- Includes:
- Thor::Actions
- Defined in:
- lib/lurker/cli.rb
Overview
A Thor definition for an lurker to HTML conversion operation
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#origin_path ⇒ Object
Returns the value of attribute origin_path.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
15 16 17 |
# File 'lib/lurker/cli.rb', line 15 def content @content end |
#origin_path ⇒ Object
Returns the value of attribute origin_path.
15 16 17 |
# File 'lib/lurker/cli.rb', line 15 def origin_path @origin_path end |
Class Method Details
.precompiled_static_root ⇒ Object
21 22 23 |
# File 'lib/lurker/cli.rb', line 21 def self.precompiled_static_root File.("../templates/public", __FILE__) end |
.source_root ⇒ Object
17 18 19 |
# File 'lib/lurker/cli.rb', line 17 def self.source_root File.("../templates", __FILE__) end |
Instance Method Details
#convert(lurker_path = Lurker::DEFAULT_SERVICE_PATH) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/lurker/cli.rb', line 34 def convert(lurker_path=Lurker::DEFAULT_SERVICE_PATH) say_status nil, "Converting lurker to #{options[:format]}" self.content = get_content([:content]) self.origin_path = File.(lurker_path) raise Lurker::NotFound.new(origin_path) unless has_valid_origin? say_status :using, lurker_path FileUtils.mkdir_p(output_path) say_status :inside, output_path if [:rails] require "#{Dir.pwd}/config/environment" end if [:format] == 'pdf' convert_to_pdf else convert_to_html end end |