Class: ConfigScripts::MigrationsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/config_scripts/generators/migrations.rb

Overview

This class provides a generator for creating the migrations that we need to use this gem.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object

This method gets the number for the next migration created by this generator.

We use the current timestamp.

Parameters:

  • dirname (String)

    The name of the directory in which we are creating the migrations.



21
22
23
# File 'lib/config_scripts/generators/migrations.rb', line 21

def self.next_migration_number(dirname)
  Time.now.to_s(:number)
end

Instance Method Details

#create_migrationsObject

This generator creates the migrations that we need for the gem.



10
11
12
# File 'lib/config_scripts/generators/migrations.rb', line 10

def create_migrations
  copy_migration 'create_config_scripts'
end