data_miner 0.4.45 → 0.5.0

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/lib/data_miner.rb CHANGED
@@ -122,6 +122,10 @@ ActiveRecord::Base.class_eval do
122
122
  def self.run_data_miner!(options = {})
123
123
  data_miner_base.run options
124
124
  end
125
+ def self.execute_schema
126
+ schema = data_miner_base.steps.find { |s| s.instance_of?(DataMiner::Schema) }
127
+ schema.run(nil) if schema
128
+ end
125
129
  end
126
130
  self.data_miner_base = DataMiner::Base.new self
127
131
 
@@ -1167,6 +1167,16 @@ end
1167
1167
  # todo: have somebody properly organize these
1168
1168
  class DataMinerTest < Test::Unit::TestCase
1169
1169
  if ENV['ALL'] == 'true' or ENV['NEW'] == 'true'
1170
+ should 'directly create a table for the model' do
1171
+ if AutomobileMakeFleetYear.table_exists?
1172
+ ActiveRecord::Base.connection.execute 'DROP TABLE automobile_make_fleet_years;'
1173
+ end
1174
+ AutomobileMakeFleetYear.execute_schema
1175
+ assert AutomobileMakeFleetYear.table_exists?
1176
+ end
1177
+ end
1178
+
1179
+ if ENV['ALL'] == 'true' or ENV['FAST'] == 'true'
1170
1180
  should 'override an existing data_miner configuration' do
1171
1181
  AutomobileFuelType.class_eval do
1172
1182
  data_miner do
@@ -1180,9 +1190,6 @@ class DataMinerTest < Test::Unit::TestCase
1180
1190
  assert_equal 'http://example.com', AutomobileFuelType.data_miner_base.steps.first.table.package.url
1181
1191
  assert_equal 1, AutomobileFuelType.data_miner_base.step_counter
1182
1192
  end
1183
- end
1184
-
1185
- if ENV['ALL'] == 'true' or ENV['FAST'] == 'true'
1186
1193
  should "stop and finish if it gets a DataMiner::Finish" do
1187
1194
  AutomobileMakeFleetYear.delete_all
1188
1195
  AutomobileMakeFleetYear.data_miner_runs.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: 85
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 45
10
- version: 0.4.45
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
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: 2010-07-15 00:00:00 -04:00
20
+ date: 2010-07-16 00:00:00 -04:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency