Class: NoNotifierNeeded::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/generators/no_notifier_needed/install_generator.rb', line 26

def self.next_migration_number(dirname)
  next_migration_number = current_migration_number(dirname) + 1
  if ActiveRecord::Base.timestamped_migrations
    [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
  else
    "%.3d" % next_migration_number
  end
end

Instance Method Details

#copy_migration_and_configObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/no_notifier_needed/install_generator.rb', line 11

def copy_migration_and_config

  #Config file
  copy_file 'no_notifier_needed_initalizer.rb', 'config/initializers/no_notifier_needed_initalizer.rb'

  #Resque workers
  copy_file "jobs/email_processor.rb", "app/jobs/email_processor.rb"

  #Active Record File
  copy_file "email_template.rb", "app/models/email_template.rb"

  #create migration
  migration_template 'install.rb', 'db/migrate/install_acts_as_no_notifier_needed.rb'
end