mirror of
https://github.com/zhigang1992/boxen.git
synced 2026-01-12 17:12:46 +08:00
Start stubbing Boxen.run
This commit is contained in:
37
lib/boxen.rb
37
lib/boxen.rb
@@ -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
|
||||
|
||||
@@ -94,7 +94,7 @@ module Boxen
|
||||
end
|
||||
end
|
||||
|
||||
parse args
|
||||
parse args.flatten.compact
|
||||
end
|
||||
|
||||
# Apply these flags to `config`. Returns `config`.
|
||||
|
||||
Reference in New Issue
Block a user