Sha256: d640f6252ad145a6f78fd919b7beabad67fc1fb72340d5c1790ca4f8ea0869ed

Contents?: true

Size: 711 Bytes

Versions: 3

Compression:

Stored size: 711 Bytes

Contents

class ModelGenerator < Templater::Generator

  def self.source_root
    File.join %W| #{File.dirname(__FILE__)} .. .. .. templates model |
  end

  first_argument :name, :required => true

  empty_directory :models, 'models'
  template :model do |t|
    t.source      = File.join %W| models model.rb|
    t.destination = File.join %W| models %underscore%.rb |
  end

  empty_directory :tests, File.join('test','models')
  template :test do |t|
    t.source      = File.join %W| test models test_model.rb |
    t.destination = File.join %W| test models test_%underscore%.rb |
  end

  invoke :migration do |generator|
    generator.new(destination_root, options.merge(:name => true), migration_name )
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
michaelbarton-gigantron-0.1.6 lib/gigantron/generators/model_generator.rb
michaelbarton-gigantron-0.1.7 lib/gigantron/generators/model_generator.rb
michaelbarton-gigantron-0.1.8 lib/gigantron/generators/model_generator.rb