Sha256: 8bc84f09f83b162b4fb8d3c047707a83ab39e4b1ba5a7cd350c72d144b4791fe

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

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 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

1 entries across 1 versions & 1 rubygems

Version Path
saucy-0.1.1 lib/generators/saucy/install/install_generator.rb