automobile 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -20
- data/README.rdoc +17 -17
- data/features/automobile_committees.feature +21 -0
- data/features/automobile_emissions.feature +14 -0
- data/features/support/env.rb +8 -0
- data/lib/automobile.rb +25 -204
- data/lib/automobile/carbon_model.rb +212 -0
- data/lib/automobile/characterization.rb +42 -0
- data/lib/automobile/data.rb +38 -0
- data/lib/automobile/summarization.rb +18 -0
- data/lib/test_support/automobile_record.rb +29 -0
- data/lib/test_support/db/schema.rb +24 -0
- metadata +273 -25
- data/.document +0 -5
- data/.gitignore +0 -21
- data/Rakefile +0 -55
- data/VERSION +0 -1
- data/automobile.gemspec +0 -60
- data/test/helper.rb +0 -10
- data/test/test_automobile.rb +0 -7
data/LICENSE
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright (c) 2009 Andy Rossmeissl
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2009 Andy Rossmeissl
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
= automobile
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Note on Patches/Pull Requests
|
6
|
-
|
7
|
-
* Fork the project.
|
8
|
-
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
future version unintentionally.
|
11
|
-
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
-
* Send me a pull request. Bonus points for topic branches.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2010 Andy Rossmeissl. See LICENSE for details.
|
1
|
+
= automobile
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Andy Rossmeissl. See LICENSE for details.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Automobile Committee Calculations
|
2
|
+
The automobile model should generate correct committee calculations
|
3
|
+
|
4
|
+
Scenario Outline: Acquisition committee
|
5
|
+
Given an automobile has "acquisition" of "<acquisition>"
|
6
|
+
And it has "model_year.name" "<make_model_year>"
|
7
|
+
When emissions are calculated
|
8
|
+
Then the acquisition committee should be exactly <acquisition_committee>
|
9
|
+
Examples:
|
10
|
+
| make_model_year | acquisition | acquisition_committee |
|
11
|
+
| | 2007-01-30 | 2007-01-30 |
|
12
|
+
| Honda FIT 2008 | | 2010-01-01 |
|
13
|
+
|
14
|
+
Scenario Outline: Retirement committees
|
15
|
+
Given an automobile has "acquisition" of "<acquisition>"
|
16
|
+
And it has "model_year.name" "<make_model_year>"
|
17
|
+
When emissions are calculated
|
18
|
+
Then the retirement committee should be exactly <retirement_committee>
|
19
|
+
Examples:
|
20
|
+
| acquisition | retirement | retirement_committee |
|
21
|
+
| 2007-01-30 | 2009-03-04 | 2011-01-01 |
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Automobile Emissions Calculations
|
2
|
+
The automobile model should generate correct emission calculations
|
3
|
+
|
4
|
+
Scenario Outline: Standard Calculations for automobiles
|
5
|
+
Given an automobile has "annual_distance_estimate" of "<annual_distance>"
|
6
|
+
And it has "model_year.name" "<make_model_year>"
|
7
|
+
And it has "acquisition" "<acquisition>"
|
8
|
+
And it has "retirement" "<retirement>"
|
9
|
+
When emissions are calculated
|
10
|
+
Then the emission value should be within 0.1 kgs of <emission>
|
11
|
+
Examples:
|
12
|
+
| annual_distance | make_model_year | acquisition | retirement | emission |
|
13
|
+
| 30000 | Acura RSX 2003 | 2008-01-30 | 2009-05-15 | 123 |
|
14
|
+
| 30000 | Honda FIT 2008 | 2008-01-30 | 2009-05-15 | 123 |
|
data/lib/automobile.rb
CHANGED
@@ -1,209 +1,30 @@
|
|
1
|
-
require 'conversions'
|
2
|
-
|
3
1
|
module BrighterPlanet
|
4
2
|
module Automobile
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
committee :fuel_consumed do # returns litres
|
33
|
-
quorum 'from adjusted fuel_efficiency and distance', :needs => [:adjusted_fuel_efficiency, :distance] do |characteristics|
|
34
|
-
characteristics[:distance] / characteristics[:adjusted_fuel_efficiency]
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
committee :distance do # returns kilometres
|
39
|
-
quorum 'from annual distance', :needs => [:annual_distance, :active_subtimeframe] do |characteristics, timeframe|
|
40
|
-
characteristics[:annual_distance] * (characteristics[:active_subtimeframe] / timeframe.year)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
committee :annual_distance do # returns kilometres
|
45
|
-
quorum 'from annual distance estimate', :needs => :annual_distance_estimate do |characteristics|
|
46
|
-
characteristics[:annual_distance_estimate]
|
47
|
-
end
|
48
|
-
|
49
|
-
quorum 'from weekly distance estimate', :needs => :weekly_distance_estimate do |characteristics, timeframe|
|
50
|
-
(characteristics[:weekly_distance_estimate] / 7 ) * timeframe.year.days
|
51
|
-
end
|
52
|
-
|
53
|
-
quorum 'from daily distance', :needs => :daily_distance do |characteristics, timeframe|
|
54
|
-
characteristics[:daily_distance] * timeframe.year.days
|
55
|
-
end
|
56
|
-
|
57
|
-
quorum 'from size class', :needs => :size_class do |characteristics|
|
58
|
-
characteristics[:size_class].annual_distance
|
59
|
-
end
|
60
|
-
|
61
|
-
quorum 'from fuel type', :needs => :fuel_type do |characteristics|
|
62
|
-
characteristics[:fuel_type].annual_distance
|
63
|
-
end
|
64
|
-
|
65
|
-
quorum 'default' do
|
66
|
-
::Automobile.fallback.annual_distance_estimate
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
committee :daily_distance do # returns kilometres
|
71
|
-
quorum 'from daily distance estimate', :needs => :daily_distance_estimate do |characteristics|
|
72
|
-
characteristics[:daily_distance_estimate]
|
73
|
-
end
|
74
|
-
|
75
|
-
quorum 'from daily duration', :needs => [:daily_duration, :speed] do |characteristics|
|
76
|
-
characteristics[:daily_duration] * characteristics[:speed]
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
committee :adjusted_fuel_efficiency do # returns kilometres per litre
|
81
|
-
quorum 'from fuel efficiency', :needs => :fuel_efficiency do |characteristics|
|
82
|
-
characteristics[:fuel_efficiency]
|
83
|
-
end
|
84
|
-
|
85
|
-
quorum 'from variant', :needs => [:variant, :urbanity] do |characteristics|
|
86
|
-
fuel_efficiencies = characteristics[:variant].attributes.symbolize_keys.slice(:fuel_efficiency_city, :fuel_efficiency_highway)
|
87
|
-
urbanity = characteristics[:urbanity]
|
88
|
-
1.0 / ((urbanity / fuel_efficiencies[:fuel_efficiency_city].to_f) + ((1.0 - urbanity) / fuel_efficiencies[:fuel_efficiency_highway].to_f))
|
89
|
-
end
|
90
|
-
|
91
|
-
quorum 'from nominal fuel efficiency and multiplier', :needs => [:nominal_fuel_efficiency, :fuel_efficiency_multiplier] do |characteristics|
|
92
|
-
characteristics[:nominal_fuel_efficiency] * characteristics[:fuel_efficiency_multiplier]
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
committee :fuel_efficiency_multiplier do # returns coefficient
|
97
|
-
quorum 'from_size_class_and_hybridity', :needs => [:size_class, :hybridity, :urbanity] do |characteristics|
|
98
|
-
drivetrain = characteristics[:hybridity] ? :hybrid : :conventional
|
99
|
-
urbanity = characteristics[:urbanity]
|
100
|
-
size_class = characteristics[:size_class]
|
101
|
-
fuel_efficiency_multipliers = {
|
102
|
-
:city => size_class.send(:"#{drivetrain}_fuel_efficiency_city_multiplier"),
|
103
|
-
:highway => size_class.send(:"#{drivetrain}_fuel_efficiency_highway_multiplier")
|
104
|
-
}
|
105
|
-
if fuel_efficiency_multipliers.values.any?(&:nil?)
|
106
|
-
nil
|
107
|
-
else
|
108
|
-
1.0 / ((urbanity / fuel_efficiency_multipliers[:city]) + ((1.0 - urbanity) / fuel_efficiency_multipliers[:highway]))
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
quorum 'from hybridity', :needs => [:hybridity, :urbanity] do |characteristics|
|
113
|
-
drivetrain = characteristics[:hybridity] ? :hybrid : :conventional
|
114
|
-
urbanity = characteristics[:urbanity]
|
115
|
-
fuel_efficiency_multipliers = {
|
116
|
-
:city => AutomobileSizeClass.fallback.send(:"#{drivetrain}_fuel_efficiency_city_multiplier"),
|
117
|
-
:highway => AutomobileSizeClass.fallback.send(:"#{drivetrain}_fuel_efficiency_highway_multiplier")
|
118
|
-
}
|
119
|
-
1.0 / ((urbanity / fuel_efficiency_multipliers[:city]) + ((1.0 - urbanity) / fuel_efficiency_multipliers[:highway]))
|
120
|
-
end
|
121
|
-
|
122
|
-
quorum 'default' do
|
123
|
-
1.0
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
committee :nominal_fuel_efficiency do # returns kilometres per litre **OR** (FIXME) kilometres per kWh
|
128
|
-
quorum 'from model', :needs => [:model, :urbanity] do |characteristics|
|
129
|
-
fuel_efficiency_city = characteristics[:model].fuel_efficiency_city.to_f
|
130
|
-
fuel_efficiency_highway = characteristics[:model].fuel_efficiency_highway.to_f
|
131
|
-
urbanity = characteristics[:urbanity]
|
132
|
-
1.0 / ((urbanity / fuel_efficiency_city) + ((1.0 - urbanity) / fuel_efficiency_highway))
|
133
|
-
end
|
134
|
-
|
135
|
-
quorum 'from make and model year', :needs => [:model_year] do |characteristics|
|
136
|
-
characteristics[:model_year].make_year.andand.fuel_efficiency
|
137
|
-
end
|
138
|
-
|
139
|
-
quorum 'from size class', :needs => [:size_class, :urbanity] do |characteristics|
|
140
|
-
fuel_efficiencies = characteristics[:size_class].attributes.symbolize_keys.slice(:fuel_efficiency_city, :fuel_efficiency_highway)
|
141
|
-
urbanity = characteristics[:urbanity]
|
142
|
-
1.0 / ((urbanity / fuel_efficiencies[:fuel_efficiency_city].to_f) + ((1.0 - urbanity) / fuel_efficiencies[:fuel_efficiency_highway].to_f))
|
143
|
-
end
|
144
|
-
|
145
|
-
quorum 'from model year', :needs => :model_year do |characteristics|
|
146
|
-
characteristics[:model_year].fuel_efficiency
|
147
|
-
end
|
148
|
-
|
149
|
-
quorum 'from make', :needs => :make do |characteristics|
|
150
|
-
characteristics[:make].fuel_efficiency
|
151
|
-
end
|
152
|
-
|
153
|
-
quorum 'default' do
|
154
|
-
::Automobile.fallback.fuel_efficiency
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
committee :speed do # returns kilometres per hour
|
159
|
-
quorum 'from urbanity', :needs => :urbanity do |characteristics|
|
160
|
-
1 / (characteristics[:urbanity] / ::BrighterPlanet::Automobile::SPEEDS[:city] + (1 - characteristics[:urbanity]) / ::BrighterPlanet::Automobile::SPEEDS[:highway])
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
committee :urbanity do
|
165
|
-
quorum 'default' do
|
166
|
-
::Automobile.fallback.urbanity
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
committee :fuel_type do
|
171
|
-
quorum 'from variant', :needs => :variant do |characteristics|
|
172
|
-
characteristics[:variant].fuel_type
|
173
|
-
end
|
174
|
-
|
175
|
-
quorum 'default' do
|
176
|
-
::Automobile.fallback.fuel_type
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
committee :active_subtimeframe do
|
181
|
-
quorum 'from acquisition and retirement', :needs => [:acquisition, :retirement] do |characteristics, timeframe|
|
182
|
-
Timeframe.constrained_new characteristics[:acquisition].to_date, characteristics[:retirement].to_date, timeframe
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
committee :acquisition do
|
187
|
-
quorum 'from model year or year', :appreciates => [:model_year, :year] do |characteristics|
|
188
|
-
puts characteristics.inspect
|
189
|
-
!characteristics.empty? && Date.new((characteristics[:model_year].andand.year || characteristics[:year]).to_i - 1, 1, 1)
|
190
|
-
end
|
191
|
-
quorum 'from retirement', :appreciates => :retirement do |characteristics, timeframe|
|
192
|
-
[ timeframe.from, characteristics[:retirement] ].compact.min
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
committee :retirement do
|
197
|
-
quorum 'from acquisition', :appreciates => :acquisition do |characteristics, timeframe|
|
198
|
-
[ timeframe.to, characteristics[:acquisition] ].compact.max
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def included(base)
|
6
|
+
require 'cohort_scope'
|
7
|
+
require 'falls_back_on'
|
8
|
+
require 'falls_back_on/active_record_ext'
|
9
|
+
|
10
|
+
require 'automobile/carbon_model'
|
11
|
+
require 'automobile/characterization'
|
12
|
+
require 'automobile/data'
|
13
|
+
require 'automobile/summarization'
|
14
|
+
|
15
|
+
base.send :include, BrighterPlanet::Automobile::CarbonModel
|
16
|
+
base.send :include, BrighterPlanet::Automobile::Data
|
17
|
+
base.send :include, BrighterPlanet::Automobile::Summarization
|
18
|
+
base.send :include, BrighterPlanet::Automobile::Characterization
|
19
|
+
end
|
20
|
+
def automobile_model
|
21
|
+
if Object.const_defined? 'Automobile'
|
22
|
+
::Automobile
|
23
|
+
elsif Object.const_defined? 'AutomobileRecord'
|
24
|
+
AutomobileRecord
|
25
|
+
else
|
26
|
+
raise 'There is no automobile model'
|
202
27
|
end
|
203
28
|
end
|
204
|
-
SPEEDS = {
|
205
|
-
:highway => 57.1.miles.to(:kilometres), # https://brighterplanet.sifterapp.com/projects/30/issues/428
|
206
|
-
:city => 19.9.miles.to(:kilometres) # https://brighterplanet.sifterapp.com/projects/30/issues/428
|
207
|
-
}
|
208
29
|
end
|
209
|
-
end
|
30
|
+
end
|
@@ -0,0 +1,212 @@
|
|
1
|
+
require 'leap'
|
2
|
+
require 'conversions'
|
3
|
+
|
4
|
+
module BrighterPlanet
|
5
|
+
module Automobile
|
6
|
+
module CarbonModel
|
7
|
+
def self.included(base)
|
8
|
+
base.extend ::Leap::Subject
|
9
|
+
base.decide :emission, :with => :characteristics do
|
10
|
+
committee :emission do # returns kg CO2
|
11
|
+
quorum 'from fuel', :needs => [:fuel_consumed, :emission_factor], :appreciates => :fuel_type do |characteristics|
|
12
|
+
if characteristics[:fuel_type].andand.code == AutomobileFuelType::CODES[:electricity]
|
13
|
+
0.0 # FIXME waiting for fuel_efficiency values in kilometres per kWh from fuel_efficiency
|
14
|
+
else
|
15
|
+
characteristics[:fuel_consumed] * characteristics[:emission_factor]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
quorum 'default' do
|
20
|
+
raise "The emission committee's default quorum should never be called"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
committee :emission_factor do # returns kilograms CO2 per litre **OR** kilograms CO2 per litre
|
25
|
+
quorum 'from fuel type', :needs => :fuel_type do |characteristics|
|
26
|
+
characteristics[:fuel_type].emission_factor
|
27
|
+
end
|
28
|
+
|
29
|
+
quorum 'default' do
|
30
|
+
AutomobileFuelType.fallback.emission_factor
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
committee :fuel_consumed do # returns litres
|
35
|
+
quorum 'from adjusted fuel_efficiency and distance', :needs => [:adjusted_fuel_efficiency, :distance] do |characteristics|
|
36
|
+
characteristics[:distance] / characteristics[:adjusted_fuel_efficiency]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
committee :distance do # returns kilometres
|
41
|
+
quorum 'from annual distance', :needs => [:annual_distance, :active_subtimeframe] do |characteristics, timeframe|
|
42
|
+
characteristics[:annual_distance] * (characteristics[:active_subtimeframe] / timeframe.year)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
committee :annual_distance do # returns kilometres
|
47
|
+
quorum 'from annual distance estimate', :needs => :annual_distance_estimate do |characteristics|
|
48
|
+
characteristics[:annual_distance_estimate]
|
49
|
+
end
|
50
|
+
|
51
|
+
quorum 'from weekly distance estimate', :needs => :weekly_distance_estimate do |characteristics, timeframe|
|
52
|
+
(characteristics[:weekly_distance_estimate] / 7 ) * timeframe.year.days
|
53
|
+
end
|
54
|
+
|
55
|
+
quorum 'from daily distance', :needs => :daily_distance do |characteristics, timeframe|
|
56
|
+
characteristics[:daily_distance] * timeframe.year.days
|
57
|
+
end
|
58
|
+
|
59
|
+
quorum 'from size class', :needs => :size_class do |characteristics|
|
60
|
+
characteristics[:size_class].annual_distance
|
61
|
+
end
|
62
|
+
|
63
|
+
quorum 'from fuel type', :needs => :fuel_type do |characteristics|
|
64
|
+
characteristics[:fuel_type].annual_distance
|
65
|
+
end
|
66
|
+
|
67
|
+
quorum 'default' do
|
68
|
+
Automobile.automobile_model.fallback.annual_distance_estimate
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
committee :daily_distance do # returns kilometres
|
73
|
+
quorum 'from daily distance estimate', :needs => :daily_distance_estimate do |characteristics|
|
74
|
+
characteristics[:daily_distance_estimate]
|
75
|
+
end
|
76
|
+
|
77
|
+
quorum 'from daily duration', :needs => [:daily_duration, :speed] do |characteristics|
|
78
|
+
characteristics[:daily_duration] * characteristics[:speed]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
committee :adjusted_fuel_efficiency do # returns kilometres per litre
|
83
|
+
quorum 'from fuel efficiency', :needs => :fuel_efficiency do |characteristics|
|
84
|
+
characteristics[:fuel_efficiency]
|
85
|
+
end
|
86
|
+
|
87
|
+
quorum 'from variant', :needs => [:variant, :urbanity] do |characteristics|
|
88
|
+
fuel_efficiencies = characteristics[:variant].attributes.symbolize_keys.slice(:fuel_efficiency_city, :fuel_efficiency_highway)
|
89
|
+
urbanity = characteristics[:urbanity]
|
90
|
+
1.0 / ((urbanity / fuel_efficiencies[:fuel_efficiency_city].to_f) + ((1.0 - urbanity) / fuel_efficiencies[:fuel_efficiency_highway].to_f))
|
91
|
+
end
|
92
|
+
|
93
|
+
quorum 'from nominal fuel efficiency and multiplier', :needs => [:nominal_fuel_efficiency, :fuel_efficiency_multiplier] do |characteristics|
|
94
|
+
characteristics[:nominal_fuel_efficiency] * characteristics[:fuel_efficiency_multiplier]
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
committee :fuel_efficiency_multiplier do # returns coefficient
|
99
|
+
quorum 'from_size_class_and_hybridity', :needs => [:size_class, :hybridity, :urbanity] do |characteristics|
|
100
|
+
drivetrain = characteristics[:hybridity] ? :hybrid : :conventional
|
101
|
+
urbanity = characteristics[:urbanity]
|
102
|
+
size_class = characteristics[:size_class]
|
103
|
+
fuel_efficiency_multipliers = {
|
104
|
+
:city => size_class.send(:"#{drivetrain}_fuel_efficiency_city_multiplier"),
|
105
|
+
:highway => size_class.send(:"#{drivetrain}_fuel_efficiency_highway_multiplier")
|
106
|
+
}
|
107
|
+
if fuel_efficiency_multipliers.values.any?(&:nil?)
|
108
|
+
nil
|
109
|
+
else
|
110
|
+
1.0 / ((urbanity / fuel_efficiency_multipliers[:city]) + ((1.0 - urbanity) / fuel_efficiency_multipliers[:highway]))
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
quorum 'from hybridity', :needs => [:hybridity, :urbanity] do |characteristics|
|
115
|
+
drivetrain = characteristics[:hybridity] ? :hybrid : :conventional
|
116
|
+
urbanity = characteristics[:urbanity]
|
117
|
+
fuel_efficiency_multipliers = {
|
118
|
+
:city => AutomobileSizeClass.fallback.send(:"#{drivetrain}_fuel_efficiency_city_multiplier"),
|
119
|
+
:highway => AutomobileSizeClass.fallback.send(:"#{drivetrain}_fuel_efficiency_highway_multiplier")
|
120
|
+
}
|
121
|
+
1.0 / ((urbanity / fuel_efficiency_multipliers[:city]) + ((1.0 - urbanity) / fuel_efficiency_multipliers[:highway]))
|
122
|
+
end
|
123
|
+
|
124
|
+
quorum 'default' do
|
125
|
+
1.0
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
committee :nominal_fuel_efficiency do # returns kilometres per litre **OR** (FIXME) kilometres per kWh
|
130
|
+
quorum 'from model', :needs => [:model, :urbanity] do |characteristics|
|
131
|
+
fuel_efficiency_city = characteristics[:model].fuel_efficiency_city.to_f
|
132
|
+
fuel_efficiency_highway = characteristics[:model].fuel_efficiency_highway.to_f
|
133
|
+
urbanity = characteristics[:urbanity]
|
134
|
+
1.0 / ((urbanity / fuel_efficiency_city) + ((1.0 - urbanity) / fuel_efficiency_highway))
|
135
|
+
end
|
136
|
+
|
137
|
+
quorum 'from make and model year', :needs => [:model_year] do |characteristics|
|
138
|
+
characteristics[:model_year].make_year.andand.fuel_efficiency
|
139
|
+
end
|
140
|
+
|
141
|
+
quorum 'from size class', :needs => [:size_class, :urbanity] do |characteristics|
|
142
|
+
fuel_efficiencies = characteristics[:size_class].attributes.symbolize_keys.slice(:fuel_efficiency_city, :fuel_efficiency_highway)
|
143
|
+
urbanity = characteristics[:urbanity]
|
144
|
+
1.0 / ((urbanity / fuel_efficiencies[:fuel_efficiency_city].to_f) + ((1.0 - urbanity) / fuel_efficiencies[:fuel_efficiency_highway].to_f))
|
145
|
+
end
|
146
|
+
|
147
|
+
quorum 'from model year', :needs => :model_year do |characteristics|
|
148
|
+
characteristics[:model_year].fuel_efficiency
|
149
|
+
end
|
150
|
+
|
151
|
+
quorum 'from make', :needs => :make do |characteristics|
|
152
|
+
characteristics[:make].fuel_efficiency
|
153
|
+
end
|
154
|
+
|
155
|
+
quorum 'default' do
|
156
|
+
Automobile.automobile_model.fallback.fuel_efficiency
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
committee :speed do # returns kilometres per hour
|
161
|
+
quorum 'from urbanity', :needs => :urbanity do |characteristics|
|
162
|
+
1 / (characteristics[:urbanity] / ::BrighterPlanet::Automobile::CarbonModel::SPEEDS[:city] + (1 - characteristics[:urbanity]) / ::BrighterPlanet::Automobile::CarbonModel::SPEEDS[:highway])
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
committee :urbanity do
|
167
|
+
quorum 'default' do
|
168
|
+
Automobile.automobile_model.fallback.urbanity
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
committee :fuel_type do
|
173
|
+
quorum 'from variant', :needs => :variant do |characteristics|
|
174
|
+
characteristics[:variant].fuel_type
|
175
|
+
end
|
176
|
+
|
177
|
+
quorum 'default' do
|
178
|
+
Automobile.automobile_model.fallback.fuel_type
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
committee :active_subtimeframe do
|
183
|
+
quorum 'from acquisition and retirement', :needs => [:acquisition, :retirement] do |characteristics, timeframe|
|
184
|
+
Timeframe.constrained_new characteristics[:acquisition].to_date, characteristics[:retirement].to_date, timeframe
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
committee :acquisition do
|
189
|
+
quorum 'from model year or year', :appreciates => [:model_year, :year] do |characteristics|
|
190
|
+
puts characteristics.inspect
|
191
|
+
!characteristics.empty? && Date.new((characteristics[:model_year].andand.year || characteristics[:year]).to_i - 1, 1, 1)
|
192
|
+
end
|
193
|
+
quorum 'from retirement', :appreciates => :retirement do |characteristics, timeframe|
|
194
|
+
[ timeframe.from, characteristics[:retirement] ].compact.min
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
committee :retirement do
|
199
|
+
quorum 'from acquisition', :appreciates => :acquisition do |characteristics, timeframe|
|
200
|
+
[ timeframe.to, characteristics[:acquisition] ].compact.max
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
end
|
206
|
+
SPEEDS = {
|
207
|
+
:highway => 57.1.miles.to(:kilometres), # https://brighterplanet.sifterapp.com/projects/30/issues/428
|
208
|
+
:city => 19.9.miles.to(:kilometres) # https://brighterplanet.sifterapp.com/projects/30/issues/428
|
209
|
+
}
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'characterizable'
|
2
|
+
|
3
|
+
module BrighterPlanet
|
4
|
+
module Automobile
|
5
|
+
module Characterization
|
6
|
+
def self.included(base)
|
7
|
+
base.send :include, Characterizable
|
8
|
+
base.characterize do
|
9
|
+
has :make do |make|
|
10
|
+
make.reveals :model_year do |model_year|
|
11
|
+
model_year.reveals :model, :trumps => :size_class do |model|
|
12
|
+
model.reveals :variant, :trumps => :hybridity
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
## sabshere 5/27/10: thought exercise... if we wanted people to send in make=ford&model=taurus&model_year=2006 (of course it would be &naked_model=, but you get the point)
|
17
|
+
# has :make do |make|
|
18
|
+
# make.reveals :naked_model_year do |model_year|
|
19
|
+
# model_year.reveals :model, :naked_trumps => :size_class do |model|
|
20
|
+
# model.reveals :naked_variant, :trumps => :hybridity
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
has :fuel_type
|
25
|
+
has :fuel_efficiency, :trumps => [:urbanity, :hybridity], :measures => :length_per_volume
|
26
|
+
has :urbanity, :measures => :percentage
|
27
|
+
has :hybridity
|
28
|
+
has :daily_distance_estimate, :trumps => [:weekly_distance_estimate, :annual_distance_estimate, :daily_duration], :measures => :length #, :weekly_fuel_cost, :annual_fuel_cost]
|
29
|
+
has :daily_duration, :trumps => [:annual_distance_estimate, :weekly_distance_estimate, :daily_distance_estimate], :measures => :time #, :weekly_fuel_cost, :annual_fuel_cost]
|
30
|
+
has :weekly_distance_estimate, :trumps => [:annual_distance_estimate, :daily_distance_estimate, :daily_duration], :measures => :length #, :weekly_fuel_cost, :annual_fuel_cost]
|
31
|
+
has :annual_distance_estimate, :trumps => [:weekly_distance_estimate, :daily_distance_estimate, :daily_duration], :measures => :length #, :weekly_fuel_cost, :annual_fuel_cost]
|
32
|
+
has :acquisition
|
33
|
+
has :retirement
|
34
|
+
has :size_class
|
35
|
+
# has :annual_fuel_cost, :trumps => [:annual_distance_estimate, :weekly_distance_estimate, :daily_distance_estimate, :daily_duration, :weekly_fuel_cost], :measures => :cost
|
36
|
+
# has :weekly_fuel_cost, :trumps => [:annual_distance_estimate, :weekly_distance_estimate, :daily_distance_estimate, :daily_duration, :annual_fuel_cost], :measures => :cost
|
37
|
+
end
|
38
|
+
base.add_implicit_characteristics
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'data_miner'
|
2
|
+
|
3
|
+
module BrighterPlanet
|
4
|
+
module Automobile
|
5
|
+
module Data
|
6
|
+
def self.included(base)
|
7
|
+
base.data_miner do
|
8
|
+
schema do
|
9
|
+
string 'make_id'
|
10
|
+
string 'model_id'
|
11
|
+
string 'model_year_id'
|
12
|
+
string 'variant_id'
|
13
|
+
string 'size_class_id'
|
14
|
+
string 'fuel_type_id'
|
15
|
+
boolean 'hybridity'
|
16
|
+
float 'urbanity'
|
17
|
+
float 'fuel_efficiency'
|
18
|
+
float 'annual_distance_estimate'
|
19
|
+
float 'weekly_distance_estimate'
|
20
|
+
float 'daily_distance_estimate'
|
21
|
+
float 'daily_duration'
|
22
|
+
date 'date'
|
23
|
+
date 'acquisition'
|
24
|
+
date 'retirement'
|
25
|
+
end
|
26
|
+
|
27
|
+
process "pull orphans" do
|
28
|
+
AutomobileMakeFleetYear.run_data_miner! # sabshere 5/25/10 i'm not sure we actually need to have this in cm1
|
29
|
+
end
|
30
|
+
|
31
|
+
process "pull dependencies" do
|
32
|
+
run_data_miner_on_belongs_to_associations
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'summary_judgement'
|
2
|
+
|
3
|
+
module BrighterPlanet
|
4
|
+
module Automobile
|
5
|
+
module Summarization
|
6
|
+
def self.included(base)
|
7
|
+
base.extend SummaryJudgement
|
8
|
+
base.summarize do |has|
|
9
|
+
has.adjective :model_year
|
10
|
+
has.adjective :make
|
11
|
+
has.adjective :model
|
12
|
+
has.identity 'automobile'
|
13
|
+
has.verb :own
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'automobile'
|
2
|
+
|
3
|
+
class AutomobileRecord < ActiveRecord::Base
|
4
|
+
class << self
|
5
|
+
def n
|
6
|
+
new :make => AutomobileMake.find_by_name('Nissan')
|
7
|
+
end
|
8
|
+
|
9
|
+
def add_implicit_characteristics
|
10
|
+
decisions[:emission].committees.map(&:name).reject { |c| characteristics.keys.unshift(:emission).include? c }.each do |c|
|
11
|
+
characterize { has c }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
include BrighterPlanet::Automobile
|
17
|
+
include Sniff::Emitter
|
18
|
+
|
19
|
+
belongs_to :variant, :class_name => 'AutomobileVariant'
|
20
|
+
belongs_to :make, :class_name => 'AutomobileMake'
|
21
|
+
belongs_to :model, :class_name => 'AutomobileModel'
|
22
|
+
belongs_to :model_year, :class_name => 'AutomobileModelYear'
|
23
|
+
belongs_to :fuel_type, :class_name => 'AutomobileFuelType'
|
24
|
+
belongs_to :size_class, :class_name => 'AutomobileSizeClass'
|
25
|
+
|
26
|
+
falls_back_on :fuel_efficiency => 20.182.miles_per_gallon.to(:kilometres_per_litre), # mpg https://brighterplanet.sifterapp.com/projects/30/issues/428
|
27
|
+
:urbanity => 0.43, # EPA via Ian https://brighterplanet.sifterapp.com/projects/30/issues/428
|
28
|
+
:annual_distance_estimate => 11819.miles.to(:kilometres) # miles https://brighterplanet.sifterapp.com/projects/30/issues/428
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'sniff/database'
|
2
|
+
|
3
|
+
Sniff::Database.define_schema do
|
4
|
+
create_table "automobile_records", :force => true do |t|
|
5
|
+
t.datetime "created_at"
|
6
|
+
t.datetime "updated_at"
|
7
|
+
t.date "date"
|
8
|
+
t.float "fuel_efficiency"
|
9
|
+
t.float "urbanity"
|
10
|
+
t.float "annual_distance_estimate"
|
11
|
+
t.float "weekly_distance_estimate"
|
12
|
+
t.float "daily_distance_estimate"
|
13
|
+
t.float "daily_duration"
|
14
|
+
t.date "acquisition"
|
15
|
+
t.boolean "hybridity"
|
16
|
+
t.date "retirement"
|
17
|
+
t.string "make_id"
|
18
|
+
t.string "model_id"
|
19
|
+
t.string "model_year_id"
|
20
|
+
t.string "variant_id"
|
21
|
+
t.string "size_class_id"
|
22
|
+
t.string "fuel_type_id"
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,61 +1,300 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: automobile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Andy Rossmeissl
|
13
14
|
- Seamus Abshere
|
14
15
|
- Ian Hough
|
15
16
|
- Matt Kling
|
17
|
+
- Derek Kastner
|
16
18
|
autorequire:
|
17
19
|
bindir: bin
|
18
20
|
cert_chain: []
|
19
21
|
|
20
|
-
date: 2010-07-
|
22
|
+
date: 2010-07-23 00:00:00 -04:00
|
21
23
|
default_executable:
|
22
24
|
dependencies:
|
23
25
|
- !ruby/object:Gem::Dependency
|
24
|
-
|
26
|
+
type: :development
|
25
27
|
prerelease: false
|
26
|
-
|
28
|
+
name: activerecord
|
29
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - "="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
hash: -1848230024
|
35
|
+
segments:
|
36
|
+
- 3
|
37
|
+
- 0
|
38
|
+
- 0
|
39
|
+
- beta4
|
40
|
+
version: 3.0.0.beta4
|
41
|
+
requirement: *id001
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
name: bundler
|
46
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
27
48
|
requirements:
|
28
49
|
- - ">="
|
29
50
|
- !ruby/object:Gem::Version
|
51
|
+
hash: 62196359
|
30
52
|
segments:
|
53
|
+
- 1
|
31
54
|
- 0
|
32
|
-
|
33
|
-
|
34
|
-
|
55
|
+
- 0
|
56
|
+
- beta
|
57
|
+
- 2
|
58
|
+
version: 1.0.0.beta.2
|
59
|
+
requirement: *id002
|
35
60
|
- !ruby/object:Gem::Dependency
|
36
|
-
|
61
|
+
type: :development
|
37
62
|
prerelease: false
|
38
|
-
|
63
|
+
name: cucumber
|
64
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - "="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 57
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
- 8
|
73
|
+
- 3
|
74
|
+
version: 0.8.3
|
75
|
+
requirement: *id003
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
name: jeweler
|
80
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - "="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 7
|
86
|
+
segments:
|
87
|
+
- 1
|
88
|
+
- 4
|
89
|
+
- 0
|
90
|
+
version: 1.4.0
|
91
|
+
requirement: *id004
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
name: rake
|
96
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
39
98
|
requirements:
|
40
99
|
- - ">="
|
41
100
|
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
42
102
|
segments:
|
43
103
|
- 0
|
44
104
|
version: "0"
|
45
|
-
|
46
|
-
version_requirements: *id002
|
105
|
+
requirement: *id005
|
47
106
|
- !ruby/object:Gem::Dependency
|
48
|
-
|
107
|
+
type: :development
|
49
108
|
prerelease: false
|
50
|
-
|
109
|
+
name: rdoc
|
110
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
51
112
|
requirements:
|
52
113
|
- - ">="
|
53
114
|
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
54
116
|
segments:
|
55
117
|
- 0
|
56
118
|
version: "0"
|
119
|
+
requirement: *id006
|
120
|
+
- !ruby/object:Gem::Dependency
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
name: rspec
|
124
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - "="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
hash: 62196417
|
130
|
+
segments:
|
131
|
+
- 2
|
132
|
+
- 0
|
133
|
+
- 0
|
134
|
+
- beta
|
135
|
+
- 17
|
136
|
+
version: 2.0.0.beta.17
|
137
|
+
requirement: *id007
|
138
|
+
- !ruby/object:Gem::Dependency
|
57
139
|
type: :development
|
58
|
-
|
140
|
+
prerelease: false
|
141
|
+
name: sniff
|
142
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - "="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
hash: 9
|
148
|
+
segments:
|
149
|
+
- 0
|
150
|
+
- 0
|
151
|
+
- 11
|
152
|
+
version: 0.0.11
|
153
|
+
requirement: *id008
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
type: :runtime
|
156
|
+
prerelease: false
|
157
|
+
name: characterizable
|
158
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
160
|
+
requirements:
|
161
|
+
- - "="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
hash: 7
|
164
|
+
segments:
|
165
|
+
- 0
|
166
|
+
- 0
|
167
|
+
- 12
|
168
|
+
version: 0.0.12
|
169
|
+
requirement: *id009
|
170
|
+
- !ruby/object:Gem::Dependency
|
171
|
+
type: :runtime
|
172
|
+
prerelease: false
|
173
|
+
name: data_miner
|
174
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
175
|
+
none: false
|
176
|
+
requirements:
|
177
|
+
- - "="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
hash: 15
|
180
|
+
segments:
|
181
|
+
- 0
|
182
|
+
- 5
|
183
|
+
- 2
|
184
|
+
version: 0.5.2
|
185
|
+
requirement: *id010
|
186
|
+
- !ruby/object:Gem::Dependency
|
187
|
+
type: :runtime
|
188
|
+
prerelease: false
|
189
|
+
name: earth
|
190
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
191
|
+
none: false
|
192
|
+
requirements:
|
193
|
+
- - "="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
hash: 17
|
196
|
+
segments:
|
197
|
+
- 0
|
198
|
+
- 0
|
199
|
+
- 7
|
200
|
+
version: 0.0.7
|
201
|
+
requirement: *id011
|
202
|
+
- !ruby/object:Gem::Dependency
|
203
|
+
type: :runtime
|
204
|
+
prerelease: false
|
205
|
+
name: falls_back_on
|
206
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
207
|
+
none: false
|
208
|
+
requirements:
|
209
|
+
- - "="
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
hash: 27
|
212
|
+
segments:
|
213
|
+
- 0
|
214
|
+
- 0
|
215
|
+
- 2
|
216
|
+
version: 0.0.2
|
217
|
+
requirement: *id012
|
218
|
+
- !ruby/object:Gem::Dependency
|
219
|
+
type: :runtime
|
220
|
+
prerelease: false
|
221
|
+
name: fast_timestamp
|
222
|
+
version_requirements: &id013 !ruby/object:Gem::Requirement
|
223
|
+
none: false
|
224
|
+
requirements:
|
225
|
+
- - "="
|
226
|
+
- !ruby/object:Gem::Version
|
227
|
+
hash: 23
|
228
|
+
segments:
|
229
|
+
- 0
|
230
|
+
- 0
|
231
|
+
- 4
|
232
|
+
version: 0.0.4
|
233
|
+
requirement: *id013
|
234
|
+
- !ruby/object:Gem::Dependency
|
235
|
+
type: :runtime
|
236
|
+
prerelease: false
|
237
|
+
name: leap
|
238
|
+
version_requirements: &id014 !ruby/object:Gem::Requirement
|
239
|
+
none: false
|
240
|
+
requirements:
|
241
|
+
- - "="
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
hash: 13
|
244
|
+
segments:
|
245
|
+
- 0
|
246
|
+
- 4
|
247
|
+
- 1
|
248
|
+
version: 0.4.1
|
249
|
+
requirement: *id014
|
250
|
+
- !ruby/object:Gem::Dependency
|
251
|
+
type: :runtime
|
252
|
+
prerelease: false
|
253
|
+
name: summary_judgement
|
254
|
+
version_requirements: &id015 !ruby/object:Gem::Requirement
|
255
|
+
none: false
|
256
|
+
requirements:
|
257
|
+
- - "="
|
258
|
+
- !ruby/object:Gem::Version
|
259
|
+
hash: 11
|
260
|
+
segments:
|
261
|
+
- 1
|
262
|
+
- 3
|
263
|
+
- 8
|
264
|
+
version: 1.3.8
|
265
|
+
requirement: *id015
|
266
|
+
- !ruby/object:Gem::Dependency
|
267
|
+
type: :runtime
|
268
|
+
prerelease: false
|
269
|
+
name: timeframe
|
270
|
+
version_requirements: &id016 !ruby/object:Gem::Requirement
|
271
|
+
none: false
|
272
|
+
requirements:
|
273
|
+
- - "="
|
274
|
+
- !ruby/object:Gem::Version
|
275
|
+
hash: 15
|
276
|
+
segments:
|
277
|
+
- 0
|
278
|
+
- 0
|
279
|
+
- 8
|
280
|
+
version: 0.0.8
|
281
|
+
requirement: *id016
|
282
|
+
- !ruby/object:Gem::Dependency
|
283
|
+
type: :runtime
|
284
|
+
prerelease: false
|
285
|
+
name: weighted_average
|
286
|
+
version_requirements: &id017 !ruby/object:Gem::Requirement
|
287
|
+
none: false
|
288
|
+
requirements:
|
289
|
+
- - "="
|
290
|
+
- !ruby/object:Gem::Version
|
291
|
+
hash: 23
|
292
|
+
segments:
|
293
|
+
- 0
|
294
|
+
- 0
|
295
|
+
- 4
|
296
|
+
version: 0.0.4
|
297
|
+
requirement: *id017
|
59
298
|
description: A software model in Ruby for the greenhouse gas emissions of an automobile
|
60
299
|
email: andy@rossmeissl.net
|
61
300
|
executables: []
|
@@ -66,16 +305,18 @@ extra_rdoc_files:
|
|
66
305
|
- LICENSE
|
67
306
|
- README.rdoc
|
68
307
|
files:
|
69
|
-
- .document
|
70
|
-
- .gitignore
|
71
308
|
- LICENSE
|
72
309
|
- README.rdoc
|
73
|
-
- Rakefile
|
74
|
-
- VERSION
|
75
|
-
- automobile.gemspec
|
76
310
|
- lib/automobile.rb
|
77
|
-
-
|
78
|
-
-
|
311
|
+
- lib/automobile/carbon_model.rb
|
312
|
+
- lib/automobile/characterization.rb
|
313
|
+
- lib/automobile/data.rb
|
314
|
+
- lib/automobile/summarization.rb
|
315
|
+
- lib/test_support/automobile_record.rb
|
316
|
+
- lib/test_support/db/schema.rb
|
317
|
+
- features/support/env.rb
|
318
|
+
- features/automobile_committees.feature
|
319
|
+
- features/automobile_emissions.feature
|
79
320
|
has_rdoc: true
|
80
321
|
homepage: http://github.com/brighterplanet/automobile
|
81
322
|
licenses: []
|
@@ -86,26 +327,33 @@ rdoc_options:
|
|
86
327
|
require_paths:
|
87
328
|
- lib
|
88
329
|
required_ruby_version: !ruby/object:Gem::Requirement
|
330
|
+
none: false
|
89
331
|
requirements:
|
90
332
|
- - ">="
|
91
333
|
- !ruby/object:Gem::Version
|
334
|
+
hash: 3
|
92
335
|
segments:
|
93
336
|
- 0
|
94
337
|
version: "0"
|
95
338
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
339
|
+
none: false
|
96
340
|
requirements:
|
97
341
|
- - ">="
|
98
342
|
- !ruby/object:Gem::Version
|
343
|
+
hash: 3
|
99
344
|
segments:
|
100
345
|
- 0
|
101
346
|
version: "0"
|
102
347
|
requirements: []
|
103
348
|
|
104
349
|
rubyforge_project:
|
105
|
-
rubygems_version: 1.3.
|
350
|
+
rubygems_version: 1.3.7
|
106
351
|
signing_key:
|
107
352
|
specification_version: 3
|
108
353
|
summary: A carbon model
|
109
354
|
test_files:
|
110
|
-
-
|
111
|
-
-
|
355
|
+
- features/support/env.rb
|
356
|
+
- features/automobile_committees.feature
|
357
|
+
- features/automobile_emissions.feature
|
358
|
+
- lib/test_support/automobile_record.rb
|
359
|
+
- lib/test_support/db/schema.rb
|
data/.document
DELETED
data/.gitignore
DELETED
data/Rakefile
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "automobile"
|
8
|
-
gem.summary = %Q{A carbon model}
|
9
|
-
gem.description = %Q{A software model in Ruby for the greenhouse gas emissions of an automobile}
|
10
|
-
gem.email = "andy@rossmeissl.net"
|
11
|
-
gem.homepage = "http://github.com/brighterplanet/automobile"
|
12
|
-
gem.authors = ["Andy Rossmeissl", "Seamus Abshere", "Ian Hough", "Matt Kling"]
|
13
|
-
gem.add_dependency 'leap'
|
14
|
-
gem.add_dependency 'conversions'
|
15
|
-
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
16
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
|
-
end
|
18
|
-
Jeweler::GemcutterTasks.new
|
19
|
-
rescue LoadError
|
20
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
-
end
|
22
|
-
|
23
|
-
require 'rake/testtask'
|
24
|
-
Rake::TestTask.new(:test) do |test|
|
25
|
-
test.libs << 'lib' << 'test'
|
26
|
-
test.pattern = 'test/**/test_*.rb'
|
27
|
-
test.verbose = true
|
28
|
-
end
|
29
|
-
|
30
|
-
begin
|
31
|
-
require 'rcov/rcovtask'
|
32
|
-
Rcov::RcovTask.new do |test|
|
33
|
-
test.libs << 'test'
|
34
|
-
test.pattern = 'test/**/test_*.rb'
|
35
|
-
test.verbose = true
|
36
|
-
end
|
37
|
-
rescue LoadError
|
38
|
-
task :rcov do
|
39
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
task :test => :check_dependencies
|
44
|
-
|
45
|
-
task :default => :test
|
46
|
-
|
47
|
-
require 'rake/rdoctask'
|
48
|
-
Rake::RDocTask.new do |rdoc|
|
49
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
50
|
-
|
51
|
-
rdoc.rdoc_dir = 'rdoc'
|
52
|
-
rdoc.title = "automobile #{version}"
|
53
|
-
rdoc.rdoc_files.include('README*')
|
54
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.3
|
data/automobile.gemspec
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{automobile}
|
8
|
-
s.version = "0.0.3"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Andy Rossmeissl", "Seamus Abshere", "Ian Hough", "Matt Kling"]
|
12
|
-
s.date = %q{2010-07-06}
|
13
|
-
s.description = %q{A software model in Ruby for the greenhouse gas emissions of an automobile}
|
14
|
-
s.email = %q{andy@rossmeissl.net}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"automobile.gemspec",
|
27
|
-
"lib/automobile.rb",
|
28
|
-
"test/helper.rb",
|
29
|
-
"test/test_automobile.rb"
|
30
|
-
]
|
31
|
-
s.homepage = %q{http://github.com/brighterplanet/automobile}
|
32
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
33
|
-
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.3.6}
|
35
|
-
s.summary = %q{A carbon model}
|
36
|
-
s.test_files = [
|
37
|
-
"test/helper.rb",
|
38
|
-
"test/test_automobile.rb"
|
39
|
-
]
|
40
|
-
|
41
|
-
if s.respond_to? :specification_version then
|
42
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
|
-
s.specification_version = 3
|
44
|
-
|
45
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
46
|
-
s.add_runtime_dependency(%q<leap>, [">= 0"])
|
47
|
-
s.add_runtime_dependency(%q<conversions>, [">= 0"])
|
48
|
-
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
49
|
-
else
|
50
|
-
s.add_dependency(%q<leap>, [">= 0"])
|
51
|
-
s.add_dependency(%q<conversions>, [">= 0"])
|
52
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
53
|
-
end
|
54
|
-
else
|
55
|
-
s.add_dependency(%q<leap>, [">= 0"])
|
56
|
-
s.add_dependency(%q<conversions>, [">= 0"])
|
57
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
data/test/helper.rb
DELETED