Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more careful checking, updated test, command-line option

  • Loading branch information...
commit 1905bf0b341c5f0619b6afc6c8206088534a3566 1 parent c06aba7
@jmay authored
View
4 lib/assimilate/command.rb
@@ -31,6 +31,10 @@ def initialize
opts.on("--domain STRING", String, "Domain value to apply to each record") do |s|
@options[:domain] = s
end
+
+ opts.on("--compare FIELDNAME", String, "(*extend* only) Optional field to check whether an update is current (e.g. timestamp)") do |f|
+ @options[:compare] = f
+ end
end
end
View
2  lib/assimilate/extender.rb
@@ -37,7 +37,7 @@ def is_newer(current_data, new_data)
# if there is a field to compare on (i.e. a timestamp), then apply the update if the timestamp is newer;
# otherwise (no timestamp) compare the hashes and apply if there are any differences.
def apply_this_update(current_record, new_data)
- if @comparison_field
+ if @comparison_field && current_record[@keyfield]
is_newer(current_record[@keyfield], new_data)
else
current_record[@keyfield] != new_data
View
2  lib/assimilate/version.rb
@@ -1,3 +1,3 @@
module Assimilate
- VERSION = "0.2"
+ VERSION = "0.2.1"
end
View
2  spec/lib/extend_spec.rb
@@ -74,7 +74,7 @@ def import_extended_data(datestamp, filename, opts = {})
before(:all) do
reset_catalog
import_base_data("20120501")
- import_extended_data("20120505", "logs1.csv")
+ import_extended_data("20120505", "logs1.csv", :compare => 'timestamp')
end
Please sign in to comment.
Something went wrong with that request. Please try again.