Class: DeployPin::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/deploy_pin/install/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



10
11
12
13
# File 'lib/generators/deploy_pin/install/install_generator.rb', line 10

def self.next_migration_number(path)
  next_migration_number = current_migration_number(path) + 1
  ActiveRecord::Migration.next_migration_number(next_migration_number)
end

Instance Method Details

#activerecord_migration_classObject



23
24
25
26
27
28
29
# File 'lib/generators/deploy_pin/install/install_generator.rb', line 23

def activerecord_migration_class
  if ::ActiveRecord::Migration.respond_to?(:current_version)
    "ActiveRecord::Migration[#{::ActiveRecord::Migration.current_version}]"
  else
    'ActiveRecord::Migration'
  end
end

#copy_initializerObject



19
20
21
# File 'lib/generators/deploy_pin/install/install_generator.rb', line 19

def copy_initializer
  template 'deploy_pin.rb', 'config/initializers/deploy_pin.rb'
end

#copy_migrationsObject



15
16
17
# File 'lib/generators/deploy_pin/install/install_generator.rb', line 15

def copy_migrations
  migration_template 'create_deploy_pins.rb', 'db/migrate/create_deploy_pins.rb'
end