Class: Paknife::Cli
- Inherits:
-
Object
- Object
- Paknife::Cli
- Defined in:
- lib/paknife/cli.rb
Constant Summary collapse
- BACKENDS =
%w(solo zero)
- SUBCOMMANDS =
%w(bootstrap clean cook prepare)
- DEFAULT_KNIFE =
"bundle exec knife"
- DEFAULT_THREADS =
2
- DEFAULT_OPTIONS =
{ knife: nil, quiet: false, threads: nil, }
Instance Attribute Summary collapse
-
#contexts ⇒ Object
readonly
Returns the value of attribute contexts.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Cli
constructor
A new instance of Cli.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ Cli
Returns a new instance of Cli.
25 26 27 28 |
# File 'lib/paknife/cli.rb', line 25 def initialize(argv) @options, backend, subcommand, nodes, = parse_argv(argv) @contexts = build_contexts(backend, subcommand, nodes, ) end |
Instance Attribute Details
#contexts ⇒ Object (readonly)
Returns the value of attribute contexts.
23 24 25 |
# File 'lib/paknife/cli.rb', line 23 def contexts @contexts end |
Class Method Details
.run(argv) ⇒ Object
19 20 21 |
# File 'lib/paknife/cli.rb', line 19 def self.run(argv) new(argv).run end |
Instance Method Details
#run ⇒ Object
30 31 32 33 34 |
# File 'lib/paknife/cli.rb', line 30 def run Parallel.each(contexts, in_threads: determine_threads) do |context| context.run end end |