Class: ApiSketch::Generators::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/api_sketch/generators/base.rb

Direct Known Subclasses

Bootstrap

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

TODO: Add here some validations for folders existance, etc



9
10
11
12
13
# File 'lib/api_sketch/generators/base.rb', line 9

def initialize(options = {})
  self.definitions_dir = options[:definitions_dir]
  self.documentation_dir = options[:documentation_dir]
  @templates_folder = File.expand_path("../templates/#{self.class.name.split("::").last.downcase}", File.dirname(__FILE__))
end

Instance Attribute Details

#definitions_dirObject

Returns the value of attribute definitions_dir.



4
5
6
# File 'lib/api_sketch/generators/base.rb', line 4

def definitions_dir
  @definitions_dir
end

#documentation_dirObject

Returns the value of attribute documentation_dir.



4
5
6
# File 'lib/api_sketch/generators/base.rb', line 4

def documentation_dir
  @documentation_dir
end

#templates_folderObject (readonly)

Returns the value of attribute templates_folder.



6
7
8
# File 'lib/api_sketch/generators/base.rb', line 6

def templates_folder
  @templates_folder
end

Instance Method Details

#generate!Object



15
16
17
18
19
20
21
22
23
# File 'lib/api_sketch/generators/base.rb', line 15

def generate!
  puts_info("Load definitions")
  load_definitions
  puts_info("Create documentation directory")
  puts_info("\t path: #{self.documentation_dir}")
  create_documentation_directory
  puts_info("Create documentation files")
  create_documentation_files
end