Sha256: c91dc6b63be2af0b5d30f21f03b06c7bea016332aec8696f20545587bef09ac3

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

require 'refinery'

module Refinery
  module Generators
    autoload :EngineInstaller, File.expand_path('../refinery/generators', __FILE__)

    class Engine < Rails::Engine
      config.after_initialize do
        ::Refinery::Plugin.register do |plugin|
          plugin.name = "refinery_generators"
          plugin.hide_from_menu = true
        end
      end
    end
  end
end

# Below is a hack until this issue:
# https://rails.lighthouseapp.com/projects/8994/tickets/3820-make-railsgeneratorsmigrationnext_migration_number-method-a-class-method-so-it-possible-to-use-it-in-custom-generators
# is fixed on the Rails project.

require 'rails/generators/named_base'
require 'rails/generators/migration'
require 'rails/generators/active_model'
require 'active_record'

module ActiveRecord
  module Generators
    class Base < Rails::Generators::NamedBase #:nodoc:
      include Rails::Generators::Migration

      # Implement the required interface for Rails::Generators::Migration.
      def self.next_migration_number(dirname) #:nodoc:
        next_migration_number = current_migration_number(dirname) + 1
        if ActiveRecord::Base.timestamped_migrations
          [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
        else
          "%.3d" % next_migration_number
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
refinerycms-generators-0.9.9.3 lib/refinerycms-generators.rb
refinerycms-generators-0.9.9.2 lib/refinerycms-generators.rb
refinerycms-generators-0.9.9.1 lib/refinerycms-generators.rb
refinerycms-generators-0.9.9 lib/refinerycms-generators.rb