Sha256: 642076aad554f8576e1b76b74454a8953f7cbb5730665d77413ae76029aeb1c6

Contents?: true

Size: 709 Bytes

Versions: 5

Compression:

Stored size: 709 Bytes

Contents

require 'rails/generators/migration'
require 'generators/log_book/migration'
require 'rails_log_book'

module LogBook
  module Generators
    class InstallGenerator < Rails::Generators::Base
      include Rails::Generators::Migration
      extend LogBook::Generators::Migration

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

      def copy_initalizer
        copy_file 'initializer.rb', 'config/initializers/log_book.rb'
      end

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

      def migration_version
        if rails5?
          "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_log_book-2.4.0 lib/generators/log_book/install_generator.rb
rails_log_book-2.3.0 lib/generators/log_book/install_generator.rb
rails_log_book-2.2.0 lib/generators/log_book/install_generator.rb
rails_log_book-2.1.0 lib/generators/log_book/install_generator.rb
rails_log_book-1.0.0 lib/generators/log_book/install_generator.rb