Class: DocSmoosher::Generators::Api

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



117
118
119
# File 'lib/doc_smoosher.rb', line 117

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#create_apiObject



121
122
123
124
# File 'lib/doc_smoosher.rb', line 121

def create_api
  template(File.join(TEMPLATES, 'api.tt'), "#{name}/#{name}.rb")
  copy_file(File.join(TEMPLATES, 'Readme.md'), "#{name}/Readme.md")
end

#done_messageObject

%w( resource parameter request ).each do |thing_name|

define_method "#{thing_name}_folder" do
  template(File.join(TEMPLATES, "#{thing_name}.tt"), "#{name}/#{thing_name.pluralize}/#{thing_name}_example.rb")
end

end



132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/doc_smoosher.rb', line 132

def done_message
  message = <<MESSAGE
    
    Scaffolding all built and ready!

    You now need to edit the example files/folders to setup the shape of your API, so you can generate documentation around it magically.

    Thanks for using doc_smoosher. Now smoosh them APIs gurd.  -  Joran Kikke  -  @donkeyscience
MESSAGE

  puts message
end