Start stubbing Boxen.run

This commit is contained in:
John Barnette
2012-10-02 13:44:03 -07:00
parent 96831386b3
commit 75c595feed
2 changed files with 38 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
require "boxen/config"
require "boxen/flags"
module Boxen
# Is Boxen active?
@@ -6,6 +9,40 @@ module Boxen
ENV.include? "BOXEN_HOME"
end
# Run Boxen by wiring together the command-line flags, config,
# preflights, Puppet execution, and postflights. Returns Puppet's
# exit code.
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.
code = 0#Boxen::CLI.new(config, flags).run
# Run the postflight checks.
#Boxen::Postflight.run config
p :config => config
return code
end
# Run `args` as a system command with sudo if necessary.
def self.sudo *args

View File

@@ -94,7 +94,7 @@ module Boxen
end
end
parse args
parse args.flatten.compact
end
# Apply these flags to `config`. Returns `config`.