data_miner 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -9,6 +9,8 @@ Rake::TestTask.new(:test) do |test|
9
9
  test.verbose = true
10
10
  end
11
11
 
12
+ task :default => :test
13
+
12
14
  begin
13
15
  require 'rake/rdoctask'
14
16
  Rake::RDocTask.new do |rdoc|
@@ -1,8 +1,6 @@
1
1
  class DataMiner
2
2
  class Verify
3
- attr_reader :config
4
- attr_reader :description
5
- attr_reader :blk
3
+ attr_accessor :config, :description, :blk
6
4
 
7
5
  def initialize(config, description, &blk)
8
6
  @config = config
@@ -19,7 +17,12 @@ class DataMiner
19
17
  end
20
18
 
21
19
  def run
22
- unless blk.call
20
+ successful = begin
21
+ blk.call
22
+ rescue => e
23
+ false
24
+ end
25
+ unless successful
23
26
  raise VerificationFailed, "FAILED VERIFICATION: #{inspect}"
24
27
  end
25
28
  nil
@@ -1,3 +1,3 @@
1
1
  class DataMiner
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
data/lib/data_miner.rb CHANGED
@@ -65,13 +65,14 @@ Output:
65
65
 
66
66
  def start_logging
67
67
  if logger.nil?
68
- if defined? ::Rails
69
- @logger = ::Rails.logger
68
+ if defined? Rails
69
+ self.logger = Rails.logger
70
70
  else
71
- @logger = ::Logger.new $stdout
71
+ require 'logger'
72
+ self.logger = Logger.new $stdout
72
73
  end
73
74
  end
74
- ::ActiveRecord::Base.logger = logger
75
+ ActiveRecord::Base.logger = logger
75
76
  end
76
77
 
77
78
  # Mine data. Defaults to all resource_names touched by DataMiner.
@@ -874,7 +874,8 @@ class TestOldSyntax < Test::Unit::TestCase
874
874
  end
875
875
 
876
876
  DataMiner::Run.delete_all
877
- AutomobileFuelType.run_data_miner! :from_scratch => true
878
- assert DataMiner::Run.first.skipped
877
+ assert_raise do
878
+ AutomobileFuelType.run_data_miner! :from_scratch => true
879
+ end
879
880
  end
880
881
  end
data/test/test_verify.rb CHANGED
@@ -1,29 +1,29 @@
1
- require 'helper'
1
+ require File.expand_path('helper', File.dirname(__FILE__))
2
2
 
3
3
  class TestVerify < Test::Unit::TestCase
4
4
  context '#run' do
5
5
  setup do
6
6
  @run = Object.new
7
7
  check = lambda do
8
- assert true
8
+ true
9
9
  end
10
- @verify = DataMiner::Verify.new Aircraft.new.data_miner_base, 1,
11
- 'verification of engine type', check
10
+ @verify = DataMiner::Verify.new Aircraft.new.data_miner_config,
11
+ 'verification of engine type', &check
12
12
  end
13
13
  should 'raise an exception if the verification block fails through exception' do
14
- @verify.check = lambda do
14
+ @verify.blk = lambda do
15
15
  assert false
16
16
  end
17
- assert_raise(DataMiner::VerificationFailed) { @verify.run @run }
17
+ assert_raise(DataMiner::VerificationFailed) { @verify.run }
18
18
  end
19
19
  should 'raise an exception if the result of the verification block is false' do
20
- @verify.check = lambda do
20
+ @verify.blk = lambda do
21
21
  false
22
22
  end
23
- assert_raise(DataMiner::VerificationFailed) { @verify.run @run }
23
+ assert_raise(DataMiner::VerificationFailed) { @verify.run }
24
24
  end
25
25
  should 'return true if the verification block succeeds' do
26
- assert @verify.run(@run)
26
+ assert_nil @verify.run
27
27
  end
28
28
  end
29
29
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_miner
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 1
9
- - 0
10
- version: 1.1.0
8
+ - 1
9
+ version: 1.1.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Seamus Abshere
@@ -17,7 +16,7 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2011-01-26 00:00:00 -06:00
19
+ date: 2011-01-27 00:00:00 -05:00
21
20
  default_executable:
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency
@@ -28,7 +27,6 @@ dependencies:
28
27
  requirements:
29
28
  - - ">="
30
29
  - !ruby/object:Gem::Version
31
- hash: 19
32
30
  segments:
