Class: Ing::Commands::Generate
- Inherits:
-
Object
- Object
- Ing::Commands::Generate
- Includes:
- Boot, Ing::CommonOptions
- Defined in:
- lib/ing/commands/generate.rb
Overview
This is the boot command invoked from ‘ing generate …`
Constant Summary collapse
- DEFAULTS =
{ namespace: 'object', ing_file: 'ing.rb', gen_root: ENV.fetch('ING_GENERATOR_ROOT', '~/.ing/generators') }
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#before(*args) ⇒ Object
Require libs and ing_file, then locate and require the generator ruby file identified by the first arg, before dispatching to it.
- #generator_root ⇒ Object
-
#initialize(options) ⇒ Generate
constructor
A new instance of Generate.
Methods included from Ing::CommonOptions
#debug, #debug?, included, #ing_file, #namespace, #require_ing_file, #require_libs, #requires
Methods included from Boot
#after, #call, #configure_command
Constructor Details
#initialize(options) ⇒ Generate
Returns a new instance of Generate.
30 31 32 |
# File 'lib/ing/commands/generate.rb', line 30 def initialize() self. = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
29 30 31 |
# File 'lib/ing/commands/generate.rb', line 29 def @options end |
Class Method Details
.specify_options(parser) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/ing/commands/generate.rb', line 14 def self.(parser) parser.text "Run a generator task" parser.opt :gen_root, "Generators root directory", :type => :string, :short => 'r', :default => DEFAULTS[:gen_root] parser.stop_on_unknown end |
Instance Method Details
#before(*args) ⇒ Object
Require libs and ing_file, then locate and require the generator ruby file identified by the first arg, before dispatching to it.
37 38 39 40 41 |
# File 'lib/ing/commands/generate.rb', line 37 def before(*args) require_libs require_ing_file require_generator args.first end |
#generator_root ⇒ Object
25 26 27 |
# File 'lib/ing/commands/generate.rb', line 25 def generator_root @generator_root ||= File.([:gen_root]) end |