data_miner 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/lib/data_miner/config.rb +3 -1
- data/lib/data_miner/import.rb +1 -1
- data/lib/data_miner/process.rb +1 -8
- data/lib/data_miner/verify.rb +1 -1
- data/lib/data_miner/version.rb +1 -1
- data/lib/data_miner.rb +1 -1
- data/test/support/country.rb +1 -1
- data/test/test_data_miner_process.rb +2 -2
- data/test/test_old_syntax.rb +0 -1
- metadata +6 -6
data/.gitignore
CHANGED
data/lib/data_miner/config.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'blockenspiel'
|
2
|
+
require 'benchmark'
|
2
3
|
|
3
4
|
class DataMiner
|
4
5
|
class Config
|
@@ -71,8 +72,9 @@ class DataMiner
|
|
71
72
|
resource.delete_all if options['from_scratch']
|
72
73
|
begin
|
73
74
|
steps.each do |step|
|
74
|
-
step.run
|
75
|
+
time = ::Benchmark.realtime { step.run }
|
75
76
|
resource.reset_column_information
|
77
|
+
::DataMiner.logger.info %{Ran #{step.inspect} in #{time.to_i}}
|
76
78
|
end
|
77
79
|
finished = true
|
78
80
|
rescue Finish
|
data/lib/data_miner/import.rb
CHANGED
data/lib/data_miner/process.rb
CHANGED
@@ -20,14 +20,7 @@ class DataMiner
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def inspect
|
23
|
-
|
24
|
-
if block_description
|
25
|
-
str << %{ called block "#{block_description}"}
|
26
|
-
else
|
27
|
-
str << %{ called method :#{method_id}}
|
28
|
-
end
|
29
|
-
str << ">"
|
30
|
-
str
|
23
|
+
%{#<DataMiner::Process(#{resource}) #{block_description || method_id}>}
|
31
24
|
end
|
32
25
|
|
33
26
|
def run
|
data/lib/data_miner/verify.rb
CHANGED
data/lib/data_miner/version.rb
CHANGED
data/lib/data_miner.rb
CHANGED
data/test/support/country.rb
CHANGED
@@ -2,7 +2,7 @@ class Country < ActiveRecord::Base
|
|
2
2
|
set_primary_key :iso_3166
|
3
3
|
|
4
4
|
data_miner do
|
5
|
-
import 'The official ISO country list', :url => 'http://www.iso.org/iso/list-en1-semic-3.txt', :skip => 2, :headers => false, :delimiter => ';' do
|
5
|
+
import 'The official ISO country list', :url => 'http://www.iso.org/iso/list-en1-semic-3.txt', :encoding => 'ISO-8859-1', :skip => 2, :headers => false, :delimiter => ';' do
|
6
6
|
key 'iso_3166', :field_number => 1
|
7
7
|
store 'name', :field_number => 0
|
8
8
|
end
|
@@ -8,11 +8,11 @@ class TestDataMinerProcess < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
should 'describe a block' do
|
10
10
|
process = DataMiner::Process.new(@config, 'something cool') { }
|
11
|
-
assert_match /
|
11
|
+
assert_match /something cool/, process.inspect
|
12
12
|
end
|
13
13
|
should 'describe a method' do
|
14
14
|
process = DataMiner::Process.new @config, :something_cool
|
15
|
-
assert_match /
|
15
|
+
assert_match /something_cool/, process.inspect
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/test/test_old_syntax.rb
CHANGED
@@ -665,7 +665,6 @@ class TestOldSyntax < Test::Unit::TestCase
|
|
665
665
|
end
|
666
666
|
assert_kind_of DataMiner::Import, AutomobileFuelType.data_miner_config.steps.first
|
667
667
|
assert_equal 'http://example.com', AutomobileFuelType.data_miner_config.steps.first.table.url
|
668
|
-
assert_equal 1, AutomobileFuelType.data_miner_config.step_counter
|
669
668
|
end
|
670
669
|
should "stop and finish if it gets a DataMiner::Finish" do
|
671
670
|
AutomobileMakeFleetYear.delete_all
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_miner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 25
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 5
|
10
|
+
version: 1.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Seamus Abshere
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-
|
20
|
+
date: 2011-03-22 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
291
|
requirements: []
|
292
292
|
|
293
293
|
rubyforge_project: data_miner
|
294
|
-
rubygems_version: 1.
|
294
|
+
rubygems_version: 1.6.2
|
295
295
|
signing_key:
|
296
296
|
specification_version: 3
|
297
297
|
summary: Mine remote data into your ActiveRecord models.
|