diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-11-19 00:13:28 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-11-19 00:13:28 +0000 |
commit | d2c175aaafa9a06c377de5df609759073d93e894 (patch) | |
tree | 8e0767b88a3272560ee9b6f4bb7bd38783053417 | |
parent | 01f65edf9594fdd811c5671a429b98ffff6f6523 (diff) | |
download | mogilefs-client-d2c175aaafa9a06c377de5df609759073d93e894.tar.gz |
noclobber is false by default
-rwxr-xr-x | bin/mog | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 |