module Tennpipes::Generators
This module it's used for register generators.
Can be useful for 3rd party generators:
# custom_generator.rb class CustomGenerator < Thor::Group Tennpipes::Generators.add_generator(:custom_generator, self) end
Now for handle generators in tennpipes you need to add it to into load_paths
.
Tennpipes::Generators.load_paths
<< “custom_generator.rb”
Constants
- DEFAULT_HELPER_NAME
Default helper name for use in tiny app skeleton generator.
- DEV_PATH
Defines the absolute path to the tennpipes source folder.
Public Class Methods
add_generator(name, klass)
click to toggle source
Global add a new generator class to tennpipes-init
.
@param [Symbol] name
Key name for generator mapping.
@param [Class] klass
Class of generator.
@return [Hash] generator mappings
@example
Tennpipes::Generators.add_generator(:controller, Controller)
# File lib/tennpipes-init.rb, line 52 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/tennpipes-init.rb, line 59 def load_components! require 'tennpipes-init/generators/actions' require 'tennpipes-init/generators/components/actions' require 'tennpipes-init/generators/runner' load_paths.flatten.each { |file| require file } end
load_paths()
click to toggle source
Store our generators paths.
# File lib/tennpipes-init.rb, line 28 def load_paths @_files ||= [] end
mappings()
click to toggle source
Return an ordered list of task with their class.
# File lib/tennpipes-init.rb, line 35 def mappings @_mappings ||= ActiveSupport::OrderedHash.new end