Class: Nppes::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



6
7
8
# File 'lib/generators/nppes/install_generator.rb', line 6

def self.next_migration_number(dirname)
  Time.now.strftime('%Y%m%d%H%M%S')
end

Instance Method Details

#copy_initializerObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/nppes/install_generator.rb', line 13

def copy_initializer
  [
      'add_nppes_table',
      'add_update_check_table',
      'add_license_table',
      'add_provider_address_table'
  ].each do |name|
    unless migration_exists?(name)
      migration_template(
          "active_record/#{name}.rb",
          migrate_path("#{name}.rb")
      )
      sleep(1)
    end
  end

  template 'templates/nppes.rb', 'config/initializers/nppes_settings.rb'
  generate 'delayed_job:active_record'
  template 'templates/delayed_jobs.rb', 'config/initializers/delayed_jobs.rb'
end