Class: ActsAsPushable::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/generators/acts_as_pushable/install_generator.rb', line 18

def self.next_migration_number(dirname)
  if ActiveRecord::Base.timestamped_migrations
    sleep 1 # make sure each time we get a different timestamp
    Time.new.utc.strftime("%Y%m%d%H%M%S")
  else
    "%.3d" % (current_migration_number(dirname) + 1)
  end
end

Instance Method Details

#copy_initializer_fileObject



10
11
12
# File 'lib/generators/acts_as_pushable/install_generator.rb', line 10

def copy_initializer_file
  template "initializer.rb", "config/initializers/acts_as_pushable.rb"
end

#copy_migration_filesObject



14
15
16
# File 'lib/generators/acts_as_pushable/install_generator.rb', line 14

def copy_migration_files
  migration_template "migration/devices.rb", "db/migrate/devices.rb"
end