forked from timsu/apn_on_rails
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaning up generator, now uses migration_template (instead of hand r…
…olled solution)
- Loading branch information
Showing
16 changed files
with
64 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Description: | ||
Generate migrations needed to create APN tables | ||
|
||
Example: | ||
rails generate apn_on_rails:migrations | ||
|
||
This will create: | ||
db/migrate/<timestamp>_create_apn_devices.rb | ||
db/migrate/<timestamp>_create_apn_notifications.rb | ||
db/migrate/<timestamp>_create_apn_group_notifications.rb | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'rails/generators/active_record' | ||
|
||
module ApnOnRails | ||
module Generators | ||
class MigrationsGenerator < Rails::Generators::Base | ||
include Rails::Generators::Migration | ||
extend ActiveRecord::Generators::Migration | ||
|
||
# Set the current directory as base for the inherited generators. | ||
def self.base_root | ||
File.dirname(__FILE__) | ||
end | ||
|
||
source_root File.expand_path('../templates/migrations', __FILE__) | ||
|
||
def create_migrations | ||
# Dir.glob(File.join(self.class.base_root, 'templates', 'migrations', '*.rb')).sort.each do |file| | ||
# migration_template("#{File.basename(file)}", "db/migrate/#{File.basename(file)}"); | ||
# end | ||
|
||
migration_template('create_apn_devices.rb', 'db/migrate/create_apn_devices.rb') | ||
migration_template('create_apn_notifications.rb', 'db/migrate/create_apn_notifications.rb') | ||
migration_template('create_apn_apps.rb', 'db/migrate/create_apn_apps.rb') | ||
migration_template('alter_apn_devices.rb', 'db/migrate/alter_apn_devices.rb') | ||
migration_template('create_groups.rb', 'db/migrate/create_groups.rb') | ||
migration_template('alter_apn_groups.rb', 'db/migrate/alter_apn_groups.rb') | ||
migration_template('create_device_groups.rb', 'db/migrate/create_device_groups.rb') | ||
migration_template('create_apn_group_notifications.rb', 'db/migrate/create_apn_group_notifications.rb') | ||
migration_template('create_pull_notifications.rb', 'db/migrate/create_pull_notifications.rb') | ||
migration_template('alter_apn_notifications.rb', 'db/migrate/alter_apn_notifications.rb') | ||
migration_template('make_device_token_index_nonunique.rb', 'db/migrate/make_device_token_index_nonunique.rb') | ||
migration_template('add_launch_notification_to_apn_pull_notifications.rb', 'db/migrate/add_launch_notification_to_apn_pull_notifications.rb') | ||
|
||
end | ||
end | ||
end | ||
end | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.