Sha256: a2b636f3eef8bffb6360877d71e140a3afae6526e848f4f520b563dcce5e62e2

Contents?: true

Size: 867 Bytes

Versions: 29

Compression:

Stored size: 867 Bytes

Contents

require 'rails/generators'
require 'rails/generators/migration'
require 'active_record'
require 'rails/generators/active_record'

module Audited
  module Generators
    class InstallGenerator < Rails::Generators::Base
      include Rails::Generators::Migration

      source_root File.expand_path("../templates", __FILE__)

      # 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

      def copy_migration
        migration_template 'install.rb', 'db/migrate/install_audited.rb'
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 4 rubygems

Version Path
notifiably_audited-0.0.6 lib/generators/audited/install_generator.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/audited-activerecord-3.0.0/lib/generators/audited/install_generator.rb
audited-activerecord-3.0.0 lib/generators/audited/install_generator.rb
audited-activerecord-3.0.0.rc2 lib/generators/audited/install_generator.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/audited-activerecord-3.0.0.rc1/lib/generators/audited/install_generator.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/audited-activerecord-3.0.0.rc1/lib/generators/audited/install_generator.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/audited-activerecord-3.0.0.rc1/lib/generators/audited/install_generator.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/audited-activerecord-3.0.0.rc1/lib/generators/audited/install_generator.rb
audited-activerecord-3.0.0.rc1 lib/generators/audited/install_generator.rb