Sha256: f6805b3333697d377cd179abd228d1e9c757b0cfa83f876c713d7c3143175f2c

Contents?: true

Size: 1.11 KB

Versions: 12

Compression:

Stored size: 1.11 KB

Contents

require 'rails/generators/base'

module Authority
  module Generators
    class InstallGenerator < Rails::Generators::Base

      source_root File.expand_path("../../templates", __FILE__)
      desc "Creates an Authority initializer for your application."

      def do_all
        create_authorizers_directory
        copy_application_authorizer
        copy_initializer
        copy_forbidden
        message = <<-RUBY

        Install complete! See the README on Github for instructions on getting your
        app running with Authority.

        RUBY
        puts message.strip_heredoc

      end

      private

      def create_authorizers_directory
        # Creates empty directory if none; doesn't empty the directory
        empty_directory "app/authorizers"
      end

      def copy_application_authorizer
        template "application_authorizer.rb", "app/authorizers/application_authorizer.rb"
      end

      def copy_initializer
        template "authority_initializer.rb", "config/initializers/authority.rb"
      end

      def copy_forbidden
        template "403.html", "public/403.html"
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
authority-3.3.0 lib/generators/authority/install_generator.rb
authority-3.2.2 lib/generators/authority/install_generator.rb
authority-3.2.1 lib/generators/authority/install_generator.rb
authority-3.2.0 lib/generators/authority/install_generator.rb
authority-3.1.0 lib/generators/authority/install_generator.rb
authority-3.0.0 lib/generators/authority/install_generator.rb
authority-2.10.0 lib/generators/authority/install_generator.rb
authority-2.9.0 lib/generators/authority/install_generator.rb
authority-2.8.1 lib/generators/authority/install_generator.rb
authority-2.8.0 lib/generators/authority/install_generator.rb
authority-2.7.0 lib/generators/authority/install_generator.rb
authority-2.6.0 lib/generators/authority/install_generator.rb