Class: Producer::Core::CLI
- Inherits:
-
Baf::CLI
- Object
- Baf::CLI
- Producer::Core::CLI
- Defined in:
- lib/producer/core/cli.rb
Constant Summary collapse
- ArgumentError =
Class.new(ArgumentError)
- USAGE =
"Usage: #{File.basename $0} [options] [recipes] [-- recipe_argument...]" .freeze
- ARGUMENTS_SEPARATOR =
'--'.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #evaluate_recipes ⇒ Object
- #parse_arguments! ⇒ Object
- #run(worker: Worker.new(env)) ⇒ Object
- #setup ⇒ Object
Class Method Details
.handle_error(env, ex) ⇒ Object
13 14 15 |
# File 'lib/producer/core/cli.rb', line 13 def handle_error env, ex env.puts_error ErrorFormatter.new(debug: env.debug?).format ex end |
Instance Method Details
#evaluate_recipes ⇒ Object
43 44 45 |
# File 'lib/producer/core/cli.rb', line 43 def evaluate_recipes arguments.map { |e| Recipe::FileEvaluator.evaluate(e, env) } end |
#parse_arguments! ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/producer/core/cli.rb', line 29 def parse_arguments! if arguments.include? ARGUMENTS_SEPARATOR @arguments, env.recipe_argv = split_arguments_lists arguments end super usage! if arguments.empty? end |