carbon 1.1.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -22
- data/CHANGELOG +11 -0
- data/Gemfile +10 -1
- data/README.markdown +185 -0
- data/Rakefile +13 -26
- data/bin/carbon +3 -3
- data/carbon.gemspec +17 -23
- data/developer_notes/MULTI.markdown +25 -0
- data/developer_notes/REDUCE_HTTP_CONNECTIONS.markdown +46 -0
- data/features/shell.feature +1 -1
- data/features/support/env.rb +3 -4
- data/lib/carbon.rb +242 -96
- data/lib/carbon/registry.rb +50 -0
- data/lib/carbon/shell.rb +14 -8
- data/lib/carbon/shell/emitter.rb +33 -29
- data/lib/carbon/version.rb +1 -1
- data/test/carbon_test.rb +167 -0
- metadata +128 -182
- data/MIT-LICENSE.txt +0 -19
- data/README.rdoc +0 -266
- data/doc/INTEGRATION_GUIDE.rdoc +0 -1002
- data/doc/examining-response-with-jsonview.png +0 -0
- data/doc/shell_example +0 -43
- data/doc/timeout-error.png +0 -0
- data/doc/with-committee-reports.png +0 -0
- data/doc/without-committee-reports.png +0 -0
- data/lib/carbon/base.rb +0 -62
- data/lib/carbon/emission_estimate.rb +0 -165
- data/lib/carbon/emission_estimate/request.rb +0 -100
- data/lib/carbon/emission_estimate/response.rb +0 -61
- data/lib/carbon/emission_estimate/storage.rb +0 -33
- data/spec/fixtures/vcr_cassettes/flight.yml +0 -47
- data/spec/fixtures/vcr_cassettes/residence.yml +0 -44
- data/spec/lib/carbon/emission_estimate/request_spec.rb +0 -41
- data/spec/lib/carbon/emission_estimate/response_spec.rb +0 -33
- data/spec/lib/carbon/emission_estimate_spec.rb +0 -32
- data/spec/lib/carbon_spec.rb +0 -384
- data/spec/spec_helper.rb +0 -60
- data/spec/specwatchr +0 -60
data/lib/carbon/shell/emitter.rb
CHANGED
@@ -1,21 +1,26 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
require 'conversions'
|
4
|
+
|
1
5
|
module Carbon
|
2
6
|
class Shell
|
7
|
+
# @private
|
3
8
|
class Emitter < Bombshell::Environment
|
4
9
|
include Bombshell::Shell
|
5
10
|
include Carbon
|
6
11
|
|
12
|
+
# @private
|
7
13
|
def initialize(name, input = {})
|
8
|
-
@emitter = name
|
14
|
+
@emitter = name.to_s.singularize.camelcase
|
9
15
|
@input = input
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@characteristics = ActiveSupport::JSON.decode response.body
|
16
|
+
response = ::Net::HTTP.get_response(::URI.parse("http://impact.brighterplanet.com/#{@emitter.underscore.pluralize}/options.json"))
|
17
|
+
if (200..299).include?(response.code.to_i)
|
18
|
+
@characteristics = ::MultiJson.decode response.body
|
14
19
|
@characteristics.keys.each do |characteristic|
|
15
20
|
instance_eval <<-meth
|
16
21
|
def #{characteristic}(arg = nil)
|
17
22
|
if arg
|
18
|
-
@input[:#{characteristic}] = arg
|
23
|
+
@input[:#{characteristic}] = arg.to_s.strip
|
19
24
|
emission
|
20
25
|
else
|
21
26
|
@input[:#{characteristic}]
|
@@ -23,19 +28,17 @@ module Carbon
|
|
23
28
|
end
|
24
29
|
meth
|
25
30
|
end
|
26
|
-
if self.class.carbon_base && self.class.carbon_base.translation_table.any?
|
27
|
-
self.class.carbon_base.reset_translation_table!
|
28
|
-
end
|
29
31
|
provisions = @characteristics.keys.map { |k| "provide :#{k}"}.join('; ')
|
30
32
|
emit_as_block = "emit_as(:#{name}) { #{provisions} }"
|
31
33
|
self.class.class_eval emit_as_block
|
32
34
|
emission
|
33
35
|
else
|
34
|
-
puts " => Sorry, characteristics couldn't be retrieved for #{@emitter.
|
36
|
+
puts " => Sorry, characteristics couldn't be retrieved for #{@emitter.underscore.pluralize} (via #{url})"
|
35
37
|
done
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
41
|
+
# @private
|
39
42
|
def timeframe(t = nil)
|
40
43
|
if t
|
41
44
|
@timeframe = t
|
@@ -47,23 +50,28 @@ module Carbon
|
|
47
50
|
end
|
48
51
|
end
|
49
52
|
|
53
|
+
# @private
|
50
54
|
def emission
|
51
55
|
puts " => #{emission_in_kilograms} kg CO2e"
|
52
56
|
end
|
53
57
|
|
58
|
+
# @private
|
54
59
|
def emission_in_kilograms
|
55
|
-
|
60
|
+
impact(:timeframe => @timeframe).decisions.carbon.object.value
|
56
61
|
end
|
57
62
|
|
63
|
+
# @private
|
58
64
|
def lbs
|
59
65
|
puts " => #{emission_in_kilograms.kilograms.to :pounds} lbs CO2e"
|
60
66
|
end
|
61
67
|
alias :pounds :lbs
|
62
68
|
|
69
|
+
# @private
|
63
70
|
def tons
|
64
71
|
puts " => #{emission_in_kilograms.kilograms.to :tons} lbs CO2e"
|
65
72
|
end
|
66
73
|
|
74
|
+
# @private
|
67
75
|
def characteristics
|
68
76
|
if @input.empty?
|
69
77
|
puts " => (none)"
|
@@ -80,42 +88,40 @@ module Carbon
|
|
80
88
|
end
|
81
89
|
end
|
82
90
|
|
91
|
+
# @private
|
83
92
|
def url
|
84
|
-
|
85
|
-
url = request.url
|
86
|
-
if request.body.present?
|
87
|
-
url << '?'
|
88
|
-
url << request.body
|
89
|
-
end
|
90
|
-
puts " => #{url}"
|
93
|
+
puts " => #{impact(:timeframe => @timeframe).methodology}"
|
91
94
|
end
|
92
95
|
|
96
|
+
# @private
|
93
97
|
def methodology
|
94
98
|
first = true
|
95
|
-
|
99
|
+
impact(:timeframe => @timeframe).decisions.each do |name, report|
|
96
100
|
if first
|
97
101
|
w = ' => '
|
98
102
|
first = false
|
99
103
|
else
|
100
104
|
w = ' '
|
101
105
|
end
|
102
|
-
puts w + "#{
|
106
|
+
puts w + "#{name}: #{report.methodology}"
|
103
107
|
end
|
104
108
|
end
|
105
109
|
|
110
|
+
# @private
|
106
111
|
def reports
|
107
112
|
first = true
|
108
|
-
|
113
|
+
impact(:timeframe => @timeframe).decisions.each do |name, report|
|
109
114
|
if first
|
110
115
|
w = ' => '
|
111
116
|
first = false
|
112
117
|
else
|
113
118
|
w = ' '
|
114
119
|
end
|
115
|
-
puts w + "#{
|
120
|
+
puts w + "#{name}: #{report.object.inspect}"
|
116
121
|
end
|
117
122
|
end
|
118
123
|
|
124
|
+
# @private
|
119
125
|
def help
|
120
126
|
puts " => #{@characteristics.keys.join ', '}"
|
121
127
|
end
|
@@ -128,30 +134,28 @@ module Carbon
|
|
128
134
|
end
|
129
135
|
end
|
130
136
|
|
137
|
+
# @private
|
131
138
|
def _name
|
132
139
|
@emitter
|
133
140
|
end
|
134
141
|
|
142
|
+
# @private
|
135
143
|
def _timeframe
|
136
144
|
@timeframe
|
137
145
|
end
|
138
146
|
|
147
|
+
# @private
|
139
148
|
def inspect
|
140
|
-
"
|
149
|
+
"#<Emitter[#{@emitter}]: #{@input.inspect}>"
|
141
150
|
end
|
142
151
|
|
152
|
+
# @private
|
143
153
|
def done
|
144
154
|
$emitters[@emitter] ||= []
|
145
155
|
$emitters[@emitter] << @input
|
146
156
|
puts " => Saved as #{@emitter} ##{$emitters[@emitter].length - 1}"
|
147
157
|
quit
|
148
158
|
end
|
149
|
-
|
150
|
-
class << self
|
151
|
-
def emitter_name
|
152
|
-
@name
|
153
|
-
end
|
154
|
-
end
|
155
159
|
end
|
156
160
|
end
|
157
161
|
end
|
data/lib/carbon/version.rb
CHANGED
data/test/carbon_test.rb
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'benchmark'
|
4
|
+
require 'webmock/minitest'
|
5
|
+
WebMock.disable!
|
6
|
+
def with_web_mock
|
7
|
+
WebMock.enable!
|
8
|
+
WebMock.disable_net_connect!
|
9
|
+
yield
|
10
|
+
ensure
|
11
|
+
WebMock.disable!
|
12
|
+
end
|
13
|
+
require 'minitest/spec'
|
14
|
+
require 'minitest/autorun'
|
15
|
+
require 'minitest/reporters'
|
16
|
+
MiniTest::Unit.runner = MiniTest::SuiteRunner.new
|
17
|
+
MiniTest::Unit.runner.reporters << MiniTest::Reporters::SpecReporter.new
|
18
|
+
require 'timeframe'
|
19
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
20
|
+
require 'carbon'
|
21
|
+
|
22
|
+
Carbon.key = 'carbon_test'
|
23
|
+
|
24
|
+
class MyNissan
|
25
|
+
def name
|
26
|
+
'Nissan'
|
27
|
+
end
|
28
|
+
def to_s
|
29
|
+
raise "Not fair!"
|
30
|
+
end
|
31
|
+
alias :inspect :to_s
|
32
|
+
end
|
33
|
+
|
34
|
+
class MyNissanAltima
|
35
|
+
class << self
|
36
|
+
def all(options)
|
37
|
+
raise unless options == { :order => :year }
|
38
|
+
[ new(2000), new(2001), new(2002), new(2003), new(2004) ]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
def initialize(model_year)
|
42
|
+
@model_year = model_year
|
43
|
+
end
|
44
|
+
def make; MyNissan.new end
|
45
|
+
def model; 'Altima' end
|
46
|
+
def model_year; @model_year end # what BP knows as "year"
|
47
|
+
def fuel_type; 'R' end # what BP knows as "automobile_fuel" and keys on "code"
|
48
|
+
include Carbon
|
49
|
+
emit_as 'Automobile' do
|
50
|
+
provide(:make) { |my_nissan_altima| my_nissan_altima.make.name }
|
51
|
+
provide :model
|
52
|
+
provide :model_year, :as => :year
|
53
|
+
provide :fuel_type, :as => :automobile_fuel, :key => :code
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe Carbon do
|
58
|
+
# args could be mmm(:post, 'http://impact.brighterplanet.com/monkeys.json').to_return(:status => 500, :body => 'too many monkeys')
|
59
|
+
describe :query do
|
60
|
+
it "calculates flight impact" do
|
61
|
+
response = Carbon.query('Flight', :origin_airport => 'LAX', :destination_airport => 'SFO', :segments_per_trip => 1, :trips => 1)
|
62
|
+
response.decisions.carbon.object.value.must_be_close_to 200, 50
|
63
|
+
end
|
64
|
+
it "gets back characteristics" do
|
65
|
+
response = Carbon.query('Flight', :origin_airport => 'LAX', :destination_airport => 'SFO', :segments_per_trip => 1, :trips => 1)
|
66
|
+
response.characteristics.origin_airport.description.must_match %r{lax}i
|
67
|
+
end
|
68
|
+
it "tells you if the query is successful" do
|
69
|
+
response = Carbon.query('Flight')
|
70
|
+
response.success.must_equal true
|
71
|
+
end
|
72
|
+
it "is gentle about errors" do
|
73
|
+
response = Carbon.query('Monkey')
|
74
|
+
response.success.must_equal false
|
75
|
+
end
|
76
|
+
it "sends timeframe properly" do
|
77
|
+
response = Carbon.query('Flight', :timeframe => Timeframe.new(:year => 2009))
|
78
|
+
response.timeframe.startDate.must_equal '2009-01-01'
|
79
|
+
response.timeframe.endDate.must_equal '2010-01-01'
|
80
|
+
end
|
81
|
+
it "sends key properly" do
|
82
|
+
with_web_mock do
|
83
|
+
WebMock.stub_request(:post, 'http://impact.brighterplanet.com/flights.json').with(:key => 'carbon_test').to_return(:status => 500, :body => 'Good job')
|
84
|
+
response = Carbon.query('Flight')
|
85
|
+
response.error_body.must_equal 'Good job'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
unless ENV['SKIP_MULTI'] == 'true'
|
90
|
+
describe :multi do
|
91
|
+
before do
|
92
|
+
@queries = []
|
93
|
+
10.times do
|
94
|
+
@queries << ['Flight', {:origin_airport => 'LAX', :destination_airport => 'SFO', :segments_per_trip => 1, :trips => 1}]
|
95
|
+
@queries << ['RailTrip', {:distance => 25}]
|
96
|
+
@queries << ['AutomobileTrip', {:make => 'Nissan', :model => 'Altima'}]
|
97
|
+
@queries << ['Residence']
|
98
|
+
@queries << ['Monkey']
|
99
|
+
end
|
100
|
+
@queries = @queries.sort_by { rand }
|
101
|
+
end
|
102
|
+
it "runs multiple queries at once" do
|
103
|
+
responses = Carbon.multi(@queries)
|
104
|
+
error_count = 0
|
105
|
+
responses.each do |response|
|
106
|
+
if response.success
|
107
|
+
response.decisions.carbon.object.value.must_be :>, 0
|
108
|
+
response.decisions.carbon.object.value.must_be :<, 10_000
|
109
|
+
else
|
110
|
+
error_count += 1
|
111
|
+
end
|
112
|
+
end
|
113
|
+
error_count.must_equal 10
|
114
|
+
@queries.each_with_index do |query, i|
|
115
|
+
reference_response = Carbon.query(*query)
|
116
|
+
if reference_response.success
|
117
|
+
responses[i].decisions.must_equal reference_response.decisions
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
it "is faster than just calling #query over and over" do
|
122
|
+
# dry run
|
123
|
+
@queries.each { |query| Carbon.query(*query) }
|
124
|
+
# --
|
125
|
+
single_threaded_time = ::Benchmark.realtime do
|
126
|
+
@queries.each { |query| Carbon.query(*query) }
|
127
|
+
end
|
128
|
+
multi_threaded_time = ::Benchmark.realtime do
|
129
|
+
Carbon.multi(@queries)
|
130
|
+
end
|
131
|
+
# Carbon::#multi
|
132
|
+
# PASS test_0001_runs_multiple_queries_at_once (12.10s)
|
133
|
+
# Multi-threaded was 95% faster
|
134
|
+
# PASS test_0002_is_faster_than_just_calling_query_over_and_over (23.73s)
|
135
|
+
$stderr.puts " Multi-threaded was #{((single_threaded_time - multi_threaded_time) / single_threaded_time * 100).round}% faster"
|
136
|
+
multi_threaded_time.must_be :<, single_threaded_time
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
describe "mixin" do
|
141
|
+
describe :emit_as do
|
142
|
+
it "overwrites old emit_as blocks" do
|
143
|
+
eval %{class MyFoo; include Carbon; end}
|
144
|
+
MyFoo.emit_as('Automobile') { provide(:make) }
|
145
|
+
Carbon::Registry.instance['MyFoo'].characteristics.keys.must_equal [:make]
|
146
|
+
MyFoo.emit_as('Automobile') { provide(:model) }
|
147
|
+
Carbon::Registry.instance['MyFoo'].characteristics.keys.must_equal [:model]
|
148
|
+
end
|
149
|
+
end
|
150
|
+
describe '#impact' do
|
151
|
+
it "works" do
|
152
|
+
impact = MyNissanAltima.new(2006).impact
|
153
|
+
impact.decisions.carbon.object.value.must_be :>, 0
|
154
|
+
impact.characteristics.make.description.must_match %r{Nissan}i
|
155
|
+
impact.characteristics.model.description.must_match %r{Altima}i
|
156
|
+
impact.characteristics.year.description.to_i.must_equal 2006
|
157
|
+
impact.characteristics.automobile_fuel.description.must_match %r{regular gasoline}
|
158
|
+
end
|
159
|
+
it "takes timeframe" do
|
160
|
+
impact_2010 = MyNissanAltima.new(2006).impact(:timeframe => Timeframe.new(:year => 2010))
|
161
|
+
impact_2011 = MyNissanAltima.new(2006).impact(:timeframe => Timeframe.new(:year => 2011))
|
162
|
+
impact_2010.timeframe.startDate.must_equal '2010-01-01'
|
163
|
+
impact_2011.timeframe.startDate.must_equal '2011-01-01'
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
metadata
CHANGED
@@ -1,238 +1,184 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: carbon
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 2.0.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
- Derek Kastner
|
12
|
+
authors:
|
9
13
|
- Seamus Abshere
|
10
|
-
- Andy Rossmeissl
|
11
14
|
autorequire:
|
12
15
|
bindir: bin
|
13
16
|
cert_chain: []
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
none: false
|
20
|
-
requirements:
|
21
|
-
- - ! '>='
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 2.3.5
|
24
|
-
type: :runtime
|
17
|
+
|
18
|
+
date: 2012-03-09 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: em-http-request
|
25
22
|
prerelease: false
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: i18n
|
29
|
-
requirement: &2167482000 !ruby/object:Gem::Requirement
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
30
24
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
35
32
|
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: activesupport
|
36
36
|
prerelease: false
|
37
|
-
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: nap
|
40
|
-
requirement: &2167481360 !ruby/object:Gem::Requirement
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
38
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
46
46
|
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: multi_json
|
47
50
|
prerelease: false
|
48
|
-
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: timeframe
|
51
|
-
requirement: &2167480700 !ruby/object:Gem::Requirement
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
57
60
|
type: :runtime
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: hashie
|
58
64
|
prerelease: false
|
59
|
-
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: blockenspiel
|
62
|
-
requirement: &2167480040 !ruby/object:Gem::Requirement
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
63
66
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
68
74
|
type: :runtime
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: bombshell
|
69
78
|
prerelease: false
|
70
|
-
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: conversions
|
73
|
-
requirement: &2167479540 !ruby/object:Gem::Requirement
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
74
80
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
79
88
|
type: :runtime
|
89
|
+
version_requirements: *id005
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: conversions
|
80
92
|
prerelease: false
|
81
|
-
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: brighter_planet_metadata
|
84
|
-
requirement: &2167479120 !ruby/object:Gem::Requirement
|
93
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
85
94
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
90
102
|
type: :runtime
|
103
|
+
version_requirements: *id006
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: brighter_planet_metadata
|
91
106
|
prerelease: false
|
92
|
-
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: bombshell
|
95
|
-
requirement: &2167478680 !ruby/object:Gem::Requirement
|
107
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
96
108
|
none: false
|
97
|
-
requirements:
|
98
|
-
- -
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
101
116
|
type: :runtime
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
- - ! '>='
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
112
|
-
type: :development
|
113
|
-
prerelease: false
|
114
|
-
version_requirements: *2167478180
|
115
|
-
- !ruby/object:Gem::Dependency
|
116
|
-
name: rspec
|
117
|
-
requirement: &2167477600 !ruby/object:Gem::Requirement
|
118
|
-
none: false
|
119
|
-
requirements:
|
120
|
-
- - ! '>='
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: '0'
|
123
|
-
type: :development
|
124
|
-
prerelease: false
|
125
|
-
version_requirements: *2167477600
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: aruba
|
128
|
-
requirement: &2167476940 !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ! '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: *2167476940
|
137
|
-
- !ruby/object:Gem::Dependency
|
138
|
-
name: rake
|
139
|
-
requirement: &2167475940 !ruby/object:Gem::Requirement
|
140
|
-
none: false
|
141
|
-
requirements:
|
142
|
-
- - ! '>='
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '0'
|
145
|
-
type: :development
|
146
|
-
prerelease: false
|
147
|
-
version_requirements: *2167475940
|
148
|
-
- !ruby/object:Gem::Dependency
|
149
|
-
name: vcr
|
150
|
-
requirement: &2167475060 !ruby/object:Gem::Requirement
|
151
|
-
none: false
|
152
|
-
requirements:
|
153
|
-
- - ! '>='
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
version: '0'
|
156
|
-
type: :development
|
157
|
-
prerelease: false
|
158
|
-
version_requirements: *2167475060
|
159
|
-
description: Carbon is a Ruby API wrapper for the Brighter Planet emission estimate
|
160
|
-
web service (http://carbon.brighterplanet.com). By querying the web service, it
|
161
|
-
can estimate the carbon emissions of many real-life objects, such as cars and houses,
|
162
|
-
based on particular attributes that they may have.
|
163
|
-
email:
|
164
|
-
- derek.kastner@brighterplanet.com
|
165
|
-
executables:
|
117
|
+
version_requirements: *id007
|
118
|
+
description: Brighter Planet API client for Ruby
|
119
|
+
email:
|
120
|
+
- seamus@abshere.net
|
121
|
+
- dkastner@gmail.com
|
122
|
+
- andy@rossmeissl.net
|
123
|
+
executables:
|
166
124
|
- carbon
|
167
125
|
extensions: []
|
126
|
+
|
168
127
|
extra_rdoc_files: []
|
169
|
-
|
128
|
+
|
129
|
+
files:
|
170
130
|
- .gitignore
|
131
|
+
- CHANGELOG
|
171
132
|
- Gemfile
|
172
|
-
-
|
173
|
-
- README.rdoc
|
133
|
+
- README.markdown
|
174
134
|
- Rakefile
|
175
135
|
- bin/carbon
|
176
136
|
- carbon.gemspec
|
177
|
-
-
|
178
|
-
-
|
179
|
-
- doc/shell_example
|
180
|
-
- doc/timeout-error.png
|
181
|
-
- doc/with-committee-reports.png
|
182
|
-
- doc/without-committee-reports.png
|
137
|
+
- developer_notes/MULTI.markdown
|
138
|
+
- developer_notes/REDUCE_HTTP_CONNECTIONS.markdown
|
183
139
|
- features/shell.feature
|
184
140
|
- features/support/env.rb
|
185
141
|
- lib/carbon.rb
|
186
|
-
- lib/carbon/base.rb
|
187
|
-
- lib/carbon/emission_estimate.rb
|
188
|
-
- lib/carbon/emission_estimate/request.rb
|
189
|
-
- lib/carbon/emission_estimate/response.rb
|
190
|
-
- lib/carbon/emission_estimate/storage.rb
|
191
142
|
- lib/carbon/registry.rb
|
192
143
|
- lib/carbon/shell.rb
|
193
144
|
- lib/carbon/shell/emitter.rb
|
194
145
|
- lib/carbon/version.rb
|
195
|
-
-
|
196
|
-
- spec/fixtures/vcr_cassettes/residence.yml
|
197
|
-
- spec/lib/carbon/emission_estimate/request_spec.rb
|
198
|
-
- spec/lib/carbon/emission_estimate/response_spec.rb
|
199
|
-
- spec/lib/carbon/emission_estimate_spec.rb
|
200
|
-
- spec/lib/carbon_spec.rb
|
201
|
-
- spec/spec_helper.rb
|
202
|
-
- spec/specwatchr
|
146
|
+
- test/carbon_test.rb
|
203
147
|
homepage: https://github.com/brighterplanet/carbon
|
204
148
|
licenses: []
|
149
|
+
|
205
150
|
post_install_message:
|
206
151
|
rdoc_options: []
|
207
|
-
|
152
|
+
|
153
|
+
require_paths:
|
208
154
|
- lib
|
209
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
210
156
|
none: false
|
211
|
-
requirements:
|
212
|
-
- -
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
|
215
|
-
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
hash: 3
|
161
|
+
segments:
|
162
|
+
- 0
|
163
|
+
version: "0"
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
165
|
none: false
|
217
|
-
requirements:
|
218
|
-
- -
|
219
|
-
- !ruby/object:Gem::Version
|
220
|
-
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
hash: 3
|
170
|
+
segments:
|
171
|
+
- 0
|
172
|
+
version: "0"
|
221
173
|
requirements: []
|
174
|
+
|
222
175
|
rubyforge_project:
|
223
|
-
rubygems_version: 1.8.
|
176
|
+
rubygems_version: 1.8.17
|
224
177
|
signing_key:
|
225
178
|
specification_version: 3
|
226
|
-
summary:
|
227
|
-
|
228
|
-
test_files:
|
179
|
+
summary: Brighter Planet API client for Ruby
|
180
|
+
test_files:
|
229
181
|
- features/shell.feature
|
230
182
|
- features/support/env.rb
|
231
|
-
-
|
232
|
-
|
233
|
-
- spec/lib/carbon/emission_estimate/request_spec.rb
|
234
|
-
- spec/lib/carbon/emission_estimate/response_spec.rb
|
235
|
-
- spec/lib/carbon/emission_estimate_spec.rb
|
236
|
-
- spec/lib/carbon_spec.rb
|
237
|
-
- spec/spec_helper.rb
|
238
|
-
- spec/specwatchr
|
183
|
+
- test/carbon_test.rb
|
184
|
+
has_rdoc:
|