W3cubDocs

/Padrino

Module: Padrino::Generators

Overview

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”

Defined Under Namespace

Modules: Actions, Admin, Runner Classes: AdminApp, AdminPage, App, AppRootNotFound, Cli, Component, Controller, Helper, Mailer, Migration, Model, Plugin, Project, Task

Constant Summary

DEV_PATH =

Defines the absolute path to the padrino source folder.

File.expand_path("../../", File.dirname(__FILE__))
DEFAULT_HELPER_NAME =

Default helper name for use in tiny app skeleton generator.

"Helper".freeze

Class Method Summary

Class Method Details

.add_generator(name, klass) ⇒ Hash

Global add a new generator class to padrino-gen.

Examples:

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

Parameters:

  • name (Symbol) — Key name for generator mapping.
  • klass (Class) — Class of generator.

Returns:

  • (Hash) — generator mappings

.load_components! ⇒ Object

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

.load_paths ⇒ Object

Store our generators paths.

.mappings ⇒ Object

Return an ordered list of task with their class.

© 2010–2016 Padrino
Licensed under the MIT License.
http://www.rubydoc.info/github/padrino/padrino-framework/Padrino/Generators