Class: PushGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



5
6
7
# File 'lib/generators/push_generator.rb', line 5

def self.next_migration_number(path)
  Time.now.utc.strftime("%Y%m%d%H%M%S")
end

Instance Method Details

#copy_configObject



17
18
19
# File 'lib/generators/push_generator.rb', line 17

def copy_config
  copy_file "feedback_processor.rb",  "lib/push/feedback_processor.rb"
end

#copy_migrationObject



9
10
11
12
13
14
15
# File 'lib/generators/push_generator.rb', line 9

def copy_migration
  migration_dir = File.expand_path("db/migrate")

  if !self.class.migration_exists?(migration_dir, 'create_push')
    migration_template "create_push.rb", "db/migrate/create_push.rb"
  end
end