Sha256: a42cfff648a99db66f05e609bd260e66368c80f4e257fcd71e774d7535d13914

Contents?: true

Size: 827 Bytes

Versions: 2

Compression:

Stored size: 827 Bytes

Contents

module PushType
  class PushType::InstallGenerator < Rails::Generators::Base
    desc "Install and configure PushType for this application"

    source_root File.expand_path('../templates', __FILE__)

    class_option :migrate, type: :boolean, default: true

    def create_push_type_initializer
      copy_file 'push_type.rb', 'config/initializers/push_type.rb'
    end

    def inject_push_type_routes
      inject_into_file 'config/routes.rb', "\n\n  mount_push_type\n", after: 'Rails.application.routes.draw do', verbose: true
    end

    def install_migrations
      say_status :copying, 'migrations'
      quietly { rake 'railties:install:migrations' }
    end

    def run_migrations
      if options[:migrate]
        say_status :running, 'migrations'
        quietly { rake 'db:migrate' }
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
push_type_core-0.1.1 lib/generators/push_type/install/install_generator.rb
push_type_core-0.1.0 lib/generators/push_type/install/install_generator.rb