Sha256: b54f8d1a19ddddef9cfc2c22767625cd463e23368a0070143dc77aa1708622c2

Contents?: true

Size: 1.25 KB

Versions: 62

Compression:

Stored size: 1.25 KB

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 :datastream_directory, :type => :string, :default => 'models/datastreams', :desc => "Which datastream directory to generate? (i.e. models/datastreams)"
    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('datastream.rb.erb',File.join('app', datastream_directory, "#{file_name}_metadata.rb"))
      template('model_spec.rb.erb',File.join('spec', directory, "#{file_name}_spec.rb"))
      template('datastream_spec.rb.erb',File.join('spec', datastream_directory, "#{file_name}_metadata_spec.rb"))
    end

    protected

    def directory
      options[:directory]
    end

    def datastream_directory
      options[:datastream_directory]
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
active-fedora-8.7.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.6.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.5.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.4.2 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.4.1 lib/generators/active_fedora/model/model_generator.rb
active-fedora-7.3.1 lib/generators/active_fedora/model/model_generator.rb
active-fedora-7.3.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.4.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.3.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.2.2 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.2.1 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.2.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-7.2.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-6.8.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.1.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.0.1 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.0.0 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.0.0.rc3 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.0.0.rc2 lib/generators/active_fedora/model/model_generator.rb
active-fedora-8.0.0.rc1 lib/generators/active_fedora/model/model_generator.rb