Class: Fdoc::Cli
Overview
A Thor definition for an fdoc to HTML conversion operation
Instance Attribute Summary collapse
-
#origin_path ⇒ Object
Returns the value of attribute origin_path.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#origin_path ⇒ Object
Returns the value of attribute origin_path.
16 17 18 |
# File 'lib/fdoc/cli.rb', line 16 def origin_path @origin_path end |
Class Method Details
.source_root ⇒ Object
18 19 20 |
# File 'lib/fdoc/cli.rb', line 18 def self.source_root File.("../templates", __FILE__) end |
Instance Method Details
#convert(fdoc_path) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fdoc/cli.rb', line 25 def convert(fdoc_path) say_status nil, "Converting fdoc to HTML" self.origin_path = File.(fdoc_path) raise Fdoc::NotFound.new(origin_path) unless has_valid_origin? say_status :using, fdoc_path self.destination_root = output_path raise Fdoc::NotADirectory.new(output_path) unless has_valid_destination? say_status :inside, output_path in_root do copy_file("styles.css") create_file("index.html", .to_html) if end service_presenters.each do |service_presenter| inside_service_presenter(service_presenter) do create_file("index.html", service_presenter.to_html) service_presenter.endpoints.each do |endpoint_prefix_group| endpoint_prefix_group.each do |endpoint| create_file(endpoint.url, endpoint.to_html) end end end end end |