Class: Boxen::CLI
- Inherits:
-
Object
- Object
- Boxen::CLI
- Defined in:
- lib/boxen/cli.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
Class Method Summary collapse
-
.run(*args) ⇒ Object
Run Boxen by wiring together the command-line flags, config, preflights, Puppet execution, and postflights.
Instance Method Summary collapse
-
#initialize(config, flags) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/boxen/cli.rb', line 10 def config @config end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
11 12 13 |
# File 'lib/boxen/cli.rb', line 11 def flags @flags end |
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
12 13 14 |
# File 'lib/boxen/cli.rb', line 12 def runner @runner end |
Class Method Details
.run(*args) ⇒ Object
Run Boxen by wiring together the command-line flags, config, preflights, Puppet execution, and postflights. Returns Puppet’s exit code.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/boxen/cli.rb', line 33 def self.run(*args) config = Boxen::Config.load flags = Boxen::Flags.new args # Apply command-line flags to the config in case we're changing or # overriding anything. flags.apply config # Run the preflight checks. Boxen::Preflight.run config # Save the config for Puppet (and next time). Boxen::Config.save config # Make the magic happen. status = Boxen::CLI.new(config, flags).run # Run the postflight checks. Boxen::Postflight.run config if status.success? # Return Puppet's exit status. return status.code end |
Instance Method Details
#run ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/boxen/cli.rb', line 20 def run if flags.help? puts flags exit end runner.run end |