Sha256: 5e80b43cb145d5d715720aa5d95cd91cd4f3f0e5ace7efa629934dd6ee0a6ab6

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'rails_generator/generators/components/model/model_generator'
require 'active_record'
require File.dirname(__FILE__) + '/../rspec_default_values'

class RspecDmModelGenerator <ModelGenerator

  def manifest
    record do |m|

      # Check for class naming collisions.
      #m.class_collisions class_path, class_name

      # Model, spec, and fixture directories.
      m.directory File.join('app/models', class_path)
      m.directory File.join('spec/models', class_path)

      # Model class, spec and fixtures.
      m.template 'model.rb',      File.join('app/models', 
                                            class_path, 
                                            "#{file_name}.rb")
      m.template 'model_spec.rb', File.join('spec/models', 
                                            class_path, 
                                            "#{file_name}_spec.rb")
    end

#     unless options[:skip_migration]
#       m.migration_template 'model:migration.rb', 'db/migrate', :assigns => {
#         :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}"
#       }, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}"
#     end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datamapper4rail-0.2.0 generators/rspec_dm_model/rspec_dm_model_generator.rb