Sha256: 89d40de67d49e8ee57cee68f0fd6150aeb5d34657776839a232eb6957cd5b748

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

Version Path
authority-2.0.0 lib/generators/authority/install_generator.rb