Sha256: 351be6022c370179f571704e7e6c249fcd9bcf2d681e861ea22468734efa0fe8

Contents?: true

Size: 987 Bytes

Versions: 25

Compression:

Stored size: 987 Bytes

Contents

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

      desc "Creates an EffectiveLogging initializer in your application."

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

      def self.next_migration_number(dirname)
        if not ActiveRecord::Base.timestamped_migrations
          Time.new.utc.strftime("%Y%m%d%H%M%S")
        else
          "%.3d" % (current_migration_number(dirname) + 1)
        end
      end

      def copy_initializer
        template "effective_logging.rb", "config/initializers/effective_logging.rb"
      end

      def create_migration_file
        @logs_table_name = ':' + EffectiveLogging.logs_table_name.to_s

        migration_template '../../../db/migrate/01_create_effective_logging.rb.erb', 'db/migrate/create_effective_logging.rb'
      end

      def show_readme
        readme "README" if behavior == :invoke
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
effective_logging-1.2.0 lib/generators/effective_logging/install_generator.rb
effective_logging-1.1.3 lib/generators/effective_logging/install_generator.rb
effective_logging-1.1.2 lib/generators/effective_logging/install_generator.rb
effective_logging-1.1.0 lib/generators/effective_logging/install_generator.rb
effective_logging-1.0.0 lib/generators/effective_logging/install_generator.rb