Class: C2dmMigrationsGenerator

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

Overview

$ ruby script/generate c2dm_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/c2dm_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/c2dm_migrations_generator.rb', line 18

def create_migrations
  templates = {
    'create_c2dm_devices.rb' => 'db/migrate/create_c2dm_devices.rb',
    'create_c2dm_notifications.rb' => 'db/migrate/create_c2dm_notifications.rb'
  }

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