automobile_trip 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Rakefile +8 -66
- data/automobile_trip.gemspec +13 -11
- data/features/automobile_trip_committees.feature +94 -48
- data/features/automobile_trip_emissions.feature +29 -24
- data/features/support/env.rb +1 -1
- data/lib/automobile_trip.rb +1 -1
- data/lib/automobile_trip/carbon_model.rb +99 -85
- data/lib/automobile_trip/characterization.rb +2 -1
- data/lib/automobile_trip/data.rb +1 -0
- data/lib/automobile_trip/fallback.rb +1 -6
- data/lib/automobile_trip/relationships.rb +1 -0
- data/lib/automobile_trip/version.rb +1 -1
- data/lib/test_support/db/fixtures/automobile_fuels.csv +4 -4
- data/lib/test_support/db/fixtures/automobile_make_model_year_variants.csv +1 -1
- data/lib/test_support/db/fixtures/automobile_type_fuel_year_ages.csv +3 -0
- data/lib/test_support/db/fixtures/countries.csv +2 -0
- data/lib/test_support/db/fixtures/fuels.csv +0 -1
- metadata +19 -39
- data/Gemfile.lock +0 -200
@@ -4,6 +4,7 @@ module BrighterPlanet
|
|
4
4
|
def self.included(base)
|
5
5
|
base.characterize do
|
6
6
|
has :date
|
7
|
+
has :country
|
7
8
|
has :make
|
8
9
|
has :make_year
|
9
10
|
has :make_model
|
@@ -23,7 +24,7 @@ module BrighterPlanet
|
|
23
24
|
has :distance
|
24
25
|
has :fuel_use
|
25
26
|
has :automobile_fuel # don't call this fuel b/c then if you specify fuel.name in tests sniff will try to look it up in the fuels fixture, not automobile_fuels
|
26
|
-
has
|
27
|
+
has(:mapquest_api_key) { 'secret key' }
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
data/lib/automobile_trip/data.rb
CHANGED
@@ -2,12 +2,7 @@ module BrighterPlanet
|
|
2
2
|
module AutomobileTrip
|
3
3
|
module Fallback
|
4
4
|
def self.included(base)
|
5
|
-
base.falls_back_on :
|
6
|
-
:city_speed => 19.9.miles.to(:kilometres),
|
7
|
-
:highway_speed => 57.1.miles.to(:kilometres),
|
8
|
-
:hybridity_multiplier => 1.0,
|
9
|
-
:fuel_efficiency => 20.182.miles_per_gallon.to(:kilometres_per_litre),
|
10
|
-
:distance => 10.15.miles.to(:kilometres)
|
5
|
+
base.falls_back_on :hybridity_multiplier => 1.0,
|
11
6
|
end
|
12
7
|
end
|
13
8
|
end
|
@@ -2,6 +2,7 @@ module BrighterPlanet
|
|
2
2
|
module AutomobileTrip
|
3
3
|
module Relationships
|
4
4
|
def self.included(target)
|
5
|
+
target.belongs_to :country, :class_name => 'Country', :foreign_key => 'country_iso_3166_code'
|
5
6
|
target.belongs_to :make, :class_name => 'AutomobileMake', :foreign_key => 'make_name'
|
6
7
|
target.belongs_to :make_year, :class_name => 'AutomobileMakeYear', :foreign_key => 'make_year_name'
|
7
8
|
target.belongs_to :make_model, :class_name => 'AutomobileMakeModel', :foreign_key => 'make_model_name'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
name,code,
|
2
|
-
regular gasoline,R,
|
3
|
-
diesel,D,
|
4
|
-
B20,BP-B20,
|
1
|
+
name,code,co2_emission_factor,co2_emission_factor_units,co2_biogenic_emission_factor,co2_biogenic_emission_factor_units,ch4_emission_factor,ch4_emission_factor_units,n2o_emission_factor,n2o_emission_factor_units,hfc_emission_factor,hfc_emission_factor_units
|
2
|
+
regular gasoline,R,2.3,kilograms_co2_per_litre,0,kilograms_co2_per_litre,0.002,kilograms_co2e_per_litre,0.008,kilograms_co2e_per_litre,0.1,kilograms_co2e_per_litre
|
3
|
+
diesel,D,2.7,kilograms_co2_per_litre,0,kilograms_co2_per_litre,0.0001,kilograms_co2e_per_litre,0.002,kilograms_co2e_per_litre,0.12,kilograms_co2e_per_litre
|
4
|
+
B20,BP-B20,2.2,kilograms_co2_per_litre,0.5,kilograms_co2_per_litre,0.0001,kilograms_co2e_per_litre,0.002,kilograms_co2e_per_litre,0.12,kilograms_co2e_per_litre
|
@@ -1,2 +1,2 @@
|
|
1
1
|
row_hash,name,make_name,make_year_name,make_model_name,make_model_year_name,year,fuel_efficiency_city,fuel_efficiency_city_units,fuel_efficiency_highway,fuel_efficiency_highway_units,fuel_code
|
2
|
-
xxx1,Prius,Toyota,Toyota 2003,Toyota Prius,Toyota Prius 2003,2003,50,kilometres_per_litre,40,kilometres_per_litre,
|
2
|
+
xxx1,Prius,Toyota,Toyota 2003,Toyota Prius,Toyota Prius 2003,2003,50,kilometres_per_litre,40,kilometres_per_litre,D
|
@@ -0,0 +1,2 @@
|
|
1
|
+
iso_3166_code,name,automobile_urbanity,automobile_fuel_efficiency,automobile_fuel_efficiency_units,automobile_city_speed,automobile_city_speed_units,automobile_highway_speed,automobile_highway_speed_units,automobile_trip_distance,automobile_trip_distance_units,
|
2
|
+
US,United States,0.43,9,kilometres_per_litre,32,kilometres_per_hour,92,kilometres_per_hour,16,kilometres
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: automobile_trip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 0.1.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.2.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Andy Rossmeissl
|
@@ -18,65 +14,45 @@ autorequire:
|
|
18
14
|
bindir: bin
|
19
15
|
cert_chain: []
|
20
16
|
|
21
|
-
date: 2011-02
|
17
|
+
date: 2011-06-02 00:00:00 -05:00
|
22
18
|
default_executable:
|
23
19
|
dependencies:
|
24
20
|
- !ruby/object:Gem::Dependency
|
25
21
|
name: sniff
|
26
|
-
prerelease: false
|
27
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
28
23
|
none: false
|
29
24
|
requirements:
|
30
|
-
- -
|
25
|
+
- - ">="
|
31
26
|
- !ruby/object:Gem::Version
|
32
|
-
|
33
|
-
- 0
|
34
|
-
- 6
|
35
|
-
- 0
|
36
|
-
version: 0.6.0
|
27
|
+
version: 0.8.0
|
37
28
|
type: :development
|
29
|
+
prerelease: false
|
38
30
|
version_requirements: *id001
|
39
31
|
- !ruby/object:Gem::Dependency
|
40
32
|
name: emitter
|
41
|
-
prerelease: false
|
42
33
|
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
|
-
requirements:
|
45
|
-
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
segments:
|
48
|
-
- 0
|
49
|
-
- 4
|
50
|
-
- 1
|
51
|
-
version: 0.4.1
|
52
|
-
type: :runtime
|
53
|
-
version_requirements: *id002
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: geokit
|
56
|
-
prerelease: false
|
57
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
58
34
|
none: false
|
59
35
|
requirements:
|
60
36
|
- - ">="
|
61
37
|
- !ruby/object:Gem::Version
|
62
|
-
|
63
|
-
- 0
|
64
|
-
version: "0"
|
38
|
+
version: 0.5.0
|
65
39
|
type: :runtime
|
66
|
-
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: *id002
|
67
42
|
description: A software model in Ruby for the greenhouse gas emissions of an automobile trip
|
68
43
|
email: andy@rossmeissl.net
|
69
44
|
executables: []
|
70
45
|
|
71
46
|
extensions: []
|
72
47
|
|
73
|
-
extra_rdoc_files:
|
74
|
-
|
48
|
+
extra_rdoc_files:
|
49
|
+
- LICENSE
|
50
|
+
- LICENSE-PREAMBLE
|
51
|
+
- README.rdoc
|
75
52
|
files:
|
76
53
|
- .document
|
77
54
|
- .gitignore
|
78
55
|
- Gemfile
|
79
|
-
- Gemfile.lock
|
80
56
|
- LICENSE
|
81
57
|
- LICENSE-PREAMBLE
|
82
58
|
- README.rdoc
|
@@ -105,8 +81,10 @@ files:
|
|
105
81
|
- lib/test_support/db/fixtures/automobile_make_years.csv
|
106
82
|
- lib/test_support/db/fixtures/automobile_makes.csv
|
107
83
|
- lib/test_support/db/fixtures/automobile_size_classes.csv
|
84
|
+
- lib/test_support/db/fixtures/automobile_type_fuel_year_ages.csv
|
108
85
|
- lib/test_support/db/fixtures/automobile_type_fuel_years.csv
|
109
86
|
- lib/test_support/db/fixtures/automobile_type_years.csv
|
87
|
+
- lib/test_support/db/fixtures/countries.csv
|
110
88
|
- lib/test_support/db/fixtures/fuel_years.csv
|
111
89
|
- lib/test_support/db/fixtures/fuels.csv
|
112
90
|
- lib/test_support/db/fixtures/greenhouse_gases.csv
|
@@ -119,7 +97,7 @@ files:
|
|
119
97
|
- vendor/plugin/mapquest/spec/lib/mapquest_directions_spec.rb
|
120
98
|
- vendor/plugin/mapquest/spec/spec_helper.rb
|
121
99
|
has_rdoc: true
|
122
|
-
homepage:
|
100
|
+
homepage: https://github.com/brighterplanet/automobile_trip
|
123
101
|
licenses: []
|
124
102
|
|
125
103
|
post_install_message:
|
@@ -132,6 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
110
|
requirements:
|
133
111
|
- - ">="
|
134
112
|
- !ruby/object:Gem::Version
|
113
|
+
hash: 703293003608571182
|
135
114
|
segments:
|
136
115
|
- 0
|
137
116
|
version: "0"
|
@@ -140,13 +119,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
119
|
requirements:
|
141
120
|
- - ">="
|
142
121
|
- !ruby/object:Gem::Version
|
122
|
+
hash: 703293003608571182
|
143
123
|
segments:
|
144
124
|
- 0
|
145
125
|
version: "0"
|
146
126
|
requirements: []
|
147
127
|
|
148
128
|
rubyforge_project:
|
149
|
-
rubygems_version: 1.
|
129
|
+
rubygems_version: 1.6.2
|
150
130
|
signing_key:
|
151
131
|
specification_version: 3
|
152
132
|
summary: A carbon model
|
data/Gemfile.lock
DELETED
@@ -1,200 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
automobile_trip (0.1.0)
|
5
|
-
emitter (~> 0.4.1)
|
6
|
-
geokit
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
aaronh-chronic (0.3.9)
|
12
|
-
activemodel (3.0.4)
|
13
|
-
activesupport (= 3.0.4)
|
14
|
-
builder (~> 2.1.2)
|
15
|
-
i18n (~> 0.4)
|
16
|
-
activerecord (3.0.4)
|
17
|
-
activemodel (= 3.0.4)
|
18
|
-
activesupport (= 3.0.4)
|
19
|
-
arel (~> 2.0.2)
|
20
|
-
tzinfo (~> 0.3.23)
|
21
|
-
activesupport (3.0.4)
|
22
|
-
amatch (0.2.5)
|
23
|
-
andand (1.3.1)
|
24
|
-
arel (2.0.8)
|
25
|
-
blockenspiel (0.4.1)
|
26
|
-
bueller (0.0.4)
|
27
|
-
bundler (~> 1.0.9)
|
28
|
-
git (>= 1.2.5)
|
29
|
-
rake
|
30
|
-
builder (2.1.2)
|
31
|
-
characterizable (0.1.2)
|
32
|
-
activesupport (>= 2.3.5)
|
33
|
-
blockenspiel (>= 0.3.2)
|
34
|
-
cohort_scope (0.1.4)
|
35
|
-
activerecord (>= 3.0.0.beta4)
|
36
|
-
activesupport (>= 3.0.0.beta4)
|
37
|
-
common_name (0.1.5)
|
38
|
-
activesupport (>= 2.3.4)
|
39
|
-
conversions (1.4.5)
|
40
|
-
activesupport (>= 2.3.4)
|
41
|
-
cucumber (0.10.0)
|
42
|
-
builder (>= 2.1.2)
|
43
|
-
diff-lcs (~> 1.1.2)
|
44
|
-
gherkin (~> 2.3.2)
|
45
|
-
json (~> 1.4.6)
|
46
|
-
term-ansicolor (~> 1.0.5)
|
47
|
-
data_miner (1.1.4)
|
48
|
-
activerecord (>= 2.3.4)
|
49
|
-
activesupport (>= 2.3.4)
|
50
|
-
blockenspiel (>= 0.3.2)
|
51
|
-
conversions (>= 1.4.4)
|
52
|
-
errata (>= 1.0.1)
|
53
|
-
escape (>= 0.0.4)
|
54
|
-
remote_table (>= 1.1.0)
|
55
|
-
taps (>= 0.3.11)
|
56
|
-
diff-lcs (1.1.2)
|
57
|
-
earth (0.4.0)
|
58
|
-
activerecord (~> 3)
|
59
|
-
cohort_scope (>= 0.0.7)
|
60
|
-
conversions (>= 1.4.5)
|
61
|
-
data_miner (~> 1.1.1)
|
62
|
-
errata
|
63
|
-
falls_back_on (>= 0.0.3)
|
64
|
-
geokit (>= 1.5.0)
|
65
|
-
geokit-rails
|
66
|
-
loose_tight_dictionary (>= 0.0.8)
|
67
|
-
weighted_average (>= 0.0.4)
|
68
|
-
emitter (0.4.1)
|
69
|
-
activesupport (>= 2.3.4)
|
70
|
-
characterizable
|
71
|
-
cohort_scope
|
72
|
-
data_miner (>= 1.1)
|
73
|
-
earth
|
74
|
-
falls_back_on
|
75
|
-
leap
|
76
|
-
summary_judgement
|
77
|
-
timeframe
|
78
|
-
weighted_average
|
79
|
-
errata (1.0.1)
|
80
|
-
activesupport (>= 2.3.4)
|
81
|
-
remote_table (~> 1)
|
82
|
-
escape (0.0.4)
|
83
|
-
falls_back_on (0.0.3)
|
84
|
-
activerecord
|
85
|
-
fast_timestamp (0.0.4)
|
86
|
-
fastercsv (1.5.4)
|
87
|
-
geokit (1.5.0)
|
88
|
-
geokit-rails (1.1.4)
|
89
|
-
geokit (>= 1.5.0)
|
90
|
-
gherkin (2.3.3)
|
91
|
-
json (~> 1.4.6)
|
92
|
-
git (1.2.5)
|
93
|
-
google-spreadsheet-ruby (0.1.2)
|
94
|
-
nokogiri (>= 1.4.3.1)
|
95
|
-
oauth (>= 0.3.6)
|
96
|
-
i18n (0.5.0)
|
97
|
-
json (1.4.6)
|
98
|
-
leap (0.4.6)
|
99
|
-
activesupport (>= 2.3.4)
|
100
|
-
blockenspiel (>= 0.3.2)
|
101
|
-
builder
|
102
|
-
i18n
|
103
|
-
loose_tight_dictionary (0.0.9)
|
104
|
-
activesupport (>= 2.3.4)
|
105
|
-
amatch (>= 0.2.5)
|
106
|
-
andand (>= 1.3.1)
|
107
|
-
mime-types (1.16)
|
108
|
-
mustache (0.12.0)
|
109
|
-
nokogiri (1.4.4)
|
110
|
-
oauth (0.4.4)
|
111
|
-
rack (1.2.1)
|
112
|
-
rake (0.8.7)
|
113
|
-
rcov (0.9.9)
|
114
|
-
rdiscount (1.6.8)
|
115
|
-
rdoc (3.5.3)
|
116
|
-
remote_table (1.1.0)
|
117
|
-
activesupport (>= 2.3.4)
|
118
|
-
builder
|
119
|
-
escape (>= 0.0.4)
|
120
|
-
fastercsv (>= 1.5.0)
|
121
|
-
google-spreadsheet-ruby
|
122
|
-
i18n
|
123
|
-
nokogiri (>= 1.4.1)
|
124
|
-
roo (~> 1.9)
|
125
|
-
slither (>= 0.99.4)
|
126
|
-
spreadsheet
|
127
|
-
zip
|
128
|
-
rest-client (1.6.1)
|
129
|
-
mime-types (>= 1.16)
|
130
|
-
rocco (0.5)
|
131
|
-
mustache
|
132
|
-
rdiscount
|
133
|
-
roo (1.9.3)
|
134
|
-
rspec (2.0.1)
|
135
|
-
rspec-core (~> 2.0.1)
|
136
|
-
rspec-expectations (~> 2.0.1)
|
137
|
-
rspec-mocks (~> 2.0.1)
|
138
|
-
rspec-core (2.0.1)
|
139
|
-
rspec-expectations (2.0.1)
|
140
|
-
diff-lcs (>= 1.1.2)
|
141
|
-
rspec-mocks (2.0.1)
|
142
|
-
rspec-core (~> 2.0.1)
|
143
|
-
rspec-expectations (~> 2.0.1)
|
144
|
-
ruby-ole (1.2.11.1)
|
145
|
-
sequel (3.17.0)
|
146
|
-
sinatra (1.0)
|
147
|
-
rack (>= 1.0)
|
148
|
-
slither (0.99.4)
|
149
|
-
sniff (0.6.1)
|
150
|
-
aaronh-chronic (~> 0.3.9)
|
151
|
-
activerecord (~> 3.0.0)
|
152
|
-
activesupport (~> 3.0.0)
|
153
|
-
bueller (~> 0.0.4)
|
154
|
-
common_name (~> 0.1.5)
|
155
|
-
cucumber (~> 0.10.0)
|
156
|
-
earth
|
157
|
-
fast_timestamp (~> 0.0.4)
|
158
|
-
rake
|
159
|
-
rcov
|
160
|
-
rdoc
|
161
|
-
rocco
|
162
|
-
rspec (~> 2.0.0)
|
163
|
-
sqlite3-ruby (~> 1.3.0)
|
164
|
-
timecop
|
165
|
-
timeframe (~> 0.0.8)
|
166
|
-
spreadsheet (0.6.5.2)
|
167
|
-
ruby-ole (>= 1.0)
|
168
|
-
sqlite3 (1.3.3)
|
169
|
-
sqlite3-ruby (1.3.3)
|
170
|
-
sqlite3 (>= 1.3.3)
|
171
|
-
summary_judgement (1.3.8)
|
172
|
-
activesupport (>= 2.3.4)
|
173
|
-
verbs (>= 2.0.6)
|
174
|
-
taps (0.3.15)
|
175
|
-
json (~> 1.4.6)
|
176
|
-
rack (>= 1.0.1)
|
177
|
-
rest-client (>= 1.4.0, < 1.7.0)
|
178
|
-
sequel (~> 3.17.0)
|
179
|
-
sinatra (~> 1.0.0)
|
180
|
-
sqlite3-ruby (~> 1.2)
|
181
|
-
term-ansicolor (1.0.5)
|
182
|
-
timecop (0.3.5)
|
183
|
-
timeframe (0.0.8)
|
184
|
-
activesupport (>= 2.3.5)
|
185
|
-
tzinfo (0.3.24)
|
186
|
-
verbs (2.0.9)
|
187
|
-
activesupport (>= 2.3.4)
|
188
|
-
andand (>= 1.3.1)
|
189
|
-
weighted_average (0.0.6)
|
190
|
-
activerecord (~> 3)
|
191
|
-
arel (~> 2)
|
192
|
-
zip (2.0.2)
|
193
|
-
|
194
|
-
PLATFORMS
|
195
|
-
ruby
|
196
|
-
|
197
|
-
DEPENDENCIES
|
198
|
-
automobile_trip!
|
199
|
-
roo (~> 1.9.3)
|
200
|
-
sniff (~> 0.6.0)
|