bin/sprinkle in crafterm-sprinkle-0.1.5 vs bin/sprinkle in crafterm-sprinkle-0.1.6

- old
+ new

@@ -44,19 +44,25 @@ "Process but don't perform any actions") { |OPTIONS[:testing]| } opts.on("-v", "--verbose", "Verbose output") { |OPTIONS[:verbose]| } opts.on("-c", "--cloud", "Show powder cloud, ie. package hierarchy and installation order") { |OPTIONS[:cloud]| } + opts.on("-f", "--force", + "Force installation of all packages even if it is detected that it has been previously installed") { |OPTIONS[:force]| } opts.on("-h", "--help", "Show this help message.") { puts opts; exit } opts.parse!(ARGV) if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? } puts opts; exit end end +def force_mode(options) + Sprinkle::OPTIONS[:force] = OPTIONS[:force] || false +end + def operation_mode(options) Sprinkle::OPTIONS[:testing] = OPTIONS[:testing] || false end def powder_cloud(options) @@ -70,9 +76,10 @@ require 'sprinkle' powder = OPTIONS[:path] raise "Sprinkle script is not readable: #{powder}" unless File.readable?(powder) +force_mode(OPTIONS) operation_mode(OPTIONS) powder_cloud(OPTIONS) log_level(OPTIONS) Sprinkle::Script.sprinkle File.read(powder), powder