Sha256: 0b72e4860d6c2234b7f6db4a21481879f11b823964064be176edbe77e299b510

Contents?: true

Size: 809 Bytes

Versions: 2

Compression:

Stored size: 809 Bytes

Contents

module Apimaster::Generators
  class ModelGenerator < 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/models/example.rb.erb", "app/models/#{name}.rb"
        m.template "test/unit/example_test.rb.erb", "test/unit/#{name}_test.rb"
        m.template "test/factory/example_factory.rb.erb", "test/factory/#{name}_factory.rb"
      end
    end

    private
      def banner
        <<-EOS
  Creates an Apimaster model.

  USAGE: apimaster model your_model_name"

  EOS
      end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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