tronprint 0.0.7 → 0.0.8
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.
- data/README.rdoc +7 -8
- data/lib/tronprint.rb +1 -0
- data/spec/tronprint_spec.rb +14 -0
- data/tronprint.gemspec +1 -1
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -46,18 +46,17 @@ to minimize the number of API requests made to CM1.
|
|
46
46
|
==== Heroku
|
47
47
|
|
48
48
|
Tronprint is available as a Heroku add-on. Add tronprint to your app, and
|
49
|
-
your app will have an environment variable provided:
|
49
|
+
your app will have an environment variable provided:
|
50
|
+
`ENV['TRONPRINT_API_KEY']`.
|
50
51
|
|
51
52
|
The tronprint gem will handle API key setup for you, but you will still
|
52
|
-
need to configure your app to store statistics in
|
53
|
-
|
54
|
-
The easiest way to get
|
55
|
-
|
56
|
-
allow access to the filesystem, Tronprint::Aggregator's default YAML
|
57
|
-
storage option will not work. Once you have MongoDB set up, configure
|
53
|
+
need to configure your app to store statistics in a persistent data store.
|
54
|
+
By default, Tronprint will use the yaml storage option, but this won't
|
55
|
+
fly on Heroku. The easiest way to get up and running is to add the
|
56
|
+
MongoHQ add-on to your app. Once you have MongoHQ set up, configure
|
58
57
|
tronprint with a Rails initializer:
|
59
58
|
|
60
|
-
1. Open a new file, config/initializers/tronprint.rb
|
59
|
+
1. Open a new file, `config/initializers/tronprint.rb`
|
61
60
|
1. In it, write:
|
62
61
|
Tronprint.aggregator_options = {
|
63
62
|
:adapter => :mongodb,
|
data/lib/tronprint.rb
CHANGED
@@ -50,6 +50,7 @@ module Tronprint
|
|
50
50
|
# This is your Brighter Planet API key. Get one from
|
51
51
|
# {keys.brighterplanet.com}[http://keys.brighterplanet.com]
|
52
52
|
def brighter_planet_key
|
53
|
+
@brighter_planet_key ||= ENV['TRONPRINT_API_KEY']
|
53
54
|
@brighter_planet_key ||= config[:brighter_planet_key]
|
54
55
|
end
|
55
56
|
|
data/spec/tronprint_spec.rb
CHANGED
@@ -39,6 +39,20 @@ describe Tronprint do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
describe '.brighter_planet_key' do
|
43
|
+
it 'should return the key defined in ENV by default' do
|
44
|
+
Tronprint.brighter_planet_key = nil
|
45
|
+
ENV['TRONPRINT_API_KEY'] = 'abcc1234'
|
46
|
+
Tronprint.brighter_planet_key.should == 'abcc1234'
|
47
|
+
end
|
48
|
+
it 'should return the key defined in the configuration by default if no ENV is given' do
|
49
|
+
Tronprint.brighter_planet_key = nil
|
50
|
+
ENV['TRONPRINT_API_KEY'] = nil
|
51
|
+
Tronprint.stub!(:config).and_return({ :brighter_planet_key => 'aaa' })
|
52
|
+
Tronprint.brighter_planet_key.should == 'aaa'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
42
56
|
describe '.config' do
|
43
57
|
it 'should return a configuration loaded from disk' do
|
44
58
|
Tronprint.stub!(:load_config).and_return nil
|
data/tronprint.gemspec
CHANGED
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
|
+
- 8
|
9
|
+
version: 0.0.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Derek Kastner
|
@@ -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: 696289997
|
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: 696289997
|
189
189
|
segments:
|
190
190
|
- 0
|
191
191
|
version: "0"
|