### Home Classes Methods

### In Files

- lib/padrino-gen/generators/components/actions.rb
- lib/padrino-gen/generators/project.rb
- lib/padrino-gen/generators/controller.rb
- lib/padrino-gen/generators/task.rb
- lib/padrino-gen/generators/plugin.rb
- lib/padrino-gen/generators/component.rb
- lib/padrino-gen/generators/mailer.rb
- lib/padrino-gen/generators/app.rb
- lib/padrino-gen/generators/cli.rb
- lib/padrino-gen/generators/runner.rb
- lib/padrino-gen/generators/model.rb
- lib/padrino-gen/generators/migration.rb
- lib/padrino-gen/generators/actions.rb
- lib/padrino-gen/padrino-tasks/sql-helpers.rb
- lib/padrino-gen.rb

### Namespace

- MODULE Padrino::Generators::Actions
- MODULE Padrino::Generators::Components
- MODULE Padrino::Generators::Runner
- MODULE Padrino::Generators::SqlHelpers
- CLASS Padrino::Generators::App
- CLASS Padrino::Generators::AppRootNotFound
- CLASS Padrino::Generators::Cli
- CLASS Padrino::Generators::Component
- CLASS Padrino::Generators::Controller
- CLASS Padrino::Generators::Mailer
- CLASS Padrino::Generators::Migration
- CLASS Padrino::Generators::Model
- CLASS Padrino::Generators::Plugin
- CLASS Padrino::Generators::Project
- CLASS Padrino::Generators::Task

### Methods

- ::add_generator
- ::load_components!
- ::load_paths
- ::mappings

### Files

- README.rdoc
- README.rdoc

### Class/Module Index

Quicksearch

- Padrino
- Padrino::Generators
- Padrino::Generators::Actions
- Padrino::Generators::Actions::ClassMethods
- Padrino::Generators::App
- Padrino::Generators::AppRootNotFound
- Padrino::Generators::Cli
- Padrino::Generators::Component
- Padrino::Generators::Components
- Padrino::Generators::Components::Actions
- Padrino::Generators::Controller
- Padrino::Generators::Mailer
- Padrino::Generators::Migration
- Padrino::Generators::Model
- Padrino::Generators::Plugin
- Padrino::Generators::Project
- Padrino::Generators::Runner
- Padrino::Generators::SqlHelpers
- Padrino::Generators::Task
- ActiveRecord
- ActiveRecord::Schema
- Object

No matching classes.

# Padrino::Generators

This module it's used for register generators.

Can be useful for 3rd party generators:

    # custom_generator.rb
    class CustomGenerator < Thor::Group
      Padrino::Generators.add_generator(:custom_generator, self)
    end

Now for handle generators in padrino you need to add it to into `load_paths`.

Padrino::Generators.load_paths << "custom_generator.rb"

### Constants

DEV_PATH

  Defines the absolute path to the padrino source folder.

### Public Class Methods

add_generator(name, klass) click to toggle source

Global add a new generator class to `padrino-gen`.

@param [Symbol] name

    Key name for generator mapping.

@param [Class] klass

    Class of generator.

@return [Hash] generator mappings

@example

    Padrino::Generators.add_generator(:controller, Controller)

    # File lib/padrino-gen.rb, line 53
    def add_generator(name, klass)
      mappings[name] = klass
    end

load_components!() click to toggle source

Load Global Actions and Component Actions then all files in `load_path`.

    # File lib/padrino-gen.rb, line 60
    def load_components!
      require 'padrino-gen/generators/actions'
      require 'padrino-gen/generators/components/actions'
      require 'padrino-gen/generators/runner'
      load_paths.flatten.each { |file| require file  }
    end

load_paths() click to toggle source

Store our generators paths.

    # File lib/padrino-gen.rb, line 29
    def load_paths
      @_files ||= []
    end

mappings() click to toggle source

Return an ordered list of task with their class.

    # File lib/padrino-gen.rb, line 36
    def mappings
      @_mappings ||= ActiveSupport::OrderedHash.new
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.