Sha256: 1f3ed1226a41d7ecde7374d3bc5713c08fd5ee58ecadc873d667e583d4f7039e
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 KB
Contents
require 'rails/generators/migration' module Notifiable module Generators class InstallGenerator < ::Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('../templates', __FILE__) desc "Add the migrations" 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 def copy_migrations migration_template "create_notifiable_apps.rb", "db/migrate/create_notifiable_apps.rb" migration_template "create_notifiable_device_tokens.rb", "db/migrate/create_notifiable_device_tokens.rb" migration_template "create_notifiable_notifications.rb", "db/migrate/create_notifiable_notifications.rb" migration_template "create_notifiable_notification_device_tokens.rb", "db/migrate/create_notifiable_notification_device_tokens.rb" end desc "Add initializer" def copy_initializer_file copy_file "initializer.rb", "config/initializers/#{app_name}.rb" end private def app_name "notifiable" end end end end
Version data entries
6 entries across 6 versions & 1 rubygems