data_miner 1.2.5 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/data_miner/config.rb +0 -5
- data/lib/data_miner/version.rb +1 -1
- data/lib/data_miner.rb +0 -1
- data/test/support/aircraft.rb +0 -4
- data/test/test_old_syntax.rb +0 -12
- metadata +29 -32
- data/lib/data_miner/verify.rb +0 -28
- data/test/test_data_miner_verify.rb +0 -21
data/lib/data_miner/config.rb
CHANGED
@@ -42,11 +42,6 @@ class DataMiner
|
|
42
42
|
steps.push step
|
43
43
|
end
|
44
44
|
|
45
|
-
def verify(description = '(no description)', &blk)
|
46
|
-
step = Verify.new self, description, &blk
|
47
|
-
steps.push step
|
48
|
-
end
|
49
|
-
|
50
45
|
# Mine data for this class.
|
51
46
|
def run(options = {})
|
52
47
|
options = options.dup
|
data/lib/data_miner/version.rb
CHANGED
data/lib/data_miner.rb
CHANGED
data/test/support/aircraft.rb
CHANGED
@@ -96,10 +96,6 @@ class Aircraft < ActiveRecord::Base
|
|
96
96
|
key 'bts_aircraft_type_code', :field_name => 'bts_aircraft_type'
|
97
97
|
store 'brighter_planet_aircraft_class_code', :nullify => true
|
98
98
|
end
|
99
|
-
|
100
|
-
verify 'all aircraft have a manufcaturer name specified' do
|
101
|
-
assert Aircraft.scoped.where(:manufacturer_name => nil).empty?
|
102
|
-
end
|
103
99
|
end
|
104
100
|
end
|
105
101
|
end
|
data/test/test_old_syntax.rb
CHANGED
@@ -900,16 +900,4 @@ class TestOldSyntax < Test::Unit::TestCase
|
|
900
900
|
assert ResidentialEnergyConsumptionSurveyResponse.find(6).residence_class.start_with?('Single-family detached house')
|
901
901
|
end
|
902
902
|
end
|
903
|
-
should "mark the run as skipped if verification fails" do
|
904
|
-
AutomobileFuelType.data_miner_config.instance_eval do
|
905
|
-
verify "failure" do
|
906
|
-
false
|
907
|
-
end
|
908
|
-
end
|
909
|
-
|
910
|
-
DataMiner::Run.delete_all
|
911
|
-
assert_raise do
|
912
|
-
AutomobileFuelType.run_data_miner! :from_scratch => true
|
913
|
-
end
|
914
|
-
end
|
915
903
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_miner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -15,7 +15,7 @@ date: 2011-09-22 00:00:00.000000000Z
|
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: remote_table
|
18
|
-
requirement: &
|
18
|
+
requirement: &2166686740 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 1.2.2
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *2166686740
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: escape
|
29
|
-
requirement: &
|
29
|
+
requirement: &2166719520 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: 0.0.4
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *2166719520
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: activerecord
|
40
|
-
requirement: &
|
40
|
+
requirement: &2166719060 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: 2.3.4
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *2166719060
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: activesupport
|
51
|
-
requirement: &
|
51
|
+
requirement: &2166718600 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: 2.3.4
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *2166718600
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: conversions
|
62
|
-
requirement: &
|
62
|
+
requirement: &2166718140 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ! '>='
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: 1.4.4
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *2166718140
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: blockenspiel
|
73
|
-
requirement: &
|
73
|
+
requirement: &2166717680 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: 0.3.2
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *2166717680
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: taps
|
84
|
-
requirement: &
|
84
|
+
requirement: &2166717220 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ! '>='
|
@@ -89,10 +89,10 @@ dependencies:
|
|
89
89
|
version: 0.3.11
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *2166717220
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: errata
|
95
|
-
requirement: &
|
95
|
+
requirement: &2166716760 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ! '>='
|
@@ -100,10 +100,10 @@ dependencies:
|
|
100
100
|
version: 1.0.1
|
101
101
|
type: :runtime
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *2166716760
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: force_schema
|
106
|
-
requirement: &
|
106
|
+
requirement: &2166716300 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
109
|
- - ! '>='
|
@@ -111,10 +111,10 @@ dependencies:
|
|
111
111
|
version: 0.0.2
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
|
-
version_requirements: *
|
114
|
+
version_requirements: *2166716300
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
116
|
name: loose_tight_dictionary
|
117
|
-
requirement: &
|
117
|
+
requirement: &2166715840 !ruby/object:Gem::Requirement
|
118
118
|
none: false
|
119
119
|
requirements:
|
120
120
|
- - ! '>='
|
@@ -122,10 +122,10 @@ dependencies:
|
|
122
122
|
version: 0.0.5
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
|
-
version_requirements: *
|
125
|
+
version_requirements: *2166715840
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: test-unit
|
128
|
-
requirement: &
|
128
|
+
requirement: &2166715460 !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
131
131
|
- - ! '>='
|
@@ -133,10 +133,10 @@ dependencies:
|
|
133
133
|
version: '0'
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
|
-
version_requirements: *
|
136
|
+
version_requirements: *2166715460
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: shoulda
|
139
|
-
requirement: &
|
139
|
+
requirement: &2166715000 !ruby/object:Gem::Requirement
|
140
140
|
none: false
|
141
141
|
requirements:
|
142
142
|
- - ! '>='
|
@@ -144,10 +144,10 @@ dependencies:
|
|
144
144
|
version: '0'
|
145
145
|
type: :development
|
146
146
|
prerelease: false
|
147
|
-
version_requirements: *
|
147
|
+
version_requirements: *2166715000
|
148
148
|
- !ruby/object:Gem::Dependency
|
149
149
|
name: mysql
|
150
|
-
requirement: &
|
150
|
+
requirement: &2166714580 !ruby/object:Gem::Requirement
|
151
151
|
none: false
|
152
152
|
requirements:
|
153
153
|
- - ! '>='
|
@@ -155,10 +155,10 @@ dependencies:
|
|
155
155
|
version: '0'
|
156
156
|
type: :development
|
157
157
|
prerelease: false
|
158
|
-
version_requirements: *
|
158
|
+
version_requirements: *2166714580
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: rake
|
161
|
-
requirement: &
|
161
|
+
requirement: &2166714160 !ruby/object:Gem::Requirement
|
162
162
|
none: false
|
163
163
|
requirements:
|
164
164
|
- - ! '>='
|
@@ -166,7 +166,7 @@ dependencies:
|
|
166
166
|
version: '0'
|
167
167
|
type: :development
|
168
168
|
prerelease: false
|
169
|
-
version_requirements: *
|
169
|
+
version_requirements: *2166714160
|
170
170
|
description: Mine remote data into your ActiveRecord models. You can also convert
|
171
171
|
units.
|
172
172
|
email:
|
@@ -192,7 +192,6 @@ files:
|
|
192
192
|
- lib/data_miner/process.rb
|
193
193
|
- lib/data_miner/run.rb
|
194
194
|
- lib/data_miner/tap.rb
|
195
|
-
- lib/data_miner/verify.rb
|
196
195
|
- lib/data_miner/version.rb
|
197
196
|
- test/helper.rb
|
198
197
|
- test/support/aircraft.rb
|
@@ -203,7 +202,6 @@ files:
|
|
203
202
|
- test/support/test_database.rb
|
204
203
|
- test/test_data_miner_attribute.rb
|
205
204
|
- test/test_data_miner_process.rb
|
206
|
-
- test/test_data_miner_verify.rb
|
207
205
|
- test/test_old_syntax.rb
|
208
206
|
homepage: https://github.com/seamusabshere/data_miner
|
209
207
|
licenses: []
|
@@ -239,5 +237,4 @@ test_files:
|
|
239
237
|
- test/support/test_database.rb
|
240
238
|
- test/test_data_miner_attribute.rb
|
241
239
|
- test/test_data_miner_process.rb
|
242
|
-
- test/test_data_miner_verify.rb
|
243
240
|
- test/test_old_syntax.rb
|
data/lib/data_miner/verify.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
class DataMiner
|
2
|
-
class Verify
|
3
|
-
attr_reader :config
|
4
|
-
attr_reader :description
|
5
|
-
attr_reader :blk
|
6
|
-
|
7
|
-
def initialize(config, description, &blk)
|
8
|
-
@config = config
|
9
|
-
@description = description
|
10
|
-
@blk = blk
|
11
|
-
end
|
12
|
-
|
13
|
-
def resource
|
14
|
-
config.resource
|
15
|
-
end
|
16
|
-
|
17
|
-
def inspect
|
18
|
-
%{#<DataMiner::Verify(#{resource}) #{description}>}
|
19
|
-
end
|
20
|
-
|
21
|
-
def run
|
22
|
-
unless blk.call
|
23
|
-
raise "FAILED VERIFICATION: #{inspect}"
|
24
|
-
end
|
25
|
-
nil
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require File.expand_path('helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
class TestDataMinerVerify < Test::Unit::TestCase
|
4
|
-
context '#run' do
|
5
|
-
should 'raise an exception if the verification block fails through exception' do
|
6
|
-
raising_check = lambda { raise "boom" }
|
7
|
-
verify = DataMiner::Verify.new Aircraft.data_miner_config, 'verification of engine type', &raising_check
|
8
|
-
assert_raise(::RuntimeError) { verify.run }
|
9
|
-
end
|
10
|
-
should 'raise an exception if the result of the verification block is false' do
|
11
|
-
failing_check = lambda { false }
|
12
|
-
verify = DataMiner::Verify.new Aircraft.data_miner_config, 'verification of engine type', &failing_check
|
13
|
-
assert_raise(::RuntimeError) { verify.run }
|
14
|
-
end
|
15
|
-
should 'return true if the verification block succeeds' do
|
16
|
-
passing_check = lambda { true }
|
17
|
-
verify = DataMiner::Verify.new Aircraft.data_miner_config, 'verification of engine type', &passing_check
|
18
|
-
assert_nil verify.run
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|