Sha256: f203afd90172ba214f0907c8197a6bac33d8837052093cd54e0adcbb9a7bca12

Contents?: true

Size: 989 Bytes

Versions: 5

Compression:

Stored size: 989 Bytes

Contents

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

class TrackChangesGenerator < Rails::Generators::Base #:nodoc:
  include Rails::Generators::Migration

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

  # Implement the required interface for Rails::Generators::Migration.
  # taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
  def self.next_migration_number(dirname)
    if ActiveRecord::Base.timestamped_migrations
      Time.now.utc.strftime("%Y%m%d%H%M%S")
    else
      "%.3d" % (current_migration_number(dirname) + 1)
    end
  end

  def create_migration_file
    migration_template 'migration.rb', 'db/migrate/create_audits_table.rb'
  end

  def generate_layout
    copy_file 'stylesheet.css', 'public/stylesheets/track_changes.css'
  end

  def create_initializer_file
    copy_file 'initializer.rb', 'config/initializers/track_changes_configuration.rb'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
track_changes-1.0.1 lib/generators/track_changes/track_changes_generator.rb
track_changes-1.0.0 lib/generators/track_changes/track_changes_generator.rb
track_changes-1.0.0.pre3 lib/generators/track_changes/track_changes_generator.rb
track_changes-1.0.0.pre2 lib/generators/track_changes/track_changes_generator.rb
track_changes-1.0.0.pre1 lib/generators/track_changes/track_changes_generator.rb