Sha256: 2598dc343c3cd534a18495ad94f47d265f2d5813de1571cb8ab3e738791b7884

Contents?: true

Size: 924 Bytes

Versions: 1

Compression:

Stored size: 924 Bytes

Contents

require 'rails/generators'

class VestalVersionsGenerator < Rails::Generators::NamedBase
  include Rails::Generators::Migration
  
  argument :name, :type => :string, :default => "create_vestal_versions"
  source_root File.expand_path('../templates', __FILE__)
  
  def generate_files
    migration_template 'migration.rb', File.join('db', 'migrate', 'create_vestal_versions')
    template 'initializer.rb', File.join('config', 'initializers', 'vestal_versions.rb')
  end
  
protected
  # Lets make this hacky thing while ticket #3820 isn't applied again...
  # https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3820
  def self.next_migration_number(dirname) #:nodoc:
    orm = Rails.configuration.generators.options[:rails][:orm]
    require "rails/generators/#{orm}"
    "#{orm.to_s.camelize}::Generators::Base".constantize.next_migration_number(dirname)
  rescue
    raise NotImplementedError
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitfluent-vestal_versions-1.1.0 generators/vestal_versions/vestal_versions_generator.rb