Sha256: 0d6b2c9b40b81397b2dc973165a20327ae2346dc7f3b7dd6985e9253cd87bcd7

Contents?: true

Size: 835 Bytes

Versions: 5

Compression:

Stored size: 835 Bytes

Contents

require 'rails/generators'

module ActiveFedora
  class ModelGenerator < Rails::Generators::NamedBase
    source_root File.expand_path('../templates', __FILE__)
    check_class_collision

    class_option :directory, :type => :string, :default => 'models', :desc => "Which directory to generate? (i.e. app/DIRECTORY)"
    class_option :has_file_datastream, :type => :string, :default => nil, :desc => "Name a file datastream to create"
    class_option :descMetadata, :type => :string, :default => nil, :desc => "Add a descMetadata metadata datastream"

    def install
      template('model.rb.erb',File.join('app', directory, "#{file_name}.rb"))
      template('model_spec.rb.erb',File.join('spec', directory, "#{file_name}_spec.rb"))
    end

    protected

    def directory
      options[:directory] || 'models'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active-fedora-6.4.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-6.4.0.rc4 lib/generators/active_fedora/model/model_generator.rb
active-fedora-6.4.0.rc3 lib/generators/active_fedora/model/model_generator.rb
active-fedora-6.4.0.rc2 lib/generators/active_fedora/model/model_generator.rb
active-fedora-6.4.0.rc1 lib/generators/active_fedora/model/model_generator.rb