Sha256: 2d7f88236de6f6d1e1839a002fe27b8cab0cd3b32e382a16242db82fe637e57b

Contents?: true

Size: 1.13 KB

Versions: 13

Compression:

Stored size: 1.13 KB

Contents

require 'rails/generators/migration'

module FwtPushNotificationServer
  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_fwt_push_notification_server_device_tokens.rb", "db/migrate/create_fwt_push_notification_server_device_tokens.rb"
        migration_template "add_provider_to_push_notification_server_device_tokens.rb", "db/migrate/add_provider_to_push_notification_server_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
          "fwt_push_notification_server"
        end

    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fwt_push_notification_server-0.1.0.b11 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.1.0.b10 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.1.0.b9 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.1.0.b8 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.1.0.b7 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.1.0.b6 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.1.0.b5 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.1.0.b4 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.1.0.b3 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.1.0.b2 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.1.0.b1 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.0.7 lib/generators/fwt_push_notification_server/install/install_generator.rb
fwt_push_notification_server-0.0.7.b4 lib/generators/fwt_push_notification_server/install/install_generator.rb