data_miner 0.4.20 → 0.4.21

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 CHANGED
@@ -1 +1 @@
1
- 0.4.20
1
+ 0.4.21
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.20"
8
+ s.version = "0.4.21"
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.rb CHANGED
@@ -70,6 +70,22 @@ module DataMiner
70
70
  end
71
71
 
72
72
  ActiveRecord::Base.class_eval do
73
+ # convenience
74
+ %w{
75
+ create_table
76
+ execute
77
+ add_column
78
+ rename_column
79
+ remove_column
80
+ drop_table
81
+ }.each do |method_name|
82
+ eval %{
83
+ def self.#{method_name}(*args, &block)
84
+ ActiveRecord::Base.connection.send(:#{method_name}, *args, &block)
85
+ end
86
+ }
87
+ end
88
+
73
89
  def self.x_data_miner(&block)
74
90
  DataMiner.start_logging
75
91
 
@@ -51,7 +51,10 @@ module DataMiner
51
51
  end
52
52
  resource.delete_all if options[:from_scratch]
53
53
  begin
54
- steps.each { |step| step.run run }
54
+ steps.each do |step|
55
+ step.run run
56
+ resource.reset_column_information
57
+ end
55
58
  finished = true
56
59
  ensure
57
60
  run.update_attributes! :ended_at => Time.now, :finished => finished if DataMiner::Run.table_exists?
@@ -496,13 +496,12 @@ class CrosscallingCensusRegion < ActiveRecord::Base
496
496
  data_miner do
497
497
  process "derive ourselves from the census divisions table (i.e., cross call census divisions)" do
498
498
  CrosscallingCensusDivision.run_data_miner!
499
- connection.drop_table :crosscalling_census_regions rescue nil
500
- connection.create_table :crosscalling_census_regions, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
499
+ create_table :crosscalling_census_regions, :options => 'ENGINE=InnoDB default charset=utf8', :id => false, :force => true do |t|
501
500
  t.column :number, :integer
502
501
  t.column :name, :string
503
502
  end
504
- connection.execute 'ALTER TABLE crosscalling_census_regions ADD PRIMARY KEY (number);'
505
- connection.execute %{
503
+ execute 'ALTER TABLE crosscalling_census_regions ADD PRIMARY KEY (number);'
504
+ execute %{
506
505
  INSERT IGNORE INTO crosscalling_census_regions(number, name)
507
506
  SELECT crosscalling_census_divisions.census_region_number, crosscalling_census_divisions.census_region_name FROM crosscalling_census_divisions
508
507
  }
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 20
9
- version: 0.4.20
8
+ - 21
9
+ version: 0.4.21
10
10
  platform: ruby
11
11
  authors:
12
12
  - Seamus Abshere