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.
19 20 21 |
# File 'lib/lurker/cli.rb', line 19 def content @content end |
#origin_path ⇒ Object
Returns the value of attribute origin_path.
19 20 21 |
# File 'lib/lurker/cli.rb', line 19 def origin_path @origin_path end |
Class Method Details
.precompiled_static_root ⇒ Object
25 26 27 |
# File 'lib/lurker/cli.rb', line 25 def self.precompiled_static_root File.("../templates/public", __FILE__) end |
.source_root ⇒ Object
21 22 23 |
# File 'lib/lurker/cli.rb', line 21 def self.source_root File.("../templates", __FILE__) end |
Instance Method Details
#convert(lurker_path = Lurker::DEFAULT_SERVICE_PATH) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/lurker/cli.rb', line 38 def convert(lurker_path=Lurker::DEFAULT_SERVICE_PATH) say_status nil, "Converting lurker to #{[: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 self.destination_root = output_path raise Lurker::NotADirectory.new(output_path) unless has_valid_destination? 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 |