data_miner 0.4.12 → 0.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/data_miner.gemspec +1 -1
- data/lib/data_miner/import.rb +11 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.13
|
data/data_miner.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{data_miner}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.13"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Seamus Abshere", "Andy Rossmeissl"]
|
data/lib/data_miner/import.rb
CHANGED
@@ -43,13 +43,23 @@ module DataMiner
|
|
43
43
|
|
44
44
|
increment_counter = resource.column_names.include?('data_miner_touch_count')
|
45
45
|
log_run = resource.column_names.include?('data_miner_last_run_id')
|
46
|
-
|
46
|
+
test_counter = 0
|
47
|
+
|
47
48
|
table.each_row do |row|
|
48
49
|
if errata
|
49
50
|
next if errata.rejects?(row)
|
50
51
|
errata.correct!(row)
|
51
52
|
end
|
52
53
|
|
54
|
+
if ENV['DUMP'] == 'true'
|
55
|
+
raise "[data_miner gem] Stopping after 5 rows because TEST=true" if test_counter > 5
|
56
|
+
test_counter += 1
|
57
|
+
DataMiner.log_info %{Row #{test_counter}
|
58
|
+
IN: #{row.inspect}
|
59
|
+
OUT: #{attributes.inject(Hash.new) { |memo, v| attr_name, attr = v; memo[attr_name] = attr.value_from_row(row); memo }.inspect}
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
53
63
|
record = resource.send "find_or_initialize_by_#{@key}", attributes[@key].value_from_row(row)
|
54
64
|
changes = attributes.map { |_, attr| attr.set_record_from_row record, row }
|
55
65
|
if changes.any?
|