summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow (uranus) <paul@buetow.org>2015-10-18 10:39:17 +0100
committerPaul Buetow (uranus) <paul@buetow.org>2015-10-18 10:39:17 +0100
commitb0b92420522edeffa7d8ea58304448f89d772032 (patch)
tree5f710e799acbd09a681d150f58fd58226517f6c3
parente89753d9088c6b4c4401438aa7f15bda7fb3033d (diff)
refactor
-rwxr-xr-xrubyfy.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/rubyfy.rb b/rubyfy.rb
index a2aa3ce..81f12a0 100755
--- a/rubyfy.rb
+++ b/rubyfy.rb
@@ -22,24 +22,25 @@ class Rubyfy
@conf["verbose"] = true if @conf["debug"]
# Read first config found
- ["#{ENV["HOME"]}/.rubyfy.json", "rubyfy.json"].each do |config_path|
- if File.exists?(config_path)
- log(:VERBOSE, "Reading #{config_path}")
- config_json = JSON.parse(File.read(config_path))
- log(:VERBOSE, config_json)
- config_json.each do |opt, arg|
+ ["#{ENV["HOME"]}/.rubyfy.json", "rubyfy.json"].each do |conf_path|
+ if File.exists?(conf_path)
+ log(:VERBOSE, "Reading #{conf_path}")
+ conf_json = JSON.parse(File.read(conf_path))
+ log(:VERBOSE, conf_json)
+ conf_json.each do |opt, arg|
@conf[opt] = arg unless @conf[arg]
end
break
end
end
+ # Needed a 2nd time (as we read the config file)
+ @conf["verbose"] = true if @conf["debug"]
+
# Set defaults of values if not set
@conf["parallel"] = 1 unless @conf["parallel"]
@conf["user"] = ENV["USER"] unless @conf["user"]
@conf["outdir"] = "./results" unless @conf["outdir"]
- # Needed a 2nd time (as we read the config file)
- @conf["verbose"] = true if @conf["debug"]
log(:DEBUG, @conf)
end