Class: Fdoc::Cli

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/fdoc/cli.rb

Overview

A Thor definition for an fdoc to HTML conversion operation

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#origin_pathObject

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_rootObject



18
19
20
# File 'lib/fdoc/cli.rb', line 18

def self.source_root
  File.expand_path("../templates", __FILE__)
end

Instance Method Details

#convert(fdoc_path) ⇒ Object

Raises:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fdoc/cli.rb', line 27

def convert(fdoc_path)
  say_status nil, "Converting fdoc to #{options[:format]}"

  self.origin_path = File.expand_path(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

  if options[:format] == 'markdown'
    convert_to_markdown
  else
    convert_to_html
  end
end