automobile_trip 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/features/automobile_trip_committees.feature +2 -0
- data/features/automobile_trip_emissions.feature +7 -0
- data/features/support/env.rb +8 -0
- data/lib/automobile_trip/carbon_model.rb +91 -0
- data/lib/automobile_trip/characterization.rb +14 -0
- data/lib/automobile_trip/data.rb +16 -0
- data/lib/automobile_trip/summarization.rb +14 -0
- data/lib/automobile_trip.rb +17 -0
- metadata +227 -0
data/LICENSE
ADDED
@@ -0,0 +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.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= automobile_trip
|
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,91 @@
|
|
1
|
+
require 'leap'
|
2
|
+
require 'conversions'
|
3
|
+
|
4
|
+
module BrighterPlanet
|
5
|
+
module AutomobileTrip
|
6
|
+
module CarbonModel
|
7
|
+
def self.included(base)
|
8
|
+
base.extend ::Leap::Subject
|
9
|
+
base.decide :emission, :with => :characteristics do
|
10
|
+
|
11
|
+
committee :emission do
|
12
|
+
quorum 'from fuel consumed and emission factor' do
|
13
|
+
#, :needs => [:fuel_consumed, :emission_factor] do |characteristics|
|
14
|
+
# characteristics[:fuel_consumed] * characteristics[:emission_factor]
|
15
|
+
16
|
16
|
+
end
|
17
|
+
|
18
|
+
quorum 'default' do
|
19
|
+
raise "The emission committee's default quorum should never be called"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
committee :emission_factor do
|
24
|
+
quorum 'from fuel type', :needs => :fuel_type do |characteristics|
|
25
|
+
characteristics[:fuel_type].emission_factor
|
26
|
+
end
|
27
|
+
|
28
|
+
quorum 'default' do
|
29
|
+
AutomobileTrip.fallback.emission_factor
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
committee :fuel_consumed do
|
34
|
+
quorum 'from fuel cost and fuel price'
|
35
|
+
fuel_cost / fuel_price
|
36
|
+
end
|
37
|
+
|
38
|
+
quorum 'from distance and fuel efficiency', :needs => [:distance, :average_fuel_efficiency] do |characteristics|
|
39
|
+
characteristics[:distance] / characteristics[:average_fuel_efficiency]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
committee :fuel_price do
|
44
|
+
# quorum 'from location'
|
45
|
+
#
|
46
|
+
# end
|
47
|
+
|
48
|
+
quorum 'from fuel type'
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
committee :distance do
|
54
|
+
quorum 'from duration and speed'
|
55
|
+
duration * speed
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
commitee :average_fuel_efficiency do
|
60
|
+
quorum 'from variant' # variant includes make, year, and model
|
61
|
+
end
|
62
|
+
|
63
|
+
quorum 'from model' # model includes make and year
|
64
|
+
end
|
65
|
+
|
66
|
+
quorum 'from year' # year includes make
|
67
|
+
end
|
68
|
+
|
69
|
+
quorum 'from make'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
committee :fuel_type do
|
74
|
+
quorum 'from variant'
|
75
|
+
end
|
76
|
+
|
77
|
+
quorum 'from model'
|
78
|
+
end
|
79
|
+
|
80
|
+
quorum 'from make'
|
81
|
+
end
|
82
|
+
|
83
|
+
quorum 'default'
|
84
|
+
AutomobileTrip.fallback.fuel_type
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'characterizable'
|
2
|
+
|
3
|
+
module BrighterPlanet
|
4
|
+
module AutomobileTrip
|
5
|
+
module Characterization
|
6
|
+
def self.included(base)
|
7
|
+
base.send :include, Characterizable
|
8
|
+
base.characterize do
|
9
|
+
end
|
10
|
+
base.add_implicit_characteristics
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'emitter'
|
2
|
+
|
3
|
+
module BrighterPlanet
|
4
|
+
module AutomobileTrip
|
5
|
+
extend BrighterPlanet::Emitter
|
6
|
+
|
7
|
+
def self.automobile_trip_model
|
8
|
+
if Object.const_defined? 'AutomobileTrip'
|
9
|
+
::AutomobileTrip
|
10
|
+
elsif Object.const_defined? 'AutomobileTripRecord'
|
11
|
+
AutomobileTripRecord
|
12
|
+
else
|
13
|
+
raise 'There is no automobile trip model'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,227 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: automobile_trip
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Andy Rossmeissl
|
14
|
+
- Seamus Abshere
|
15
|
+
- Ian Hough
|
16
|
+
- Matt Kling
|
17
|
+
- Derek Kastner
|
18
|
+
autorequire:
|
19
|
+
bindir: bin
|
20
|
+
cert_chain: []
|
21
|
+
|
22
|
+
date: 2010-09-09 00:00:00 -04:00
|
23
|
+
default_executable:
|
24
|
+
dependencies:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
type: :development
|
27
|
+
prerelease: false
|
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
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
hash: 62196359
|
52
|
+
segments:
|
53
|
+
- 1
|
54
|
+
- 0
|
55
|
+
- 0
|
56
|
+
- beta
|
57
|
+
- 2
|
58
|
+
version: 1.0.0.beta.2
|
59
|
+
requirement: *id002
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
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
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
requirement: *id005
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
type: :development
|
108
|
+
prerelease: false
|
109
|
+
name: rdoc
|
110
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
116
|
+
segments:
|
117
|
+
- 0
|
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
|
139
|
+
type: :development
|
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: emitter
|
158
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
hash: 29
|
164
|
+
segments:
|
165
|
+
- 0
|
166
|
+
- 0
|
167
|
+
- 1
|
168
|
+
version: 0.0.1
|
169
|
+
requirement: *id009
|
170
|
+
description: A software model in Ruby for the greenhouse gas emissions of an automobile trip
|
171
|
+
email: andy@rossmeissl.net
|
172
|
+
executables: []
|
173
|
+
|
174
|
+
extensions: []
|
175
|
+
|
176
|
+
extra_rdoc_files:
|
177
|
+
- LICENSE
|
178
|
+
- README.rdoc
|
179
|
+
files:
|
180
|
+
- LICENSE
|
181
|
+
- README.rdoc
|
182
|
+
- lib/automobile_trip.rb
|
183
|
+
- lib/automobile_trip/carbon_model.rb
|
184
|
+
- lib/automobile_trip/characterization.rb
|
185
|
+
- lib/automobile_trip/data.rb
|
186
|
+
- lib/automobile_trip/summarization.rb
|
187
|
+
- features/support/env.rb
|
188
|
+
- features/automobile_trip_committees.feature
|
189
|
+
- features/automobile_trip_emissions.feature
|
190
|
+
has_rdoc: true
|
191
|
+
homepage: http://github.com/brighterplanet/automobile_trip
|
192
|
+
licenses: []
|
193
|
+
|
194
|
+
post_install_message:
|
195
|
+
rdoc_options:
|
196
|
+
- --charset=UTF-8
|
197
|
+
require_paths:
|
198
|
+
- lib
|
199
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
200
|
+
none: false
|
201
|
+
requirements:
|
202
|
+
- - ">="
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
hash: 3
|
205
|
+
segments:
|
206
|
+
- 0
|
207
|
+
version: "0"
|
208
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
|
+
none: false
|
210
|
+
requirements:
|
211
|
+
- - ">="
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
hash: 3
|
214
|
+
segments:
|
215
|
+
- 0
|
216
|
+
version: "0"
|
217
|
+
requirements: []
|
218
|
+
|
219
|
+
rubyforge_project:
|
220
|
+
rubygems_version: 1.3.7
|
221
|
+
signing_key:
|
222
|
+
specification_version: 3
|
223
|
+
summary: A carbon model
|
224
|
+
test_files:
|
225
|
+
- features/support/env.rb
|
226
|
+
- features/automobile_trip_committees.feature
|
227
|
+
- features/automobile_trip_emissions.feature
|