Sha256: 9f76528b61c7cc4ae63405f157ec05e8aff2ca24c7eff8b93ad2787bfe46d179

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

require 'refinery'
require File.expand_path('../refinery/generators', __FILE__)

module Refinery
  module Generators
    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'
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

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-generators-1.0.0 lib/refinerycms-generators.rb
refinerycms-generators-0.9.9.6 lib/refinerycms-generators.rb
refinerycms-generators-0.9.9.5 lib/refinerycms-generators.rb