Class: ActsAsCleo::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/generators/acts_as_cleo/install/install_generator.rb', line 27

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



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

def copy_migration_and_config

  #Config file
  copy_file 'cleo.yml', "config/cleo.yml"
  copy_file 'cleo_initalizer.rb', 'config/initializers/cleo_initalizer.rb'

  #Resque workers
  copy_file "jobs/cleo_connection_processor.rb", "app/jobs/cleo_connection_processor.rb"
  copy_file "jobs/cleo_element_processor.rb", "app/jobs/cleo_element_processor.rb"

  #create migration
  migration_template 'install.rb', 'db/migrate/install_acts_as_cleo.rb'
  migration_template 'update.rb', 'db/migrate/update_acts_as_cleo.rb'
end