bin/update_onebody in onebody-updateagent-0.4.1 vs bin/update_onebody in onebody-updateagent-0.4.2
- old
+ new
@@ -1,10 +1,12 @@
#!/usr/bin/env ruby
require 'optparse'
require 'yaml'
+UPDATEAGENT_VERSION = File.read(File.dirname(__FILE__) + '/../VERSION').strip
+
options = {:confirm => true, :force => false}
config = nil
opt_parser = OptionParser.new do |opts|
opts.banner = "Usage: update_onebody -c path/to/config.yml [options] path/to/people.csv"
opts.on("-y", "--no-confirm", "Assume 'yes' to any questions") do |v|
@@ -30,12 +32,18 @@
end
end
opts.on("-g", "--groups", "Sync groups.csv rather than people.csv") do |g|
options[:sync_groups] = true
end
- opts.on("-d", "--delete", "Delete people and families not found in source file") do |d|
- options[:delete] = true
+ # doesn't work yet
+ #opts.on("-d", "--delete", "Delete people and families not found in source file") do |d|
+ # options[:delete] = true
+ #end
+ opts.on("--version", "Show version and exit.") do
+ puts "OneBody UpdateAgent version #{UPDATEAGENT_VERSION}"
+ puts
+ exit
end
end
opt_parser.parse!
unless options[:config_file]
@@ -76,10 +84,10 @@
else
puts "comparing records..."
agent.compare(options[:force])
if agent.has_work?
if options[:confirm]
- case ask("#{agent.create.length} record(s) to create and #{agent.update.length} record(s) to update. Continue? (Yes, No, Review) ") { |q| q.in = %w(yes no review y n r) }
+ case ask("#{agent.create_count} record(s) to create and #{agent.update_count} record(s) to update. Continue? (Yes, No, Review) ") { |q| q.in = %w(yes no review y n r) }
when 'review', 'r'
agent.present
unless agent.confirm
puts "Canceled by user\n"
exit