Class: FwtPushNotificationServer::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/fwt_push_notification_server/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/fwt_push_notification_server/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

#append_seedsObject



36
37
38
39
# File 'lib/generators/fwt_push_notification_server/install/install_generator.rb', line 36

def append_seeds
  seeds = File.read(File.join(File.dirname(__FILE__), "templates/seeds.rb"))
  append_file "db/seeds.rb", seeds
end

#copy_initializer_fileObject



30
31
32
# File 'lib/generators/fwt_push_notification_server/install/install_generator.rb', line 30

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

#copy_migrationsObject



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

def copy_migrations
  migration_template "create_fwt_push_notification_server_device_tokens.rb", "db/migrate/create_fwt_push_notification_server_device_tokens.rb"
  migration_template "devise_create_fwt_push_notification_server_users.rb", "db/migrate/devise_create_fwt_push_notification_server_users.rb"
end