tronprint 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +36 -19
- data/tronprint.gemspec +3 -3
- metadata +6 -6
data/README.rdoc
CHANGED
@@ -20,7 +20,8 @@ is used.
|
|
20
20
|
|
21
21
|
If you haven't already, go to http://keys.brighterplanet.com and sign up for an
|
22
22
|
API key. Non-commercial use of CM1 is free, but commercial use is
|
23
|
-
{charged}[http://carbon.brighterplanet.com/pricing] per-query.
|
23
|
+
{charged}[http://carbon.brighterplanet.com/pricing] per-query. Heroku users are
|
24
|
+
charged per-month.
|
24
25
|
|
25
26
|
=== Rails
|
26
27
|
|
@@ -44,20 +45,25 @@ to minimize the number of API requests made to CM1.
|
|
44
45
|
|
45
46
|
==== Heroku
|
46
47
|
|
48
|
+
Tronprint is available as a Heroku add-on. Add tronprint to your app, and
|
49
|
+
your app will have an environment variable provided: `ENV['TRONPRINT_API_KEY']`.
|
50
|
+
|
51
|
+
The tronprint gem will handle API key setup for you, but you will still
|
52
|
+
need to configure your app to store statistics in MongoDB.
|
53
|
+
|
47
54
|
The easiest way to get started on Heroku is to sign up for a free MongoHQ
|
48
55
|
account to be used for the Tronprint::Aggregator. Since Heroku doesn't
|
49
56
|
allow access to the filesystem, Tronprint::Aggregator's default YAML
|
50
|
-
storage option will not work. Once you have MongoDB set up,
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
:
|
57
|
-
:
|
58
|
-
:
|
59
|
-
|
60
|
-
:application_name: my_app
|
57
|
+
storage option will not work. Once you have MongoDB set up, configure
|
58
|
+
tronprint with a Rails initializer:
|
59
|
+
|
60
|
+
1. Open a new file, config/initializers/tronprint.rb
|
61
|
+
1. In it, write:
|
62
|
+
Tronprint.aggregator_options = {
|
63
|
+
:adapter => :mongodb,
|
64
|
+
:uri => ENV['MONGOHQ_URL'],
|
65
|
+
:collection => 'tronprint'
|
66
|
+
}
|
61
67
|
|
62
68
|
=== Other Ruby Apps
|
63
69
|
|
@@ -73,12 +79,6 @@ It can be converted to a float for the amount in kilograms or other
|
|
73
79
|
methods, such as EmissionEstimate#methodology can provide a link to the
|
74
80
|
methodology statement used to derive the estimate.
|
75
81
|
|
76
|
-
=== Aggregator Configuration Notes
|
77
|
-
|
78
|
-
If you want to hide your aggregator configuration, you can leave the :aggregator_options
|
79
|
-
item blank in config/tronprint.yml. In your application, manually set
|
80
|
-
Tronprint.aggregator_options to the values you desire.
|
81
|
-
|
82
82
|
== Configuration
|
83
83
|
|
84
84
|
There are several properties of Tronprint that can be configured. The configuration
|
@@ -88,7 +88,24 @@ can be set:
|
|
88
88
|
:zip_code:: The ZIP code where the server or host computer resides.
|
89
89
|
:brighter_planet_key:: Your Brighter Planet CM1 key. Get one from {keys.brighterplanet.com}[http://keys.brighterplanet.com].
|
90
90
|
:application_name:: The name of your application.
|
91
|
-
:aggregator_options:: A hash of options to send to the aggregator. A sub-option of :adapter is required. This corresponds to the name of an adapter supported by {moneta}[http://github.com/
|
91
|
+
:aggregator_options:: A hash of options to send to the aggregator. A sub-option of :adapter is required. This corresponds to the name of an adapter supported by {moneta}[http://github.com/dkastner/moneta]. All other sub-options given are passed on to the moneta adapter's initializer.
|
92
|
+
|
93
|
+
=== Configuring the aggregator
|
94
|
+
|
95
|
+
Tronprint needs to write the statistics it collects to a persistent data
|
96
|
+
store. There are two ways to configure this.
|
97
|
+
|
98
|
+
The first way is to edit config/tronprint.yml as mentioned above.
|
99
|
+
|
100
|
+
The second way is to manually set the aggregator options before Tronprint.run is called.
|
101
|
+
In Rails, this can be done with an initializer. Just set Tronprint.aggregator_options to
|
102
|
+
the options you would normally set in config/tronprint.yml.
|
103
|
+
|
104
|
+
== Examples
|
105
|
+
|
106
|
+
You can see an example Rails app using tronprint at http://github.com/brighterplanet/yaktrak.
|
107
|
+
Files of note: config/initializers/tronprint.rb, Gemfile, app/views/trackings/_form.html.rb.
|
108
|
+
The live example is at http://yaktrak.org
|
92
109
|
|
93
110
|
== Note on Patches/Pull Requests
|
94
111
|
|
data/tronprint.gemspec
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'tronprint'
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.7"
|
6
6
|
|
7
7
|
s.authors = ['Derek Kastner']
|
8
|
-
s.date = "2011-01-
|
8
|
+
s.date = "2011-01-26"
|
9
9
|
s.description = %q{A gem for monitoring the carbon footprint of your ruby app}
|
10
10
|
s.email = %q{dkastner@gmail.com}
|
11
11
|
s.homepage = %q{http://github.com/brighterplanet/tronprint}
|
@@ -35,6 +35,6 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.add_development_dependency 'sandbox'
|
36
36
|
s.add_runtime_dependency 'carbon', '~> 1.0.3'
|
37
37
|
s.add_runtime_dependency 'i18n'
|
38
|
-
s.add_runtime_dependency 'moneta'
|
38
|
+
s.add_runtime_dependency 'dkastner-moneta'
|
39
39
|
end
|
40
40
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 7
|
9
|
+
version: 0.0.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Derek Kastner
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-26 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -114,7 +114,7 @@ dependencies:
|
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: *id007
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
|
-
name: moneta
|
117
|
+
name: dkastner-moneta
|
118
118
|
requirement: &id008 !ruby/object:Gem::Requirement
|
119
119
|
none: false
|
120
120
|
requirements:
|
@@ -176,7 +176,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
176
176
|
requirements:
|
177
177
|
- - ">="
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
hash:
|
179
|
+
hash: -124500141
|
180
180
|
segments:
|
181
181
|
- 0
|
182
182
|
version: "0"
|
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
requirements:
|
186
186
|
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
hash:
|
188
|
+
hash: -124500141
|
189
189
|
segments:
|
190
190
|
- 0
|
191
191
|
version: "0"
|