class GcmMigrationsGenerator

Generates the migrations necessary for Gcm on Rails. This should be run upon install and upgrade of the Gcm on Rails gem.

$ ruby script/generate gcm_migrations

Public Class Methods

base_root() click to toggle source

Set the current directory as base for the inherited generators.

# File lib/generators/gcm_migrations_generator.rb, line 12
def self.base_root
  File.dirname(__FILE__)
end

Public Instance Methods

create_migrations() click to toggle source
# 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