Sha256: efd39e12836c03311374bcf18108dec4db63014c0e064f4b45aceb86c4d322c3

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

module TokenAction
  module Generators
    # Run this generator once before using TokenAction in your application.
    #
    # @example
    #   rails generate token_action
    #
    # @see Devise::Generators::InstallGenerator
    # @see Devise::Generators::DeviseGenerator
    class TokenActionGenerator < Rails::Generators::Base
      desc "Copies TokenAction's initializer and locale files, adds routes, " <<
        "and creates an ActiveRecord migration file if necessary."

      hook_for :orm
      namespace 'token_action'
      source_root File.expand_path('../templates', __FILE__)

      def copy_initializer_file
        template 'token_action.rb', 'config/initializers/token_action.rb'
      end

      def copy_locale_file
        copy_file '../../../config/locales/en.yml', 'config/locales/token_action.en.yml'
      end

      def add_routes
        route "mount TokenAction::Engine => '/token_action'"
      end

      def show_readme
        readme 'README' if behavior == :invoke
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
token_action-0.0.2 lib/generators/token_action_generator.rb
token_action-0.0.1 lib/generators/token_action_generator.rb