Sha256: 2bbca2c8cb208a6b2bea9638994697c47440026a0f39f44bc3714521733a81a7

Contents?: true

Size: 863 Bytes

Versions: 2

Compression:

Stored size: 863 Bytes

Contents

module Apimaster::Generators
  class ControllerGenerator < Create
    attr_reader :app_name, :module_name, :name

    def initialize(runtime_args, runtime_options = {})
      super
      @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

2 entries across 2 versions & 1 rubygems

Version Path
apimaster-0.0.4 lib/apimaster/generators/controller_generator.rb
apimaster-0.0.3 lib/apimaster/generators/controller_generator.rb