Module: Padrino::Generators
- Defined in:
- padrino-gen/lib/padrino-gen.rb,
padrino-gen/lib/padrino-gen/generators/app.rb,
padrino-gen/lib/padrino-gen/generators/cli.rb,
padrino-gen/lib/padrino-gen/generators/task.rb,
padrino-gen/lib/padrino-gen/generators/model.rb,
padrino-gen/lib/padrino-gen/generators/helper.rb,
padrino-gen/lib/padrino-gen/generators/mailer.rb,
padrino-gen/lib/padrino-gen/generators/plugin.rb,
padrino-gen/lib/padrino-gen/generators/runner.rb,
padrino-gen/lib/padrino-gen/generators/actions.rb,
padrino-gen/lib/padrino-gen/generators/project.rb,
padrino-gen/lib/padrino-gen/generators/component.rb,
padrino-gen/lib/padrino-gen/generators/migration.rb,
padrino-gen/lib/padrino-gen/generators/controller.rb,
padrino-admin/lib/padrino-admin/generators/actions.rb,
padrino-admin/lib/padrino-admin/generators/admin_app.rb,
padrino-admin/lib/padrino-admin/generators/admin_page.rb
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 collapse
- DEV_PATH =
Defines the absolute path to the padrino source folder.
File.("../../", File.dirname(__FILE__))
- DEFAULT_HELPER_NAME =
Default helper name for use in tiny app skeleton generator.
"Helper".freeze
Class Method Summary collapse
-
.add_generator(name, klass) ⇒ Hash
Global add a new generator class to
padrino-gen
. -
.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.
Class Method Details
.add_generator(name, klass) ⇒ Hash
Global add a new generator class to padrino-gen
.
53 54 55 |
# File 'padrino-gen/lib/padrino-gen.rb', line 53 def add_generator(name, klass) mappings[name] = klass end |
.load_components! ⇒ Object
Load Global Actions and Component Actions then all files in load_path
.
60 61 62 63 64 65 |
# File 'padrino-gen/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 ⇒ Object
Store our generators paths.
29 30 31 |
# File 'padrino-gen/lib/padrino-gen.rb', line 29 def load_paths @_files ||= [] end |
.mappings ⇒ Object
Return an ordered list of task with their class.
36 37 38 |
# File 'padrino-gen/lib/padrino-gen.rb', line 36 def mappings @_mappings ||= {} end |