Sha256: c2e68fd7bcc7e3b5e67254b4e1ea4bb9e4249884254af672861e6149d2d9af0f

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

require 'generators/saucy/base'
require 'rails/generators/active_record/migration'

module Saucy
  module Generators
    class InstallGenerator < Base
      include Rails::Generators::Migration
      extend ActiveRecord::Generators::Migration

      desc <<DESC
Description:
    Copy saucy files to your application.
DESC

      def generate_migration
        migration_template "create_saucy_tables.rb", "db/migrate/create_saucy_tables.rb"
      end

      def rake_engine_migrations
        rake("saucy_engine:install:migrations")
      end

      def create_models
        directory "models", "app/models"
      end

      def create_controllers
        directory "controllers", "app/controllers"
      end

      def update_user_model
        insert_into_file "app/models/user.rb",
                         "\ninclude Saucy::User",
                         :after => "include Clearance::User"
      end

      def add_account_authorization
        insert_into_file "app/controllers/application_controller.rb",
                         "\ninclude Saucy::AccountAuthorization",
                         :after => "include Clearance::Authentication"
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
saucy-0.16.1 lib/generators/saucy/install/install_generator.rb
saucy-0.16.0 lib/generators/saucy/install/install_generator.rb
saucy-0.15.2 lib/generators/saucy/install/install_generator.rb
saucy-0.15.1 lib/generators/saucy/install/install_generator.rb
saucy-0.15.0 lib/generators/saucy/install/install_generator.rb
saucy-0.14.5 lib/generators/saucy/install/install_generator.rb
saucy-0.14.3 lib/generators/saucy/install/install_generator.rb
saucy-0.14.2 lib/generators/saucy/install/install_generator.rb
saucy-0.14.1 lib/generators/saucy/install/install_generator.rb
saucy-0.14.0 lib/generators/saucy/install/install_generator.rb
saucy-0.13.3 lib/generators/saucy/install/install_generator.rb
saucy-0.13.2 lib/generators/saucy/install/install_generator.rb
saucy-0.13.1 lib/generators/saucy/install/install_generator.rb
saucy-0.13.0 lib/generators/saucy/install/install_generator.rb