data_miner-ruby19 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,307 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+ require 'ruby-debug'
5
+
6
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
8
+ require 'data_miner'
9
+
10
+ ActiveRecord::Base.establish_connection(
11
+ 'adapter' => 'mysql',
12
+ 'database' => 'data_miner_test',
13
+ 'username' => 'root',
14
+ 'password' => 'password'
15
+ )
16
+
17
+ ActiveSupport::Inflector.inflections do |inflect|
18
+ inflect.uncountable %w{ aircraft aircraft_deux census_division_deux census_division_trois }
19
+ end
20
+
21
+ class Test::Unit::TestCase
22
+ end
23
+
24
+ ActiveRecord::Schema.define(:version => 20090819143429) do
25
+ create_table "t100_flight_segments", :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
26
+ t.integer "departures_performed"
27
+ t.integer "payload"
28
+ t.integer "seats"
29
+ t.integer "passengers"
30
+ t.integer "freight"
31
+ t.integer "mail"
32
+ t.integer "ramp_to_ramp"
33
+ t.integer "air_time"
34
+ t.float "load_factor"
35
+ t.float "freight_share"
36
+ t.integer "distance"
37
+ t.integer "departures_scheduled"
38
+ t.string "unique_carrier"
39
+ t.integer "dot_airline_id"
40
+ t.string "unique_carrier_name"
41
+ t.string "unique_carrier_entity"
42
+ t.string "region"
43
+ t.string "carrier"
44
+ t.string "carrier_name"
45
+ t.integer "carrier_group"
46
+ t.integer "carrier_group_new"
47
+ t.string "origin_airport_iata"
48
+ t.string "origin_city_name"
49
+ t.integer "origin_city_num"
50
+ t.string "origin_state_abr"
51
+ t.string "origin_state_fips"
52
+ t.string "origin_state_nm"
53
+ t.string "origin_country_iso_3166"
54
+ t.string "origin_country_name"
55
+ t.integer "origin_wac"
56
+ t.string "dest_airport_iata"
57
+ t.string "dest_city_name"
58
+ t.integer "dest_city_num"
59
+ t.string "dest_state_abr"
60
+ t.string "dest_state_fips"
61
+ t.string "dest_state_nm"
62
+ t.string "dest_country_iso_3166"
63
+ t.string "dest_country_name"
64
+ t.integer "dest_wac"
65
+ t.integer "bts_aircraft_group"
66
+ t.integer "bts_aircraft_type"
67
+ t.integer "bts_aircraft_config"
68
+ t.integer "year"
69
+ t.integer "quarter"
70
+ t.integer "month"
71
+ t.integer "bts_distance_group"
72
+ t.string "bts_service_class"
73
+ t.string "data_source"
74
+ t.float "seats_per_departure"
75
+
76
+ t.string 'payload_units'
77
+ t.string 'freight_units'
78
+ t.string 'mail_units'
79
+ t.string 'distance_units'
80
+
81
+ t.datetime "created_at"
82
+ t.datetime "updated_at"
83
+
84
+ t.string "row_hash"
85
+ end
86
+ execute 'ALTER TABLE t100_flight_segments ADD PRIMARY KEY (row_hash);'
87
+
88
+ create_table 'tapped_airports', :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
89
+ t.string 'i_am_just_here_to_get_in_the_way'
90
+ end
91
+
92
+ create_table 'airports', :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
93
+ t.string 'iata_code'
94
+ t.string 'name'
95
+ t.string 'city'
96
+ t.string 'country_name'
97
+ t.float 'latitude'
98
+ t.float 'longitude'
99
+ t.datetime 'created_at'
100
+ t.datetime 'updated_at'
101
+ end
102
+ execute 'ALTER TABLE airports ADD PRIMARY KEY (iata_code);'
103
+
104
+ create_table "countries", :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
105
+ t.string "iso_3166"
106
+ t.string "name"
107
+ t.datetime "created_at"
108
+ t.datetime "updated_at"
109
+ end
110
+ execute "ALTER TABLE countries ADD PRIMARY KEY (iso_3166);"
111
+
112
+ create_table "census_regions", :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
113
+ t.integer "number"
114
+ t.string "name"
115
+ t.datetime "updated_at"
116
+ t.datetime "created_at"
117
+ end
118
+ execute "ALTER TABLE census_regions ADD PRIMARY KEY (number);"
119
+
120
+ create_table 'census_divisions', :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
121
+ t.integer 'number'
122
+ t.string 'name'
123
+ t.datetime 'updated_at'
124
+ t.datetime 'created_at'
125
+ t.string 'census_region_name'
126
+ t.integer 'census_region_number'
127
+
128
+ end
129
+ execute 'ALTER TABLE census_divisions ADD PRIMARY KEY (number);'
130
+
131
+ create_table 'census_division_deux', :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
132
+ t.integer 'number'
133
+ t.string 'name'
134
+ t.datetime 'updated_at'
135
+ t.datetime 'created_at'
136
+ t.string 'census_region_name'
137
+ t.integer 'census_region_number'
138
+
139
+ end
140
+ execute 'ALTER TABLE census_division_deux ADD PRIMARY KEY (number);'
141
+
142
+ create_table 'crosscalling_census_divisions', :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
143
+ t.integer 'number'
144
+ t.string 'name'
145
+ t.datetime 'updated_at'
146
+ t.datetime 'created_at'
147
+ t.string 'census_region_name'
148
+ t.integer 'census_region_number'
149
+
150
+ end
151
+ execute 'ALTER TABLE crosscalling_census_divisions ADD PRIMARY KEY (number);'
152
+
153
+ create_table "automobile_variants", :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
154
+ t.float "fuel_efficiency_city"
155
+ t.float "fuel_efficiency_highway"
156
+ t.string "make_name"
157
+ t.string "model_name"
158
+ t.string "year"
159
+ t.string "fuel_type_code"
160
+ t.datetime "updated_at"
161
+ t.datetime "created_at"
162
+ t.string "transmission"
163
+ t.string "drive"
164
+ t.boolean "turbo"
165
+ t.boolean "supercharger"
166
+ t.integer "cylinders"
167
+ t.float "displacement"
168
+ t.float "raw_fuel_efficiency_city"
169
+ t.float "raw_fuel_efficiency_highway"
170
+ t.integer "carline_mfr_code"
171
+ t.integer "vi_mfr_code"
172
+ t.integer "carline_code"
173
+ t.integer "carline_class_code"
174
+ t.boolean "injection"
175
+ t.string "carline_class_name"
176
+ t.string "speeds"
177
+
178
+ t.string 'raw_fuel_efficiency_highway_units'
179
+ t.string 'raw_fuel_efficiency_city_units'
180
+ t.string 'fuel_efficiency_highway_units'
181
+ t.string 'fuel_efficiency_city_units'
182
+
183
+ t.string "row_hash"
184
+ end
185
+ execute "ALTER TABLE automobile_variants ADD PRIMARY KEY (row_hash);"
186
+
187
+ create_table "automobile_fuel_types", :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
188
+ t.string "name"
189
+ t.datetime "created_at"
190
+ t.datetime "updated_at"
191
+ t.float "emission_factor"
192
+ t.float "annual_distance"
193
+ t.string "code"
194
+ end
195
+ execute "ALTER TABLE automobile_fuel_types ADD PRIMARY KEY (code);"
196
+
197
+ create_table "residential_energy_consumption_survey_responses", :options => 'ENGINE=InnoDB default charset=utf8', :id => false, :force => true do |t|
198
+ t.integer "department_of_energy_identifier"
199
+
200
+ t.string "residence_class"
201
+ t.date "construction_year"
202
+ t.string "construction_period"
203
+ t.string "urbanity"
204
+ t.string "dishwasher_use"
205
+ t.string "central_ac_use"
206
+ t.string "window_ac_use"
207
+ t.string "clothes_washer_use"
208
+ t.string "clothes_dryer_use"
209
+
210
+ t.integer "census_division_number"
211
+ t.string "census_division_name"
212
+ t.integer "census_region_number"
213
+ t.string "census_region_name"
214
+
215
+ t.float "rooms"
216
+ t.float "floorspace"
217
+ t.integer "residents"
218
+ t.boolean "ownership"
219
+ t.boolean "thermostat_programmability"
220
+ t.integer "refrigerator_count"
221
+ t.integer "freezer_count"
222
+ t.float "annual_energy_from_fuel_oil_for_heating_space"
223
+ t.float "annual_energy_from_fuel_oil_for_heating_water"
224
+ t.float "annual_energy_from_fuel_oil_for_appliances"
225
+ t.float "annual_energy_from_natural_gas_for_heating_space"
226
+ t.float "annual_energy_from_natural_gas_for_heating_water"
227
+ t.float "annual_energy_from_natural_gas_for_appliances"
228
+ t.float "annual_energy_from_propane_for_heating_space"
229
+ t.float "annual_energy_from_propane_for_heating_water"
230
+ t.float "annual_energy_from_propane_for_appliances"
231
+ t.float "annual_energy_from_wood"
232
+ t.float "annual_energy_from_kerosene"
233
+ t.float "annual_energy_from_electricity_for_clothes_driers"
234
+ t.float "annual_energy_from_electricity_for_dishwashers"
235
+ t.float "annual_energy_from_electricity_for_freezers"
236
+ t.float "annual_energy_from_electricity_for_refrigerators"
237
+ t.float "annual_energy_from_electricity_for_air_conditioners"
238
+ t.float "annual_energy_from_electricity_for_heating_space"
239
+ t.float "annual_energy_from_electricity_for_heating_water"
240
+ t.float "annual_energy_from_electricity_for_other_appliances"
241
+ t.float "weighting"
242
+ t.float "lighting_use"
243
+ t.float "lighting_efficiency"
244
+ t.integer "heating_degree_days"
245
+ t.integer "cooling_degree_days"
246
+ t.integer "total_rooms"
247
+ t.integer "bathrooms"
248
+ t.integer "halfbaths"
249
+ t.integer "heated_garage"
250
+ t.integer "attached_1car_garage"
251
+ t.integer "detached_1car_garage"
252
+ t.integer "attached_2car_garage"
253
+ t.integer "detached_2car_garage"
254
+ t.integer "attached_3car_garage"
255
+ t.integer "detached_3car_garage"
256
+ t.integer "lights_on_1_to_4_hours"
257
+ t.integer "efficient_lights_on_1_to_4_hours"
258
+ t.integer "lights_on_4_to_12_hours"
259
+ t.integer "efficient_lights_on_4_to_12_hours"
260
+ t.integer "lights_on_over_12_hours"
261
+ t.integer "efficient_lights_on_over_12_hours"
262
+ t.integer "outdoor_all_night_lights"
263
+ t.integer "outdoor_all_night_gas_lights"
264
+
265
+ t.datetime "created_at"
266
+ t.datetime "updated_at"
267
+ end
268
+ execute "ALTER TABLE residential_energy_consumption_survey_responses ADD PRIMARY KEY (department_of_energy_identifier);"
269
+
270
+ create_table 'aircraft', :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
271
+ t.string 'icao_code'
272
+ t.string 'manufacturer_name'
273
+ t.string 'name'
274
+
275
+ t.string "bts_name"
276
+ t.string "bts_aircraft_type_code"
277
+
278
+ t.string 'brighter_planet_aircraft_class_code'
279
+ # t.float 'm3'
280
+ # t.float 'm2'
281
+ # t.float 'm1'
282
+ # t.float 'endpoint_fuel'
283
+ t.datetime 'updated_at'
284
+ t.datetime 'created_at'
285
+ end
286
+ execute 'ALTER TABLE aircraft ADD PRIMARY KEY (icao_code);'
287
+
288
+ create_table 'aircraft_deux', :force => true, :options => 'ENGINE=InnoDB default charset=utf8', :id => false do |t|
289
+ t.string 'icao_code'
290
+ t.string 'manufacturer_name'
291
+ t.string 'name'
292
+
293
+ t.string "bts_name"
294
+ t.string "bts_aircraft_type_code"
295
+
296
+ # t.string 'brighter_planet_aircraft_class_code'
297
+ # t.float 'm3'
298
+ # t.float 'm2'
299
+ # t.float 'm1'
300
+ # t.float 'endpoint_fuel'
301
+ t.datetime 'updated_at'
302
+ t.datetime 'created_at'
303
+ end
304
+ execute 'ALTER TABLE aircraft_deux ADD PRIMARY KEY (icao_code);'
305
+ end
306
+
307
+ DataMiner::Run.create_tables
metadata ADDED
@@ -0,0 +1,330 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: data_miner-ruby19
3
+ version: !ruby/object:Gem::Version
4
+ hash: 3
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 4
10
+ version: 0.5.4
11
+ platform: ruby
12
+ authors:
13
+ - Seamus Abshere
14
+ - Andy Rossmeissl
15
+ - Derek Kastner
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2010-09-27 00:00:00 -05:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: remote_table-ruby19
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - "="
30
+ - !ruby/object:Gem::Version
31
+ hash: 43
32
+ segments:
33
+ - 0
34
+ - 2
35
+ - 30
36
+ version: 0.2.30
37
+ type: :runtime
38
+ version_requirements: *id001
39
+ - !ruby/object:Gem::Dependency
40
+ name: escape
41
+ prerelease: false
42
+ requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 23
48
+ segments:
49
+ - 0
50
+ - 0
51
+ - 4
52
+ version: 0.0.4
53
+ type: :runtime
54
+ version_requirements: *id002
55
+ - !ruby/object:Gem::Dependency
56
+ name: activerecord
57
+ prerelease: false
58
+ requirement: &id003 !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ hash: 11
64
+ segments:
65
+ - 2
66
+ - 3
67
+ - 4
68
+ version: 2.3.4
69
+ type: :runtime
70
+ version_requirements: *id003
71
+ - !ruby/object:Gem::Dependency
72
+ name: activesupport
73
+ prerelease: false
74
+ requirement: &id004 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 11
80
+ segments:
81
+ - 2
82
+ - 3
83
+ - 4
84
+ version: 2.3.4
85
+ type: :runtime
86
+ version_requirements: *id004
87
+ - !ruby/object:Gem::Dependency
88
+ name: andand
89
+ prerelease: false
90
+ requirement: &id005 !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ hash: 25
96
+ segments:
97
+ - 1
98
+ - 3
99
+ - 1
100
+ version: 1.3.1
101
+ type: :runtime
102
+ version_requirements: *id005
103
+ - !ruby/object:Gem::Dependency
104
+ name: conversions
105
+ prerelease: false
106
+ requirement: &id006 !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ hash: 15
112
+ segments:
113
+ - 1
114
+ - 4
115
+ - 4
116
+ version: 1.4.4
117
+ type: :runtime
118
+ version_requirements: *id006
119
+ - !ruby/object:Gem::Dependency
120
+ name: blockenspiel
121
+ prerelease: false
122
+ requirement: &id007 !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - "="
126
+ - !ruby/object:Gem::Version
127
+ hash: 23
128
+ segments:
129
+ - 0
130
+ - 3
131
+ - 2
132
+ version: 0.3.2
133
+ type: :runtime
134
+ version_requirements: *id007
135
+ - !ruby/object:Gem::Dependency
136
+ name: log4r
137
+ prerelease: false
138
+ requirement: &id008 !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ hash: 29
144
+ segments:
145
+ - 1
146
+ - 1
147
+ - 7
148
+ version: 1.1.7
149
+ type: :runtime
150
+ version_requirements: *id008
151
+ - !ruby/object:Gem::Dependency
152
+ name: errata
153
+ prerelease: false
154
+ requirement: &id009 !ruby/object:Gem::Requirement
155
+ none: false
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ hash: 21
160
+ segments:
161
+ - 0
162
+ - 2
163
+ - 1
164
+ version: 0.2.1
165
+ type: :runtime
166
+ version_requirements: *id009
167
+ - !ruby/object:Gem::Dependency
168
+ name: taps
169
+ prerelease: false
170
+ requirement: &id010 !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ hash: 5
176
+ segments:
177
+ - 0
178
+ - 3
179
+ - 11
180
+ version: 0.3.11
181
+ type: :runtime
182
+ version_requirements: *id010
183
+ - !ruby/object:Gem::Dependency
184
+ name: loose_tight_dictionary
185
+ prerelease: false
186
+ requirement: &id011 !ruby/object:Gem::Requirement
187
+ none: false
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ hash: 21
192
+ segments:
193
+ - 0
194
+ - 0
195
+ - 5
196
+ version: 0.0.5
197
+ type: :development
198
+ version_requirements: *id011
199
+ - !ruby/object:Gem::Dependency
200
+ name: jeweler
201
+ prerelease: false
202
+ requirement: &id012 !ruby/object:Gem::Requirement
203
+ none: false
204
+ requirements:
205
+ - - ">="
206
+ - !ruby/object:Gem::Version
207
+ hash: 3
208
+ segments:
209
+ - 0
210
+ version: "0"
211
+ type: :development
212
+ version_requirements: *id012
213
+ - !ruby/object:Gem::Dependency
214
+ name: rcov
215
+ prerelease: false
216
+ requirement: &id013 !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ hash: 3
222
+ segments:
223
+ - 0
224
+ version: "0"
225
+ type: :development
226
+ version_requirements: *id013
227
+ - !ruby/object:Gem::Dependency
228
+ name: rake
229
+ prerelease: false
230
+ requirement: &id014 !ruby/object:Gem::Requirement
231
+ none: false
232
+ requirements:
233
+ - - ">="
234
+ - !ruby/object:Gem::Version
235
+ hash: 3
236
+ segments:
237
+ - 0
238
+ version: "0"
239
+ type: :development
240
+ version_requirements: *id014
241
+ - !ruby/object:Gem::Dependency
242
+ name: shoulda
243
+ prerelease: false
244
+ requirement: &id015 !ruby/object:Gem::Requirement
245
+ none: false
246
+ requirements:
247
+ - - ">="
248
+ - !ruby/object:Gem::Version
249
+ hash: 3
250
+ segments:
251
+ - 0
252
+ version: "0"
253
+ type: :development
254
+ version_requirements: *id015
255
+ - !ruby/object:Gem::Dependency
256
+ name: mysql
257
+ prerelease: false
258
+ requirement: &id016 !ruby/object:Gem::Requirement
259
+ none: false
260
+ requirements:
261
+ - - ">="
262
+ - !ruby/object:Gem::Version
263
+ hash: 3
264
+ segments:
265
+ - 0
266
+ version: "0"
267
+ type: :development
268
+ version_requirements: *id016
269
+ description: Mine remote data into your ActiveRecord models. You can also perform associations and convert units.
270
+ email: seamus@abshere.net
271
+ executables: []
272
+
273
+ extensions: []
274
+
275
+ extra_rdoc_files:
276
+ - LICENSE
277
+ - README.rdoc
278
+ files:
279
+ - LICENSE
280
+ - README.rdoc
281
+ - lib/data_miner.rb
282
+ - lib/data_miner/attribute.rb
283
+ - lib/data_miner/base.rb
284
+ - lib/data_miner/dictionary.rb
285
+ - lib/data_miner/import.rb
286
+ - lib/data_miner/process.rb
287
+ - lib/data_miner/run.rb
288
+ - lib/data_miner/schema.rb
289
+ - lib/data_miner/tap.rb
290
+ - test/data_miner_test.rb
291
+ - test/test_helper.rb
292
+ has_rdoc: true
293
+ homepage: http://github.com/seamusabshere/data_miner
294
+ licenses: []
295
+
296
+ post_install_message:
297
+ rdoc_options:
298
+ - --charset=UTF-8
299
+ - --line-numbers
300
+ - --inline-source
301
+ require_paths:
302
+ - lib
303
+ required_ruby_version: !ruby/object:Gem::Requirement
304
+ none: false
305
+ requirements:
306
+ - - ">="
307
+ - !ruby/object:Gem::Version
308
+ hash: 3
309
+ segments:
310
+ - 0
311
+ version: "0"
312
+ required_rubygems_version: !ruby/object:Gem::Requirement
313
+ none: false
314
+ requirements:
315
+ - - ">="
316
+ - !ruby/object:Gem::Version
317
+ hash: 3
318
+ segments:
319
+ - 0
320
+ version: "0"
321
+ requirements: []
322
+
323
+ rubyforge_project:
324
+ rubygems_version: 1.3.7
325
+ signing_key:
326
+ specification_version: 3
327
+ summary: Mine remote data into your ActiveRecord models.
328
+ test_files:
329
+ - test/data_miner_test.rb
330
+ - test/test_helper.rb