Class: DocSmoosher::Generators::Builder

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/doc_smoosher.rb

Constant Summary collapse

OUTPUT =
'./output'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



79
80
81
# File 'lib/doc_smoosher.rb', line 79

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#build_api_htmlObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/doc_smoosher.rb', line 88

def build_api_html
  api_name = File.basename(Dir.getwd)
  api_file = File.join(Dir.getwd, "#{api_name}.rb")

  # load api_file
  puts "opening: #{api_file}"
  File.open(api_file) do |f|
    instance_eval f.read
  end

  self.api = @api
  copy_file(File.join(TEMPLATES, 'html', 'bootstrap.min.css'), "output/html/bootstrap.min.css")
  copy_file(File.join(TEMPLATES, 'html', 'prettify.css'), "output/html/prettify.css")
  copy_file(File.join(TEMPLATES, 'html', 'prettify.js'), "output/html/prettify.js")
  copy_file(File.join(TEMPLATES, 'html', 'run_prettify.js'), "output/html/run_prettify.js")

  template(File.join(TEMPLATES, 'html', 'api.html.erb'), "output/html/#{api_name}.html")
end

#outputObject

output directory



84
85
86
# File 'lib/doc_smoosher.rb', line 84

def output
  empty_directory OUTPUT
end