computation 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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
+ = meeting
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,8 @@
1
+ Feature: Computation Committee Calculations
2
+ The computation model should generate correct committee calculations
3
+
4
+ Scenario: Emission committee from default
5
+ Given a computation emitter
6
+ When the "emission" committee is calculated
7
+ Then the committee should have used quorum "default"
8
+ And the conclusion of the committee should be "100.0"
@@ -0,0 +1,7 @@
1
+ Feature: Computation Emissions Calculations
2
+ The computation model should generate correct emission calculations
3
+
4
+ Scenario: Calculations starting from nothing
5
+ Given a computation has nothing
6
+ When emissions are calculated
7
+ Then the emission value should be within "0.1" kgs of "100.0"
@@ -0,0 +1,8 @@
1
+ require 'bundler'
2
+ Bundler.setup
3
+
4
+ require 'cucumber'
5
+ require 'cucumber/formatter/unicode'
6
+
7
+ require 'sniff'
8
+ Sniff.init File.join(File.dirname(__FILE__), '..', '..'), :cucumber => true, :earth => []
@@ -0,0 +1,15 @@
1
+ module BrighterPlanet
2
+ module Computation
3
+ module CarbonModel
4
+ def self.included(base)
5
+ base.decide :emission, :with => :characteristics do
6
+ committee :emission do # returns kg CO2e
7
+ quorum 'default' do
8
+ 100.0
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ require 'characterizable'
2
+
3
+ module BrighterPlanet
4
+ module Computation
5
+ module Characterization
6
+ def self.included(base)
7
+ base.characterize do
8
+ has :compute_time
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module BrighterPlanet
2
+ module Computation
3
+ module Data
4
+ def self.included(base)
5
+ base.data_miner do
6
+ schema do
7
+ float :compute_time
8
+ end
9
+
10
+ process :run_data_miner_on_belongs_to_associations
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ module BrighterPlanet
2
+ module Computation
3
+ module Summarization
4
+ def self.included(base)
5
+ base.summarize do |has|
6
+ has.identity 'computation'
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ require 'emitter'
2
+
3
+ module BrighterPlanet
4
+ module Computation
5
+ extend BrighterPlanet::Emitter
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ require 'active_record'
2
+ require 'computation'
3
+ require 'sniff'
4
+
5
+ class ComputationRecord < ActiveRecord::Base
6
+ include Sniff::Emitter
7
+ include BrighterPlanet::Computation
8
+ end
@@ -0,0 +1,7 @@
1
+ require 'sniff/database'
2
+
3
+ Sniff::Database.define_schema do
4
+ create_table "computation_records", :force => true do |t|
5
+ t.float 'compute_time'
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,228 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: computation
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-21 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: 7
35
+ segments:
36
+ - 3
37
+ - 0
38
+ - 0
39
+ version: 3.0.0
40
+ requirement: *id001
41
+ - !ruby/object:Gem::Dependency
42
+ type: :development
43
+ prerelease: false
44
+ name: bundler
45
+ version_requirements: &id002 !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ~>
49
+ - !ruby/object:Gem::Version
50
+ hash: 23
51
+ segments:
52
+ - 1
53
+ - 0
54
+ - 0
55
+ version: 1.0.0
56
+ requirement: *id002
57
+ - !ruby/object:Gem::Dependency
58
+ type: :development
59
+ prerelease: false
60
+ name: cucumber
61
+ version_requirements: &id003 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ hash: 57
67
+ segments:
68
+ - 0
69
+ - 8
70
+ - 3
71
+ version: 0.8.3
72
+ requirement: *id003
73
+ - !ruby/object:Gem::Dependency
74
+ type: :development
75
+ prerelease: false
76
+ name: jeweler
77
+ version_requirements: &id004 !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ hash: 7
83
+ segments:
84
+ - 1
85
+ - 4
86
+ - 0
87
+ version: 1.4.0
88
+ requirement: *id004
89
+ - !ruby/object:Gem::Dependency
90
+ type: :development
91
+ prerelease: false
92
+ name: rake
93
+ version_requirements: &id005 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ requirement: *id005
103
+ - !ruby/object:Gem::Dependency
104
+ type: :development
105
+ prerelease: false
106
+ name: rdoc
107
+ version_requirements: &id006 !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ hash: 3
113
+ segments:
114
+ - 0
115
+ version: "0"
116
+ requirement: *id006
117
+ - !ruby/object:Gem::Dependency
118
+ type: :development
119
+ prerelease: false
120
+ name: rspec
121
+ version_requirements: &id007 !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ~>
125
+ - !ruby/object:Gem::Version
126
+ hash: 62196417
127
+ segments:
128
+ - 2
129
+ - 0
130
+ - 0
131
+ - beta
132
+ - 17
133
+ version: 2.0.0.beta.17
134
+ requirement: *id007
135
+ - !ruby/object:Gem::Dependency
136
+ type: :development
137
+ prerelease: false
138
+ name: sniff
139
+ version_requirements: &id008 !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ~>
143
+ - !ruby/object:Gem::Version
144
+ hash: 3
145
+ segments:
146
+ - 0
147
+ - 1
148
+ - 12
149
+ version: 0.1.12
150
+ requirement: *id008
151
+ - !ruby/object:Gem::Dependency
152
+ type: :runtime
153
+ prerelease: false
154
+ name: emitter
155
+ version_requirements: &id009 !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ~>
159
+ - !ruby/object:Gem::Version
160
+ hash: 29
161
+ segments:
162
+ - 0
163
+ - 1
164
+ - 3
165
+ version: 0.1.3
166
+ requirement: *id009
167
+ description: A software model in Ruby for the greenhouse gas emissions of a computer's computations
168
+ email: andy@rossmeissl.net
169
+ executables: []
170
+
171
+ extensions: []
172
+
173
+ extra_rdoc_files:
174
+ - LICENSE
175
+ - README.rdoc
176
+ files:
177
+ - LICENSE
178
+ - README.rdoc
179
+ - lib/computation.rb
180
+ - lib/computation/carbon_model.rb
181
+ - lib/computation/characterization.rb
182
+ - lib/computation/data.rb
183
+ - lib/computation/summarization.rb
184
+ - lib/test_support/computation_record.rb
185
+ - lib/test_support/db/schema.rb
186
+ - features/support/env.rb
187
+ - features/computation_committees.feature
188
+ - features/computation_emissions.feature
189
+ has_rdoc: true
190
+ homepage: http://github.com/brighterplanet/computation
191
+ licenses: []
192
+
193
+ post_install_message:
194
+ rdoc_options:
195
+ - --charset=UTF-8
196
+ require_paths:
197
+ - lib
198
+ required_ruby_version: !ruby/object:Gem::Requirement
199
+ none: false
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ hash: 3
204
+ segments:
205
+ - 0
206
+ version: "0"
207
+ required_rubygems_version: !ruby/object:Gem::Requirement
208
+ none: false
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ hash: 3
213
+ segments:
214
+ - 0
215
+ version: "0"
216
+ requirements: []
217
+
218
+ rubyforge_project:
219
+ rubygems_version: 1.3.7
220
+ signing_key:
221
+ specification_version: 3
222
+ summary: A carbon model
223
+ test_files:
224
+ - features/support/env.rb
225
+ - features/computation_committees.feature
226
+ - features/computation_emissions.feature
227
+ - lib/test_support/computation_record.rb
228
+ - lib/test_support/db/schema.rb