sniff 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +5 -1
- data/lib/sniff.rb +4 -14
- data/lib/sniff/database.rb +20 -57
- data/lib/sniff/emitter.rb +12 -5
- data/spec/lib/sniff/database_spec.rb +8 -9
- metadata +56 -119
- data/lib/sniff/active_record_ext.rb +0 -12
- data/lib/sniff/conversions_ext.rb +0 -45
- data/lib/test_support/data_models/census_division.rb +0 -9
- data/lib/test_support/data_models/census_region.rb +0 -9
- data/lib/test_support/data_models/climate_division.rb +0 -8
- data/lib/test_support/data_models/country.rb +0 -9
- data/lib/test_support/data_models/egrid_region.rb +0 -7
- data/lib/test_support/data_models/egrid_subregion.rb +0 -8
- data/lib/test_support/data_models/gender.rb +0 -6
- data/lib/test_support/data_models/petroleum_administration_for_defense_district.rb +0 -9
- data/lib/test_support/data_models/state.rb +0 -13
- data/lib/test_support/data_models/urbanity.rb +0 -6
- data/lib/test_support/data_models/zip_code.rb +0 -14
- data/lib/test_support/db/fixtures/yearly_anonymous_emissions.csv +0 -0
- data/lib/test_support/db/fixtures/yearly_typical_emissions.csv +0 -0
- data/lib/test_support/db/schema.rb +0 -117
- data/spec/spec.opts +0 -2
- data/vendor/geokit-rails/CHANGELOG.rdoc +0 -46
- data/vendor/geokit-rails/MIT-LICENSE +0 -20
- data/vendor/geokit-rails/README.markdown +0 -561
- data/vendor/geokit-rails/Rakefile +0 -18
- data/vendor/geokit-rails/about.yml +0 -9
- data/vendor/geokit-rails/assets/api_keys_template +0 -61
- data/vendor/geokit-rails/init.rb +0 -1
- data/vendor/geokit-rails/install.rb +0 -14
- data/vendor/geokit-rails/lib/geokit-rails.rb +0 -24
- data/vendor/geokit-rails/lib/geokit-rails/acts_as_mappable.rb +0 -456
- data/vendor/geokit-rails/lib/geokit-rails/adapters/abstract.rb +0 -31
- data/vendor/geokit-rails/lib/geokit-rails/adapters/mysql.rb +0 -22
- data/vendor/geokit-rails/lib/geokit-rails/adapters/postgresql.rb +0 -22
- data/vendor/geokit-rails/lib/geokit-rails/adapters/sqlserver.rb +0 -43
- data/vendor/geokit-rails/lib/geokit-rails/defaults.rb +0 -22
- data/vendor/geokit-rails/lib/geokit-rails/geocoder_control.rb +0 -16
- data/vendor/geokit-rails/lib/geokit-rails/ip_geocode_lookup.rb +0 -46
- data/vendor/geokit-rails/test/acts_as_mappable_test.rb +0 -474
- data/vendor/geokit-rails/test/boot.rb +0 -25
- data/vendor/geokit-rails/test/database.yml +0 -20
- data/vendor/geokit-rails/test/fixtures/companies.yml +0 -7
- data/vendor/geokit-rails/test/fixtures/custom_locations.yml +0 -54
- data/vendor/geokit-rails/test/fixtures/locations.yml +0 -54
- data/vendor/geokit-rails/test/fixtures/mock_addresses.yml +0 -17
- data/vendor/geokit-rails/test/fixtures/mock_families.yml +0 -2
- data/vendor/geokit-rails/test/fixtures/mock_houses.yml +0 -9
- data/vendor/geokit-rails/test/fixtures/mock_organizations.yml +0 -5
- data/vendor/geokit-rails/test/fixtures/mock_people.yml +0 -5
- data/vendor/geokit-rails/test/fixtures/stores.yml +0 -0
- data/vendor/geokit-rails/test/ip_geocode_lookup_test.rb +0 -77
- data/vendor/geokit-rails/test/models/company.rb +0 -3
- data/vendor/geokit-rails/test/models/custom_location.rb +0 -12
- data/vendor/geokit-rails/test/models/location.rb +0 -4
- data/vendor/geokit-rails/test/models/mock_address.rb +0 -4
- data/vendor/geokit-rails/test/models/mock_family.rb +0 -3
- data/vendor/geokit-rails/test/models/mock_house.rb +0 -3
- data/vendor/geokit-rails/test/models/mock_organization.rb +0 -4
- data/vendor/geokit-rails/test/models/mock_person.rb +0 -4
- data/vendor/geokit-rails/test/models/store.rb +0 -3
- data/vendor/geokit-rails/test/schema.rb +0 -60
- data/vendor/geokit-rails/test/tasks.rake +0 -31
- data/vendor/geokit-rails/test/test_helper.rb +0 -23
data/README.markdown
CHANGED
@@ -2,8 +2,10 @@
|
|
2
2
|
Testing environment for Brighter Planet Climate Middleware emission calculation gems.
|
3
3
|
|
4
4
|
This gem provides:
|
5
|
-
* Sample
|
5
|
+
* Sample data used for calculations, representative of data found on http://data.brighterplanet.com
|
6
|
+
* A database/ActiveRecord environment for said data
|
6
7
|
* References to gems needed by each emitter gem
|
8
|
+
* An autoloader that will load any models and sample data needed by the emitter gem being tested (see Usage)
|
7
9
|
|
8
10
|
# Usage
|
9
11
|
Within an emitter gem's test setup, you can:
|
@@ -11,6 +13,8 @@ Within an emitter gem's test setup, you can:
|
|
11
13
|
|
12
14
|
Sniff.init '/path/to/emitter_project'
|
13
15
|
|
16
|
+
If an emitter gem has its own test models and data, sniff will look for the models in `EMITTER_GEM_DIR/lib/test_support/data_models/` and the data fixtures in `EMITTER_GEM_DIR/lib/test_support/db/fixtures/`. It will also look for a schema in `EMITTER_GEM_DIR/lib/test_support/db/schema.rb`
|
17
|
+
|
14
18
|
# How to contribute
|
15
19
|
Typical contributions will include updates to test data.
|
16
20
|
|
data/lib/sniff.rb
CHANGED
@@ -6,26 +6,16 @@ module Sniff
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def init(local_root, options = {})
|
9
|
-
|
10
|
-
require 'sqlite3'
|
11
|
-
|
12
|
-
load_plugins
|
9
|
+
options[:earth] ||= :none
|
13
10
|
|
14
11
|
Sniff::Database.init local_root, options
|
15
12
|
end
|
16
|
-
|
17
|
-
def load_plugins
|
18
|
-
Dir[File.join(Sniff.root, 'vendor', '**', 'init.rb')].each do |pluginit|
|
19
|
-
$:.unshift File.join(File.dirname(pluginit), 'lib')
|
20
|
-
load pluginit
|
21
|
-
end
|
22
|
-
end
|
23
13
|
end
|
24
14
|
|
15
|
+
require 'earth'
|
25
16
|
require 'characterizable'
|
17
|
+
require 'timeframe'
|
18
|
+
|
26
19
|
$:.unshift File.dirname(__FILE__)
|
27
|
-
require 'sniff/active_record_ext'
|
28
20
|
require 'sniff/database'
|
29
21
|
require 'sniff/emitter'
|
30
|
-
require 'sniff/conversions_ext'
|
31
|
-
require 'sniff/timeframe'
|
data/lib/sniff/database.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
require 'active_support'
|
1
2
|
require 'fileutils'
|
2
3
|
require 'logger'
|
4
|
+
require 'sqlite3'
|
3
5
|
|
4
6
|
module Sniff
|
5
7
|
class Database
|
@@ -12,7 +14,7 @@ module Sniff
|
|
12
14
|
environments << really_init(Sniff.root)
|
13
15
|
end
|
14
16
|
|
15
|
-
db_init
|
17
|
+
db_init options
|
16
18
|
environments.each { |e| e.populate_fixtures }
|
17
19
|
end
|
18
20
|
|
@@ -22,21 +24,20 @@ module Sniff
|
|
22
24
|
db
|
23
25
|
end
|
24
26
|
|
25
|
-
def db_init(
|
26
|
-
|
27
|
-
|
28
|
-
FileUtils.mkdir_p db_path
|
29
|
-
db_drop db_file_path
|
30
|
-
connect db_file_path
|
27
|
+
def db_init(options)
|
28
|
+
ActiveRecord::Base.logger = Logger.new nil
|
29
|
+
connect
|
31
30
|
db_create
|
32
|
-
|
31
|
+
earth_init(options[:earth])
|
33
32
|
end
|
34
33
|
|
35
|
-
def
|
34
|
+
def earth_init(domain)
|
35
|
+
Earth.init domain, :apply_schemas => true
|
36
|
+
end
|
37
|
+
|
38
|
+
def connect
|
36
39
|
ActiveRecord::Base.establish_connection :adapter => 'sqlite3',
|
37
|
-
:database =>
|
38
|
-
:pool => 5,
|
39
|
-
:timeout => 5000
|
40
|
+
:database => ':memory:'
|
40
41
|
end
|
41
42
|
|
42
43
|
def db_drop(db_file_path)
|
@@ -46,39 +47,15 @@ module Sniff
|
|
46
47
|
def db_create
|
47
48
|
ActiveRecord::Base.connection
|
48
49
|
end
|
49
|
-
|
50
|
-
def define_schema(&blk)
|
51
|
-
@schemas = [] unless defined?(@schemas)
|
52
|
-
@schemas << blk
|
53
|
-
end
|
54
|
-
|
55
|
-
def schemas
|
56
|
-
@schemas
|
57
|
-
end
|
58
|
-
|
59
|
-
def load_all_schemas
|
60
|
-
orig_std_out = STDOUT.clone
|
61
|
-
STDOUT.reopen File.open(File.join('/tmp', 'schema_output'), 'w')
|
62
|
-
|
63
|
-
ActiveRecord::Schema.define(:version => 1) do
|
64
|
-
ar_schema = self
|
65
|
-
Sniff::Database.schemas.each do |s|
|
66
|
-
ar_schema.instance_eval &s
|
67
|
-
end
|
68
|
-
end
|
69
|
-
ensure
|
70
|
-
STDOUT.reopen(orig_std_out)
|
71
|
-
end
|
72
50
|
end
|
73
51
|
|
74
|
-
attr_accessor :root, :lib_path, :
|
52
|
+
attr_accessor :root, :lib_path, :fixtures_path,
|
75
53
|
:load_data, :fixtures, :logger
|
76
54
|
|
77
55
|
def initialize(root, options)
|
78
56
|
self.root = root
|
79
57
|
self.lib_path = File.join(root, 'lib', 'test_support')
|
80
58
|
self.load_data = options[:load_data]
|
81
|
-
self.schema_path = options[:schema_path]
|
82
59
|
self.fixtures_path = options[:fixtures_path]
|
83
60
|
self.logger = Logger.new options[:logdev]
|
84
61
|
end
|
@@ -92,10 +69,6 @@ module Sniff
|
|
92
69
|
@load_data
|
93
70
|
end
|
94
71
|
|
95
|
-
def schema_path
|
96
|
-
@schema_path ||= File.join(lib_path, 'db', 'schema.rb')
|
97
|
-
end
|
98
|
-
|
99
72
|
def fixtures_path
|
100
73
|
@fixtures_path ||= File.join(lib_path, 'db', 'fixtures')
|
101
74
|
end
|
@@ -105,17 +78,10 @@ module Sniff
|
|
105
78
|
end
|
106
79
|
|
107
80
|
def init
|
108
|
-
load_models
|
109
81
|
load_supporting_libs
|
110
|
-
read_schema
|
111
82
|
read_fixtures if load_data?
|
112
83
|
end
|
113
84
|
|
114
|
-
def read_schema
|
115
|
-
log "Reading schema #{schema_path}"
|
116
|
-
load(schema_path)
|
117
|
-
end
|
118
|
-
|
119
85
|
def read_fixtures
|
120
86
|
require 'active_record/fixtures'
|
121
87
|
log "Reading fixtures from #{fixtures_path}/**/*.{yml,csv}"
|
@@ -127,8 +93,12 @@ module Sniff
|
|
127
93
|
|
128
94
|
def populate_fixtures
|
129
95
|
fixtures.each do |fixture_file|
|
130
|
-
|
131
|
-
|
96
|
+
klass = File.basename(fixture_file, '.csv').
|
97
|
+
camelize.singularize
|
98
|
+
if Object.const_defined?(klass) and klass.constantize.table_exists?
|
99
|
+
log "Loading fixture #{fixture_file}"
|
100
|
+
Fixtures.create_fixtures(fixtures_path, fixture_file[(fixtures_path.size + 1)..-5])
|
101
|
+
end
|
132
102
|
end
|
133
103
|
end
|
134
104
|
|
@@ -139,12 +109,5 @@ module Sniff
|
|
139
109
|
require lib
|
140
110
|
end
|
141
111
|
end
|
142
|
-
|
143
|
-
def load_models
|
144
|
-
Dir["#{lib_path}/data_models/**/*.rb"].each do |lib|
|
145
|
-
log "Loading model #{lib}"
|
146
|
-
require lib
|
147
|
-
end
|
148
|
-
end
|
149
112
|
end
|
150
113
|
end
|
data/lib/sniff/emitter.rb
CHANGED
@@ -10,11 +10,14 @@ require 'data_miner'
|
|
10
10
|
module Sniff
|
11
11
|
module Emitter
|
12
12
|
def self.included(target)
|
13
|
-
target.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
target.instance_eval do
|
14
|
+
extend Leap::Subject
|
15
|
+
extend ClassMethods
|
16
|
+
extend SummaryJudgement
|
17
|
+
extend FastTimestamp
|
18
|
+
include Characterizable
|
19
|
+
include CommonName
|
20
|
+
end
|
18
21
|
end
|
19
22
|
|
20
23
|
def parent_class
|
@@ -61,6 +64,10 @@ module Sniff
|
|
61
64
|
new resolved_params
|
62
65
|
end
|
63
66
|
|
67
|
+
def _common_name
|
68
|
+
name.underscore
|
69
|
+
end
|
70
|
+
|
64
71
|
def pattern?
|
65
72
|
common_name.ends_with? 'pattern'
|
66
73
|
end
|
@@ -3,18 +3,17 @@ require 'fileutils'
|
|
3
3
|
|
4
4
|
describe Sniff::Database do
|
5
5
|
describe '#connect' do
|
6
|
-
before :
|
6
|
+
before :each do
|
7
7
|
@db_path = File.join(File.dirname(__FILE__), '..', '..', '..')
|
8
|
-
Sniff.init(@db_path)
|
9
|
-
@sqlite_path = File.join(@db_path, 'db', 'emitter_data.sqlite3')
|
10
8
|
end
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
it 'should load the air domain' do
|
10
|
+
Sniff.init(@db_path, :earth => :air, :apply_schemas => true)
|
11
|
+
Airport.count.should == 0 # we don't have fixtures for this here
|
12
|
+
ZipCode.count.should > 0
|
13
|
+
expect { AutomobileFuelType }.should raise_error
|
16
14
|
end
|
17
|
-
it 'should load data' do
|
15
|
+
it 'should load data for all domains' do
|
16
|
+
Sniff.init(@db_path, :earth => :all, :apply_schemas => true)
|
18
17
|
ZipCode.count.should > 0
|
19
18
|
end
|
20
19
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sniff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Derek Kastner
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-19 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -38,8 +38,25 @@ dependencies:
|
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
|
-
name:
|
41
|
+
name: activesupport
|
42
42
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - "="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: -1848230024
|
48
|
+
segments:
|
49
|
+
- 3
|
50
|
+
- 0
|
51
|
+
- 0
|
52
|
+
- beta4
|
53
|
+
version: 3.0.0.beta4
|
54
|
+
requirement: *id002
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
name: sqlite3-ruby
|
59
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
43
60
|
none: false
|
44
61
|
requirements:
|
45
62
|
- - "="
|
@@ -50,12 +67,12 @@ dependencies:
|
|
50
67
|
- 3
|
51
68
|
- 0
|
52
69
|
version: 1.3.0
|
53
|
-
requirement: *
|
70
|
+
requirement: *id003
|
54
71
|
- !ruby/object:Gem::Dependency
|
55
72
|
type: :runtime
|
56
73
|
prerelease: false
|
57
74
|
name: falls_back_on
|
58
|
-
version_requirements: &
|
75
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
59
76
|
none: false
|
60
77
|
requirements:
|
61
78
|
- - "="
|
@@ -66,12 +83,12 @@ dependencies:
|
|
66
83
|
- 0
|
67
84
|
- 2
|
68
85
|
version: 0.0.2
|
69
|
-
requirement: *
|
86
|
+
requirement: *id004
|
70
87
|
- !ruby/object:Gem::Dependency
|
71
88
|
type: :runtime
|
72
89
|
prerelease: false
|
73
90
|
name: cohort_scope
|
74
|
-
version_requirements: &
|
91
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
75
92
|
none: false
|
76
93
|
requirements:
|
77
94
|
- - "="
|
@@ -82,12 +99,12 @@ dependencies:
|
|
82
99
|
- 0
|
83
100
|
- 5
|
84
101
|
version: 0.0.5
|
85
|
-
requirement: *
|
102
|
+
requirement: *id005
|
86
103
|
- !ruby/object:Gem::Dependency
|
87
104
|
type: :runtime
|
88
105
|
prerelease: false
|
89
106
|
name: leap
|
90
|
-
version_requirements: &
|
107
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
91
108
|
none: false
|
92
109
|
requirements:
|
93
110
|
- - "="
|
@@ -98,12 +115,12 @@ dependencies:
|
|
98
115
|
- 3
|
99
116
|
- 3
|
100
117
|
version: 0.3.3
|
101
|
-
requirement: *
|
118
|
+
requirement: *id006
|
102
119
|
- !ruby/object:Gem::Dependency
|
103
120
|
type: :runtime
|
104
121
|
prerelease: false
|
105
122
|
name: summary_judgement
|
106
|
-
version_requirements: &
|
123
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
107
124
|
none: false
|
108
125
|
requirements:
|
109
126
|
- - "="
|
@@ -114,12 +131,12 @@ dependencies:
|
|
114
131
|
- 3
|
115
132
|
- 8
|
116
133
|
version: 1.3.8
|
117
|
-
requirement: *
|
134
|
+
requirement: *id007
|
118
135
|
- !ruby/object:Gem::Dependency
|
119
136
|
type: :runtime
|
120
137
|
prerelease: false
|
121
138
|
name: fast_timestamp
|
122
|
-
version_requirements: &
|
139
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
123
140
|
none: false
|
124
141
|
requirements:
|
125
142
|
- - "="
|
@@ -130,12 +147,12 @@ dependencies:
|
|
130
147
|
- 0
|
131
148
|
- 4
|
132
149
|
version: 0.0.4
|
133
|
-
requirement: *
|
150
|
+
requirement: *id008
|
134
151
|
- !ruby/object:Gem::Dependency
|
135
152
|
type: :runtime
|
136
153
|
prerelease: false
|
137
154
|
name: common_name
|
138
|
-
version_requirements: &
|
155
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
139
156
|
none: false
|
140
157
|
requirements:
|
141
158
|
- - "="
|
@@ -146,54 +163,38 @@ dependencies:
|
|
146
163
|
- 1
|
147
164
|
- 5
|
148
165
|
version: 0.1.5
|
149
|
-
requirement: *id008
|
150
|
-
- !ruby/object:Gem::Dependency
|
151
|
-
type: :runtime
|
152
|
-
prerelease: false
|
153
|
-
name: conversions
|
154
|
-
version_requirements: &id009 !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
|
-
requirements:
|
157
|
-
- - "="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
hash: 13
|
160
|
-
segments:
|
161
|
-
- 1
|
162
|
-
- 4
|
163
|
-
- 5
|
164
|
-
version: 1.4.5
|
165
166
|
requirement: *id009
|
166
167
|
- !ruby/object:Gem::Dependency
|
167
168
|
type: :runtime
|
168
169
|
prerelease: false
|
169
|
-
name:
|
170
|
+
name: timeframe
|
170
171
|
version_requirements: &id010 !ruby/object:Gem::Requirement
|
171
172
|
none: false
|
172
173
|
requirements:
|
173
174
|
- - "="
|
174
175
|
- !ruby/object:Gem::Version
|
175
|
-
hash:
|
176
|
+
hash: 29
|
176
177
|
segments:
|
177
|
-
- 1
|
178
|
-
- 5
|
179
178
|
- 0
|
180
|
-
|
179
|
+
- 0
|
180
|
+
- 1
|
181
|
+
version: 0.0.1
|
181
182
|
requirement: *id010
|
182
183
|
- !ruby/object:Gem::Dependency
|
183
184
|
type: :runtime
|
184
185
|
prerelease: false
|
185
|
-
name:
|
186
|
+
name: earth
|
186
187
|
version_requirements: &id011 !ruby/object:Gem::Requirement
|
187
188
|
none: false
|
188
189
|
requirements:
|
189
190
|
- - "="
|
190
191
|
- !ruby/object:Gem::Version
|
191
|
-
hash:
|
192
|
+
hash: 19
|
192
193
|
segments:
|
193
194
|
- 0
|
194
|
-
-
|
195
|
-
-
|
196
|
-
version: 0.
|
195
|
+
- 0
|
196
|
+
- 6
|
197
|
+
version: 0.0.6
|
197
198
|
requirement: *id011
|
198
199
|
- !ruby/object:Gem::Dependency
|
199
200
|
type: :development
|
@@ -244,12 +245,16 @@ dependencies:
|
|
244
245
|
version_requirements: &id015 !ruby/object:Gem::Requirement
|
245
246
|
none: false
|
246
247
|
requirements:
|
247
|
-
- - "
|
248
|
+
- - "="
|
248
249
|
- !ruby/object:Gem::Version
|
249
|
-
hash:
|
250
|
+
hash: 62196417
|
250
251
|
segments:
|
252
|
+
- 2
|
251
253
|
- 0
|
252
|
-
|
254
|
+
- 0
|
255
|
+
- beta
|
256
|
+
- 17
|
257
|
+
version: 2.0.0.beta.17
|
253
258
|
requirement: *id015
|
254
259
|
- !ruby/object:Gem::Dependency
|
255
260
|
type: :development
|
@@ -284,8 +289,10 @@ description: |
|
|
284
289
|
Testing environment for Brighter Planet Climate Middleware emission calculation gems.
|
285
290
|
|
286
291
|
This gem provides:
|
287
|
-
* Sample
|
292
|
+
* Sample data used for calculations, representative of data found on http://data.brighterplanet.com
|
293
|
+
* A database/ActiveRecord environment for said data
|
288
294
|
* References to gems needed by each emitter gem
|
295
|
+
* An autoloader that will load any models and sample data needed by the emitter gem being tested (see Usage)
|
289
296
|
|
290
297
|
# Usage
|
291
298
|
Within an emitter gem's test setup, you can:
|
@@ -293,6 +300,8 @@ description: |
|
|
293
300
|
|
294
301
|
Sniff.init '/path/to/emitter_project'
|
295
302
|
|
303
|
+
If an emitter gem has its own test models and data, sniff will look for the models in `EMITTER_GEM_DIR/lib/test_support/data_models/` and the data fixtures in `EMITTER_GEM_DIR/lib/test_support/db/fixtures/`. It will also look for a schema in `EMITTER_GEM_DIR/lib/test_support/db/schema.rb`
|
304
|
+
|
296
305
|
# How to contribute
|
297
306
|
Typical contributions will include updates to test data.
|
298
307
|
|
@@ -363,23 +372,10 @@ extra_rdoc_files:
|
|
363
372
|
- README.markdown
|
364
373
|
files:
|
365
374
|
- lib/sniff.rb
|
366
|
-
- lib/sniff/active_record_ext.rb
|
367
|
-
- lib/sniff/conversions_ext.rb
|
368
375
|
- lib/sniff/database.rb
|
369
376
|
- lib/sniff/emitter.rb
|
370
377
|
- lib/sniff/tasks.rb
|
371
378
|
- lib/sniff/timeframe.rb
|
372
|
-
- lib/test_support/data_models/census_division.rb
|
373
|
-
- lib/test_support/data_models/census_region.rb
|
374
|
-
- lib/test_support/data_models/climate_division.rb
|
375
|
-
- lib/test_support/data_models/country.rb
|
376
|
-
- lib/test_support/data_models/egrid_region.rb
|
377
|
-
- lib/test_support/data_models/egrid_subregion.rb
|
378
|
-
- lib/test_support/data_models/gender.rb
|
379
|
-
- lib/test_support/data_models/petroleum_administration_for_defense_district.rb
|
380
|
-
- lib/test_support/data_models/state.rb
|
381
|
-
- lib/test_support/data_models/urbanity.rb
|
382
|
-
- lib/test_support/data_models/zip_code.rb
|
383
379
|
- lib/test_support/db/fixtures/census_divisions.csv
|
384
380
|
- lib/test_support/db/fixtures/census_regions.csv
|
385
381
|
- lib/test_support/db/fixtures/climate_divisions.csv
|
@@ -390,56 +386,10 @@ files:
|
|
390
386
|
- lib/test_support/db/fixtures/petroleum_administration_for_defense_districts.csv
|
391
387
|
- lib/test_support/db/fixtures/states.csv
|
392
388
|
- lib/test_support/db/fixtures/urbanities.csv
|
393
|
-
- lib/test_support/db/fixtures/yearly_anonymous_emissions.csv
|
394
|
-
- lib/test_support/db/fixtures/yearly_typical_emissions.csv
|
395
389
|
- lib/test_support/db/fixtures/zip_codes.csv
|
396
|
-
- lib/test_support/db/schema.rb
|
397
|
-
- vendor/geokit-rails/CHANGELOG.rdoc
|
398
|
-
- vendor/geokit-rails/MIT-LICENSE
|
399
|
-
- vendor/geokit-rails/README.markdown
|
400
|
-
- vendor/geokit-rails/Rakefile
|
401
|
-
- vendor/geokit-rails/about.yml
|
402
|
-
- vendor/geokit-rails/assets/api_keys_template
|
403
|
-
- vendor/geokit-rails/init.rb
|
404
|
-
- vendor/geokit-rails/install.rb
|
405
|
-
- vendor/geokit-rails/lib/geokit-rails.rb
|
406
|
-
- vendor/geokit-rails/lib/geokit-rails/acts_as_mappable.rb
|
407
|
-
- vendor/geokit-rails/lib/geokit-rails/adapters/abstract.rb
|
408
|
-
- vendor/geokit-rails/lib/geokit-rails/adapters/mysql.rb
|
409
|
-
- vendor/geokit-rails/lib/geokit-rails/adapters/postgresql.rb
|
410
|
-
- vendor/geokit-rails/lib/geokit-rails/adapters/sqlserver.rb
|
411
|
-
- vendor/geokit-rails/lib/geokit-rails/defaults.rb
|
412
|
-
- vendor/geokit-rails/lib/geokit-rails/geocoder_control.rb
|
413
|
-
- vendor/geokit-rails/lib/geokit-rails/ip_geocode_lookup.rb
|
414
|
-
- vendor/geokit-rails/test/acts_as_mappable_test.rb
|
415
|
-
- vendor/geokit-rails/test/boot.rb
|
416
|
-
- vendor/geokit-rails/test/database.yml
|
417
|
-
- vendor/geokit-rails/test/fixtures/companies.yml
|
418
|
-
- vendor/geokit-rails/test/fixtures/custom_locations.yml
|
419
|
-
- vendor/geokit-rails/test/fixtures/locations.yml
|
420
|
-
- vendor/geokit-rails/test/fixtures/mock_addresses.yml
|
421
|
-
- vendor/geokit-rails/test/fixtures/mock_families.yml
|
422
|
-
- vendor/geokit-rails/test/fixtures/mock_houses.yml
|
423
|
-
- vendor/geokit-rails/test/fixtures/mock_organizations.yml
|
424
|
-
- vendor/geokit-rails/test/fixtures/mock_people.yml
|
425
|
-
- vendor/geokit-rails/test/fixtures/stores.yml
|
426
|
-
- vendor/geokit-rails/test/ip_geocode_lookup_test.rb
|
427
|
-
- vendor/geokit-rails/test/models/company.rb
|
428
|
-
- vendor/geokit-rails/test/models/custom_location.rb
|
429
|
-
- vendor/geokit-rails/test/models/location.rb
|
430
|
-
- vendor/geokit-rails/test/models/mock_address.rb
|
431
|
-
- vendor/geokit-rails/test/models/mock_family.rb
|
432
|
-
- vendor/geokit-rails/test/models/mock_house.rb
|
433
|
-
- vendor/geokit-rails/test/models/mock_organization.rb
|
434
|
-
- vendor/geokit-rails/test/models/mock_person.rb
|
435
|
-
- vendor/geokit-rails/test/models/store.rb
|
436
|
-
- vendor/geokit-rails/test/schema.rb
|
437
|
-
- vendor/geokit-rails/test/tasks.rake
|
438
|
-
- vendor/geokit-rails/test/test_helper.rb
|
439
390
|
- README.markdown
|
440
391
|
- spec/lib/sniff/database_spec.rb
|
441
392
|
- spec/spec_helper.rb
|
442
|
-
- spec/spec.opts
|
443
393
|
has_rdoc: true
|
444
394
|
homepage: http://github.com/brighterplanet/sniff
|
445
395
|
licenses: []
|
@@ -477,16 +427,3 @@ summary: Test support for Brighter Planet carbon gems
|
|
477
427
|
test_files:
|
478
428
|
- spec/lib/sniff/database_spec.rb
|
479
429
|
- spec/spec_helper.rb
|
480
|
-
- lib/test_support/data_models/census_division.rb
|
481
|
-
- lib/test_support/data_models/census_region.rb
|
482
|
-
- lib/test_support/data_models/climate_division.rb
|
483
|
-
- lib/test_support/data_models/country.rb
|
484
|
-
- lib/test_support/data_models/egrid_region.rb
|
485
|
-
- lib/test_support/data_models/egrid_subregion.rb
|
486
|
-
- lib/test_support/data_models/gender.rb
|
487
|
-
- lib/test_support/data_models/petroleum_administration_for_defense_district.rb
|
488
|
-
- lib/test_support/data_models/state.rb
|
489
|
-
- lib/test_support/data_models/urbanity.rb
|
490
|
-
- lib/test_support/data_models/zip_code.rb
|
491
|
-
- lib/test_support/db/schema.rb
|
492
|
-
- spec/spec.opts
|