33
31
  - 1
34
32
  - 1
@@ -44,7 +42,6 @@ dependencies:
44
42
  requirements:
45
43
  - - ">="
46
44
  - !ruby/object:Gem::Version
47
- hash: 23
48
45
  segments:
49
46
  - 0
50
47
  - 0
@@ -60,7 +57,6 @@ dependencies:
60
57
  requirements:
61
58
  - - ">="
62
59
  - !ruby/object:Gem::Version
63
- hash: 11
64
60
  segments:
65
61
  - 2
66
62
  - 3
@@ -76,7 +72,6 @@ dependencies:
76
72
  requirements:
77
73
  - - ">="
78
74
  - !ruby/object:Gem::Version
79
- hash: 11
80
75
  segments:
81
76
  - 2
82
77
  - 3
@@ -92,7 +87,6 @@ dependencies:
92
87
  requirements:
93
88
  - - ">="
94
89
  - !ruby/object:Gem::Version
95
- hash: 15
96
90
  segments:
97
91
  - 1
98
92
  - 4
@@ -108,7 +102,6 @@ dependencies:
108
102
  requirements:
109
103
  - - ">="
110
104
  - !ruby/object:Gem::Version
111
- hash: 23
112
105
  segments:
113
106
  - 0
114
107
  - 3
@@ -124,7 +117,6 @@ dependencies:
124
117
  requirements:
125
118
  - - ">="
126
119
  - !ruby/object:Gem::Version
127
- hash: 5
128
120
  segments:
129
121
  - 0
130
122
  - 3
@@ -140,7 +132,6 @@ dependencies:
140
132
  requirements:
141
133
  - - ">="
142
134
  - !ruby/object:Gem::Version
143
- hash: 21
144
135
  segments:
145
136
  - 0
146
137
  - 0
@@ -156,7 +147,6 @@ dependencies:
156
147
  requirements:
157
148
  - - ">="
158
149
  - !ruby/object:Gem::Version
159
- hash: 21
160
150
  segments:
161
151
  - 1
162
152
  - 0
@@ -172,7 +162,6 @@ dependencies:
172
162
  requirements:
173
163
  - - ">="
174
164
  - !ruby/object:Gem::Version
175
- hash: 3
176
165
  segments:
177
166
  - 0
178
167
  version: "0"
@@ -186,7 +175,6 @@ dependencies:
186
175
  requirements:
187
176
  - - ">="
188
177
  - !ruby/object:Gem::Version
189
- hash: 3
190
178
  segments:
191
179
  - 0
192
180
  version: "0"
@@ -200,21 +188,19 @@ dependencies:
200
188
  requirements:
201
189
  - - ">="
202
190
  - !ruby/object:Gem::Version
203
- hash: 3
204
191
  segments:
205
192
  - 0
206
193
  version: "0"
207
194
  type: :development
208
195
  version_requirements: *id012
209
196
  - !ruby/object:Gem::Dependency
210
- name: ruby-debug
197
+ name: ruby-debug19
211
198
  prerelease: false
212
199
  requirement: &id013 !ruby/object:Gem::Requirement
213
200
  none: false
214
201
  requirements:
215
202
  - - ">="
216
203
  - !ruby/object:Gem::Version
217
- hash: 3
218
204
  segments:
219
205
  - 0
220
206
  version: "0"
@@ -273,7 +259,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
273
259
  requirements:
274
260
  - - ">="
275
261
  - !ruby/object:Gem::Version
276
- hash: 3
277
262
  segments:
278
263
  - 0
279
264
  version: "0"
@@ -282,7 +267,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
267
  requirements:
283
268
  - - ">="
284
269
  - !ruby/object:Gem::Version
285
- hash: 3
286
270
  segments:
287
271
  - 0
288
272
  version: "0"
@@ -293,13 +277,5 @@ rubygems_version: 1.3.7
293
277
  signing_key:
294
278
  specification_version: 3
295
279
  summary: Mine remote data into your ActiveRecord models.
296
- test_files:
297
- - test/helper.rb
298
- - test/support/aircraft.rb
299
- - test/support/airport.rb
300
- - test/support/automobile_fuel_type.rb
301
- - test/support/automobile_variant.rb
302
- - test/support/country.rb
303
- - test/test_attribute.rb
304
- - test/test_old_syntax.rb
305
- - test/test_verify.rb
280
+ test_files: []
281
+