Sha256: aa1f62589b5101250a79a0ead325444d1a7222bc9765a18897b34ccf46d8876e
Contents?: true
Size: 933 Bytes
Versions: 7
Compression:
Stored size: 933 Bytes
Contents
module Apimaster::Generators class ControllerGenerator < Create attr_reader :app_name, :module_name, :name def initialize(runtime_args, runtime_options = {}) super raise 'Unknown app directory.' unless File.exists?('./Gemfile') @app_name = File.basename(File.expand_path('./')) @module_name = camelize(app_name) @name = args[0] raise 'Undefined app name.' unless @app_name end def manifest record do |m| m.template "app/controllers/examples_controller.rb.erb", "app/controllers/#{pluralize name}_controller.rb" m.template "test/functional/examples_controller_test.rb.erb", "test/functional/#{pluralize name}_controller_test.rb" end end private def banner <<-EOS Creates an Apimaster controller. USAGE: apimaster controller your_controller_name" NOTE: Without `_controller` suffix EOS end end end
Version data entries
7 entries across 7 versions & 1 rubygems