Sha256: 31ec4acc5adee02bc153d5f1e7e3d920de383a5c78c7afe3873c76b1439d005d

Contents?: true

Size: 858 Bytes

Versions: 7

Compression:

Stored size: 858 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 ('../' * 3) + 'config/effective_logging.rb', 'config/initializers/effective_logging.rb'
      end

      def create_migration_file
        migration_template ('../' * 3) + 'db/migrate/101_create_effective_logging.rb', 'db/migrate/create_effective_logging.rb'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
effective_logging-4.3.1 lib/generators/effective_logging/install_generator.rb
effective_logging-4.3.0 lib/generators/effective_logging/install_generator.rb
effective_logging-4.2.0 lib/generators/effective_logging/install_generator.rb
effective_logging-4.1.3 lib/generators/effective_logging/install_generator.rb
effective_logging-4.1.2 lib/generators/effective_logging/install_generator.rb
effective_logging-4.1.1 lib/generators/effective_logging/install_generator.rb
effective_logging-4.1.0 lib/generators/effective_logging/install_generator.rb