Class: GcmMigrationsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Extended by:
ActiveRecord::Generators::Migration
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/gcm_migrations_generator.rb

Overview

$ ruby script/generate gcm_migrations

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.base_rootObject

Set the current directory as base for the inherited generators.



12
13
14
# File 'lib/generators/gcm_migrations_generator.rb', line 12

def self.base_root
  File.dirname(__FILE__)
end

Instance Method Details

#create_migrationsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/gcm_migrations_generator.rb', line 18

def create_migrations
  templates = {
    'create_gcm_devices.rb' => 'db/migrate/create_gcm_devices.rb',
    'create_gcm_notifications.rb' => 'db/migrate/create_gcm_notifications.rb'
  }

  templates.each_pair do |name, path|
    begin
      migration_template(name, path)
    rescue => err
      puts "WARNING: #{err.message}"
    end
  end
end