tronprint 0.0.11 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Tronprint
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.13"
3
3
  end
data/lib/tronprint.rb CHANGED
@@ -86,7 +86,7 @@ module Tronprint
86
86
 
87
87
  # The current configuration.
88
88
  def config
89
- load_config || default_config
89
+ default_config.update load_config
90
90
  end
91
91
 
92
92
  def config=(val)
@@ -99,6 +99,7 @@ module Tronprint
99
99
  return @loaded_config unless @loaded_config.nil?
100
100
  path = File.expand_path('config/tronprint.yml', Dir.pwd)
101
101
  @loaded_config = YAML::load_file path if File.exist? path
102
+ @loaded_config ||= {}
102
103
  end
103
104
 
104
105
  # By default, the YAML adapter is used and aggregate statistics
@@ -112,7 +113,7 @@ module Tronprint
112
113
  @default_config[:brighter_planet_key] = ENV['TRONPRINT_API_KEY'] if ENV['TRONPRINT_API_KEY']
113
114
  if ENV['MONGOHQ_URL']
114
115
  @default_config[:aggregator_options] = {
115
- :url => ENV['MONGOHQ_URL'],
116
+ :uri => ENV['MONGOHQ_URL'],
116
117
  :adapter => :mongodb
117
118
  }
118
119
  end
@@ -49,17 +49,19 @@ describe Tronprint do
49
49
 
50
50
  describe '.config' do
51
51
  it 'should return a configuration loaded from disk' do
52
- Tronprint.stub!(:load_config).and_return nil
53
- Tronprint.stub!(:default_config).and_return :foo => :bar
54
- Tronprint.config.should == { :foo => :bar }
52
+ Tronprint.stub!(:load_config).and_return :foo => :bar
53
+ Tronprint.config.should include(:foo => :bar)
55
54
  end
56
55
  it 'should return a default configuration if no config file exists' do
57
- Tronprint.stub!(:load_config).and_return :foo => :bar
58
- Tronprint.config.should == { :foo => :bar }
56
+ Tronprint.stub!(:default_config).and_return :foo => :bar
57
+ Tronprint.config.should include(:foo => :bar)
59
58
  end
60
59
  end
61
60
 
62
61
  describe '.load_config' do
62
+ before :each do
63
+ Tronprint.instance_variable_set :@loaded_config, nil
64
+ end
63
65
  it 'should load a config file from cwd/config/tronprint.yml if it exists' do
64
66
  Dir.stub!(:pwd).and_return '/some/dir'
65
67
  File.stub!(:exist?).and_return true
@@ -71,7 +73,7 @@ describe Tronprint do
71
73
  Tronprint.instance_variable_set :@loaded_config, nil
72
74
  Dir.stub!(:pwd).and_return '/some/dir'
73
75
  File.stub!(:exist?).and_return false
74
- Tronprint.load_config.should be_nil
76
+ Tronprint.load_config.should be_empty
75
77
  end
76
78
  end
77
79
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 11
9
- version: 0.0.11
8
+ - 13
9
+ version: 0.0.13
10
10
  platform: ruby
11
11
  authors:
12
12
  - Derek Kastner
@@ -19,7 +19,6 @@ default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: cucumber
22
- prerelease: false
23
22
  requirement: &id001 !ruby/object:Gem::Requirement
24
23
  none: false
25
24
  requirements:
@@ -29,10 +28,10 @@ dependencies:
29
28
  - 0
30
29
  version: "0"
31
30
  type: :development
31
+ prerelease: false
32
32
  version_requirements: *id001
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bueller
35
- prerelease: false
36
35
  requirement: &id002 !ruby/object:Gem::Requirement
37
36
  none: false
38
37
  requirements:
@@ -44,10 +43,10 @@ dependencies:
44
43
  - 2
45
44
  version: 0.0.2
46
45
  type: :development
46
+ prerelease: false
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rake
50
- prerelease: false
51
50
  requirement: &id003 !ruby/object:Gem::Requirement
52
51
  none: false
53
52
  requirements:
@@ -57,10 +56,10 @@ dependencies:
57
56
  - 0
58
57
  version: "0"
59
58
  type: :development
59
+ prerelease: false
60
60
  version_requirements: *id003
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rspec
63
- prerelease: false
64
63
  requirement: &id004 !ruby/object:Gem::Requirement
65
64
  none: false
66
65
  requirements:
@@ -71,10 +70,10 @@ dependencies:
71
70
  - 0
72
71
  version: "2.0"
73
72
  type: :development
73
+ prerelease: false
74
74
  version_requirements: *id004
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: sandbox
77
- prerelease: false
78
77
  requirement: &id005 !ruby/object:Gem::Requirement
79
78
  none: false
80
79
  requirements:
@@ -84,10 +83,10 @@ dependencies:
84
83
  - 0
85
84
  version: "0"
86
85
  type: :development
86
+ prerelease: false
87
87
  version_requirements: *id005
88
88
  - !ruby/object:Gem::Dependency
89
89
  name: carbon
90
- prerelease: false
91
90
  requirement: &id006 !ruby/object:Gem::Requirement
92
91
  none: false
93
92
  requirements:
@@ -99,10 +98,10 @@ dependencies:
99
98
  - 3
100
99
  version: 1.0.3
101
100
  type: :runtime
101
+ prerelease: false
102
102
  version_requirements: *id006
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: i18n
105
- prerelease: false
106
105
  requirement: &id007 !ruby/object:Gem::Requirement
107
106
  none: false
108
107
  requirements:
@@ -112,10 +111,10 @@ dependencies:
112
111
  - 0
113
112
  version: "0"
114
113
  type: :runtime
114
+ prerelease: false
115
115
  version_requirements: *id007
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: dkastner-moneta
118
- prerelease: false
119
118
  requirement: &id008 !ruby/object:Gem::Requirement
120
119
  none: false
121
120
  requirements:
@@ -125,6 +124,7 @@ dependencies:
125
124
  - 0
126
125
  version: "0"
127
126
  type: :runtime
127
+ prerelease: false
128
128
  version_requirements: *id008
129
129
  description: A gem for monitoring the carbon footprint of your ruby app
130
130
  email: dkastner@gmail.com
@@ -177,6 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
+ hash: 4030675026006526045
180
181
  segments:
181
182
  - 0
182
183
  version: "0"
@@ -185,6 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
186
  requirements:
186
187
  - - ">="
187
188
  - !ruby/object:Gem::Version
189
+ hash: 4030675026006526045
188
190
  segments:
189
191
  - 0
190
192
  version: "0"