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 CHANGED
@@ -6,3 +6,5 @@ pkg
6
6
  test/test.sqlite3
7
7
  data_miner.log
8
8
  Gemfile.lock
9
+ *.gem
10
+ test.log
@@ -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# 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
@@ -38,7 +38,7 @@ class DataMiner
38
38
  end
39
39
 
40
40
  def inspect
41
- %{#<DataMiner::Import(#{resource}) (#{description})>}
41
+ %{#<DataMiner::Import(#{resource}) #{description}>}
42
42
  end
43
43
 
44
44
  def store(attr_name, attr_options = {})
@@ -20,14 +20,7 @@ class DataMiner
20
20
  end
21
21
 
22
22
  def inspect
23
- str = %{<#Process(#{resource})}
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
@@ -15,7 +15,7 @@ class DataMiner
15
15
  end
16
16
 
17
17
  def inspect
18
- %{#<DataMiner::Verify(#{resource}) (#{description})>}
18
+ %{#<DataMiner::Verify(#{resource}) #{description}>}
19
19
  end
20
20
 
21
21
  def run
@@ -1,3 +1,3 @@
1
1
  class DataMiner
2
- VERSION = '1.1.4'
2
+ VERSION = '1.1.5'
3
3
  end
data/lib/data_miner.rb CHANGED
@@ -85,7 +85,7 @@ Output:
85
85
  self.logger = ::Rails.logger
86
86
  else
87
87
  require 'logger'
88
- self.logger = ::Logger.new $stdout
88
+ self.logger = ::Logger.new $stderr
89
89
  end
90
90
  end
91
91
  ::ActiveRecord::Base.logger = logger
@@ -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 /block/, process.inspect
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 /method/, process.inspect
15
+ assert_match /something_cool/, process.inspect
16
16
  end
17
17
  end
18
18
  end
@@ -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: 27
5
- prerelease: false
4
+ hash: 25
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 4
10
- version: 1.1.4
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-02-01 00:00:00 -06:00
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.3.7
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.