about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-11-19 00:13:28 +0000
committerEric Wong <normalperson@yhbt.net>2011-11-19 00:13:28 +0000
commitd2c175aaafa9a06c377de5df609759073d93e894 (patch)
tree8e0767b88a3272560ee9b6f4bb7bd38783053417
parent01f65edf9594fdd811c5671a429b98ffff6f6523 (diff)
downloadmogilefs-client-d2c175aaafa9a06c377de5df609759073d93e894.tar.gz
noclobber is false by default
-rwxr-xr-xbin/mog12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/mog b/bin/mog
index f46e0e7..c312790 100755
--- a/bin/mog
+++ b/bin/mog
@@ -12,13 +12,15 @@ trap('PIPE') { exit 0 }
 def parse_config_file!(path, overwrite = false)
   dest = {}
   File.open(path).each_line do |line|
-    line.strip!
-    if /^(domain|class)\s*=\s*(\S+)/.match(line)
+    case line
+    when /^(domain|class)\s*=\s*(\S+)/
       dest[$1.to_sym] = $2
-    elsif m = /^(?:trackers|hosts)\s*=\s*(.*)/.match(line)
+    when /^(?:trackers|hosts)\s*=\s*(.*)/
       dest[:hosts] = $1.split(/\s*,\s*/)
-    elsif m = /^timeout\s*=\s*(.*)/.match(line)
-      dest[:timeout] = m[1].to_f
+    when /^timeout\s*=\s*(.*)/
+      dest[:timeout] = $1.to_f
+    when /^noclobber\s*=\s*true\s*/
+      dest[:noclobber] = true
     else
       warn "Ignored configuration line: #{line}" unless /^#/.match(line)
     end