Class: RepositoryManager::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/generators/repository_manager/install_generator.rb', line 7

def self.next_migration_number path
  unless @prev_migration_nr
    @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
  else
    @prev_migration_nr += 1
  end
  @prev_migration_nr.to_s
end

Instance Method Details

#copy_migrationsObject

all public methods in here will be run in order def copy_initializer_file

copy_file "initializer.rb", "config/initializers/repository_manager_initializer.rb"

end



21
22
23
24
25
26
27
28
# File 'lib/generators/repository_manager/install_generator.rb', line 21

def copy_migrations
  migrations = [["20131018214212_create_repository_manager.rb","create_repository_manager.rb"],
                ["20131025085844_add_file_to_repositories.rb","add_file_to_repositories.rb"]
                ]
  migrations.each do |migration|
    migration_template "../../../../db/migrate/" + migration[0], "db/migrate/" + migration[1]
  end
end