bus_trip 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
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.
@@ -0,0 +1,17 @@
1
+ = bus_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,54 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "bus_trip"
8
+ gem.summary = %Q{A carbon model}
9
+ gem.description = %Q{A software model in Ruby for the greenhouse gas emissions of a bus trip}
10
+ gem.email = "andy@rossmeissl.net"
11
+ gem.homepage = "http://github.com/brighterplanet/bus_trip"
12
+ gem.authors = ["Andy Rossmeissl", "Seamus Abshere", "Ian Hough", "Matt Kling"]
13
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
+ gem.add_development_dependency "leap"
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
+ end
21
+
22
+ require 'rake/testtask'
23
+ Rake::TestTask.new(:test) do |test|
24
+ test.libs << 'lib' << 'test'
25
+ test.pattern = 'test/**/test_*.rb'
26
+ test.verbose = true
27
+ end
28
+
29
+ begin
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |test|
32
+ test.libs << 'test'
33
+ test.pattern = 'test/**/test_*.rb'
34
+ test.verbose = true
35
+ end
36
+ rescue LoadError
37
+ task :rcov do
38
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
+ end
40
+ end
41
+
42
+ task :test => :check_dependencies
43
+
44
+ task :default => :test
45
+
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+
50
+ rdoc.rdoc_dir = 'rdoc'
51
+ rdoc.title = "bus_trip #{version}"
52
+ rdoc.rdoc_files.include('README*')
53
+ rdoc.rdoc_files.include('lib/**/*.rb')
54
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,87 @@
1
+ module BrighterPlanet
2
+ module BusTrip
3
+ def self.included(base)
4
+ base.extend ::Leap::Subject
5
+ base.decide :emission, :with => :characteristics do
6
+ committee :emission do # returns kg CO2
7
+ quorum 'from fuel and passengers', :needs => [:diesel_consumed, :gasoline_consumed, :alternative_fuels_consumed, :passengers, :distance, :bus_class] do |characteristics|
8
+ #(( litres diesel ) * ( kilograms CO2 / litre diesel ) + ( litres gasoline ) * ( kilograms CO2 / kWh ) + ( litre-equivs alternative fuel ) * (kilograms CO2 / litre-equiv alternative fuel))
9
+ (characteristics[:diesel_consumed] * research(:diesel_emission_factor) + characteristics[:gasoline_consumed] * research(:gasoline_emission_factor) + characteristics[:alternative_fuels_consumed] * research(:alternative_fuels_emission_factor) + characteristics[:distance] * characteristics[:bus_class].fugitive_air_conditioning_emission) / characteristics[:passengers]
10
+ end
11
+ end
12
+
13
+ committee :diesel_consumed do # returns litres diesel
14
+ quorum 'from distance and diesel intensity', :needs => [:distance, :diesel_intensity] do |characteristics|
15
+ #( kilometres ) * ( litres diesel / kilometre )
16
+ characteristics[:distance] * characteristics[:diesel_intensity]
17
+ end
18
+ end
19
+
20
+ committee :gasoline_consumed do # returns litres gasoline
21
+ quorum 'from distance and gasoline intensity', :needs => [:distance, :gasoline_intensity] do |characteristics|
22
+ #( kilometres ) * ( litres gasoline / kilometre )
23
+ characteristics[:distance] * characteristics[:gasoline_intensity]
24
+ end
25
+ end
26
+
27
+ committee :alternative_fuels_consumed do # returns litres alternative_fuels
28
+ quorum 'from distance and alternative fuels intensity', :needs => [:distance, :alternative_fuels_intensity] do |characteristics|
29
+ #( kilometres ) * ( litres alternative_fuels / kilometre )
30
+ characteristics[:distance] * characteristics[:alternative_fuels_intensity]
31
+ end
32
+ end
33
+
34
+ committee :distance do # returns kilometres
35
+ quorum 'from distance estimate', :needs => :distance_estimate do |characteristics|
36
+ characteristics[:distance_estimate]
37
+ end
38
+
39
+ quorum 'from duration', :needs => [:duration, :speed] do |characteristics|
40
+ #( minutes ) * ( kph )
41
+ characteristics[:duration] * characteristics[:speed] / 60
42
+ end
43
+
44
+ quorum 'from bus class', :needs => :bus_class do |characteristics|
45
+ characteristics[:bus_class].distance
46
+ end
47
+ end
48
+
49
+ committee :diesel_intensity do # returns litres diesel / vehicle kilometre
50
+ quorum 'from bus class', :needs => :bus_class do |characteristics|
51
+ characteristics[:bus_class].diesel_intensity
52
+ end
53
+ end
54
+
55
+ committee :gasoline_intensity do # returns litres gasoline / vehicle kilometre
56
+ quorum 'from bus class', :needs => :bus_class do |characteristics|
57
+ characteristics[:bus_class].gasoline_intensity
58
+ end
59
+ end
60
+
61
+ committee :alternative_fuels_intensity do # returns litres alternative_fuels / vehicle kilometre
62
+ quorum 'from bus class', :needs => :bus_class do |characteristics|
63
+ characteristics[:bus_class].alternative_fuels_intensity
64
+ end
65
+ end
66
+
67
+ committee :speed do # returns kph
68
+ quorum 'from bus class', :needs => :bus_class do |characteristics|
69
+ characteristics[:bus_class].speed
70
+ end
71
+ end
72
+
73
+ committee :passengers do
74
+ quorum 'from bus class', :needs => :bus_class do |characteristics|
75
+ characteristics[:bus_class].passengers
76
+ end
77
+ end
78
+
79
+ committee :bus_class do
80
+ quorum 'default' do
81
+ BusClass.fallback
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'bus_trip'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestBusTrip < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bus_trip
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 0
9
+ version: 0.0.0
10
+ platform: ruby
11
+ authors:
12
+ - Andy Rossmeissl
13
+ - Seamus Abshere
14
+ - Ian Hough
15
+ - Matt Kling
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2010-06-10 00:00:00 -04:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: thoughtbot-shoulda
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: leap
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ type: :development
46
+ version_requirements: *id002
47
+ description: A software model in Ruby for the greenhouse gas emissions of a bus trip
48
+ email: andy@rossmeissl.net
49
+ executables: []
50
+
51
+ extensions: []
52
+
53
+ extra_rdoc_files:
54
+ - LICENSE
55
+ - README.rdoc
56
+ files:
57
+ - .document
58
+ - .gitignore
59
+ - LICENSE
60
+ - README.rdoc
61
+ - Rakefile
62
+ - VERSION
63
+ - lib/bus_trip.rb
64
+ - test/helper.rb
65
+ - test/test_bus_trip.rb
66
+ has_rdoc: true
67
+ homepage: http://github.com/brighterplanet/bus_trip
68
+ licenses: []
69
+
70
+ post_install_message:
71
+ rdoc_options:
72
+ - --charset=UTF-8
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ requirements: []
90
+
91
+ rubyforge_project:
92
+ rubygems_version: 1.3.6
93
+ signing_key:
94
+ specification_version: 3
95
+ summary: A carbon model
96
+ test_files:
97
+ - test/helper.rb
98
+ - test/test_bus_trip.rb