Sha256: 9aa11c6c2bbe30999cc8bea8b8db77fc2e3732cd2676088bdb031743b62779b1

Contents?: true

Size: 1.06 KB

Versions: 123

Compression:

Stored size: 1.06 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 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

123 entries across 123 versions & 2 rubygems

Version Path
saucy-0.2.5 lib/generators/saucy/install/install_generator.rb
saucy-0.2.4.1 lib/generators/saucy/install/install_generator.rb
saucy-0.2.4 lib/generators/saucy/install/install_generator.rb
saucy-0.2.3 lib/generators/saucy/install/install_generator.rb
saucy-0.2.2 lib/generators/saucy/install/install_generator.rb
saucy-0.2.1 lib/generators/saucy/install/install_generator.rb
saucy-0.2.0 lib/generators/saucy/install/install_generator.rb
saucy-0.1.18 lib/generators/saucy/install/install_generator.rb
saucy-0.1.17 lib/generators/saucy/install/install_generator.rb
saucy-0.1.16 lib/generators/saucy/install/install_generator.rb
saucy-0.1.15 lib/generators/saucy/install/install_generator.rb
saucy-0.1.14 lib/generators/saucy/install/install_generator.rb
saucy-0.1.13 lib/generators/saucy/install/install_generator.rb
saucy-0.1.12 lib/generators/saucy/install/install_generator.rb
saucy-0.1.11 lib/generators/saucy/install/install_generator.rb
saucy-0.1.9 lib/generators/saucy/install/install_generator.rb
saucy-0.1.8 lib/generators/saucy/install/install_generator.rb
saucy-0.1.7 lib/generators/saucy/install/install_generator.rb
saucy-0.1.6 lib/generators/saucy/install/install_generator.rb
saucy-0.1.5 lib/generators/saucy/install/install_generator.rb