Class: Notifiable::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/generators/notifiable/install/install_generator.rb', line 14

def self.next_migration_number(path)
  unless @prev_migration_nr
    @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
  else
    @prev_migration_nr += 1
  end
  @prev_migration_nr.to_s
end

Instance Method Details

#copy_initializer_fileObject



32
33
34
# File 'lib/generators/notifiable/install/install_generator.rb', line 32

def copy_initializer_file
  copy_file "initializer.rb", "config/initializers/#{app_name}.rb"
end

#copy_migrationsObject



23
24
25
26
27
28
# File 'lib/generators/notifiable/install/install_generator.rb', line 23

def copy_migrations
  migration_template "create_notifiable_apps.rb", "db/migrate/create_notifiable_apps.rb"
  migration_template "create_notifiable_device_tokens.rb", "db/migrate/create_notifiable_device_tokens.rb"
  migration_template "create_notifiable_notifications.rb", "db/migrate/create_notifiable_notifications.rb"
  migration_template "create_notifiable_statuses.rb", "db/migrate/create_notifiable_statuses.rb"
end