Module: Apiway::Generator
- Defined in:
- lib/apiway/generator.rb
Constant Summary collapse
- HANDLERS =
{ create_application: [ '-a', 'a', 'app' ], create_controller: [ '-c', 'c', 'controller' ], create_resource: [ '-r', 'r', 'resource' ], create_model: [ '-m', 'm', 'model' ], help: [ '-h', 'h', 'help' ] }
- DESC =
{ create_application: 'Creating a new application (`apiway generate app Chat`)', create_controller: 'Creating a new controller (`apiway generate controller Messages`)', create_resource: 'Creating a new resource (`apiway generate resource Messages`)', create_model: 'Creating a new model (`apiway generate model Message`)', help: 'Show list of generator commands' }
Class Method Summary collapse
Class Method Details
.run(command = nil, *args) ⇒ Object
24 25 26 27 28 |
# File 'lib/apiway/generator.rb', line 24 def run( command = nil, *args ) return help unless command HANDLERS.each { |handler, commands| return send( handler, *args ) if commands.include? command } puts "Apiway: Unknown generate command `#{ args.unshift( command ).join " " }`" end |