bin/gitdis in gitdis-0.1.1.1 vs bin/gitdis in gitdis-0.1.2.1

- old
+ new

@@ -14,10 +14,11 @@ o.integer '-d', '--redis-db', 'number' o.separator ' Git repo overrides' o.string '-r', '--git-repo', 'path/to/repo_dir' o.string '-b', '--git-branch', 'e.g. master' o.separator ' Other options' + o.bool '--dry-run', 'Perform comparisons but do not write to Redis' o.bool '-D', '--dump', 'Just dump Redis contents per YAML keymap' o.on '-h', '--help' do puts o exit end @@ -69,23 +70,26 @@ # process keymap if opts.dump? GitDis.dump(keymap.keys, redis_options) else gd = GitDis.new(config.fetch('git-repo'), redis_options) + gd.dry_run = true if opts[:'dry-run'] gd.git_pull config.fetch('git-branch') keymap.each { |key, fileglob| result = gd.update(key, fileglob) case result when nil puts "#{fileglob} not found" when false puts "#{fileglob} unchanged" + when true + puts "#{fileglob} changed but not updated (DRY RUN)" + when Array + ver, md5 = *result + puts "#{fileglob} updated:" + puts "\tVersion: #{ver} (#{md5})" else - unless opts.dry_run? - ver, md5 = *result - puts "#{fileglob} updated:" - puts "\tVersion: #{ver} (#{md5})" - end + raise "unknown update result: #{result.inspect}" end } end