rf_logger 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1d037fd349b2f9bae338bd453fe34222c6461496
4
- data.tar.gz: 2fc84efd2d6ceb4b46b7b9bf11ddb85e56fb082a
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzJiN2RjZWI3M2YyOWM3NGVmOGEzMDIxYjNjZmU4MDhhMDk1NDI1Ng==
5
+ data.tar.gz: !binary |-
6
+ MzkzM2FlNzhjNDY0YWM3NzJhOTc4ZmZhODAyZDhiNmM2ZjZkNzY4Ng==
5
7
  SHA512:
6
- metadata.gz: 28ff40a004c18a7b311d1cc5c99b62bd2f7b9df7ce6a6120137e33d7d298a6d40c45ce5b92a028c30c03009102e3533a627b4c6fa368ad2e147f80b8c55f6250
7
- data.tar.gz: f6caa2b848a73042f72d19423c20cc835aaccb1b9c0f3d07e187cc82514e520270ed51293c6e1434d46d97acdd15287b0c398bd835935f1071d372e81f5a7a00
8
+ metadata.gz: !binary |-
9
+ MzZhOTYzMTg2ZWVmMzEyNTZiYzNhNDdjOTE4YzIyN2Q5NDc4NmEzNWVkYjc0
10
+ OTk5NTYxZTRiNmIzZmE3Nzc4Nzk5YmYyOWZhMGI2NzY5YTIyODg0ODFmYzMx
11
+ YmFjZjUzY2NiOWViMjFmMmY1NzUwMmRhZjk4NjE1MTFlNDY1YWM=
12
+ data.tar.gz: !binary |-
13
+ ODQyNjBmMmNkOGVkZDhjNDQ5YTZmMWU1NDhmMmNhMTRhNmRhY2Q1MjM2N2Q3
14
+ YzIxZWMwMGUyNTE3MDBjODQwYjg2ZTVjZDQ1NTljMTk1MmVlNDVkNTQ1NDRj
15
+ ZDk2ZWI2ZGUwYzYxNWQ4MjAyM2RkMGYxMWViNzdiYWU1ZjdiMDU=
@@ -10,7 +10,7 @@ module RfLogger
10
10
 
11
11
  def subject
12
12
  interpolated_configured_subject ||
13
- "#{@level.upcase}! (#{@actor}/#{@action}"
13
+ "#{@level.upcase}! (#{@actor}/#{@action})"
14
14
  end
15
15
 
16
16
  def details
@@ -1,3 +1,3 @@
1
1
  module RfLogger
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/rf_logger.rb CHANGED
@@ -24,5 +24,24 @@ module RfLogger
24
24
  def configuration
25
25
  @configuration ||= RfLogger::Configuration.new
26
26
  end
27
+
28
+ def configure(&block)
29
+ unless block
30
+ raise ArgumentError.new("You tried to .configure without a block!")
31
+ end
32
+ yield configuration
33
+ end
34
+
35
+ def clear_configuration!
36
+ @configuration = nil
37
+ end
38
+
39
+ def configure!(&block)
40
+ unless block
41
+ raise ArgumentError.new('You tried to .configure without a block!')
42
+ end
43
+ clear_configuration!
44
+ yield configuration
45
+ end
27
46
  end
28
47
  end
data/rf_logger.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'rf_logger/version'
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'rf_logger'
8
- s.version = '0.0.2'
8
+ s.version = '0.0.3'
9
9
  s.date = '2014-02-20'
10
10
  s.summary = "A logger that adheres to Renewable Funding logging conventions"
11
11
  s.description = "A logger that allows specification of severity, applicable entity/records, metadata, and optional notifications"
@@ -81,5 +81,17 @@ describe RfLogger::SequelLogger do
81
81
 
82
82
  described_class.add(:info, { :action => 'palpitate' })
83
83
  end
84
+
85
+ it 'returns a hash for metadata even though it is stored as JSON' do
86
+ subject.metadata = {'foo' => 'bar'}
87
+ expect(subject.metadata).to eq({'foo' => 'bar'})
88
+ end
89
+ end
90
+
91
+ describe 'display_level' do
92
+ it 'returns a human-readable level instead of an integer' do
93
+ subject.level = 1
94
+ expect(subject.display_level).to eq(:info)
95
+ end
84
96
  end
85
97
  end
@@ -0,0 +1,69 @@
1
+ describe RfLogger do
2
+ describe ".configure" do
3
+ it 'yields the current configuration' do
4
+ existing_configuration = described_class.configuration
5
+ described_class.configure do |c|
6
+ expect(c).to equal(existing_configuration)
7
+ end
8
+ end
9
+
10
+ it 'allows multiple cumulative configuration blocks' do
11
+ described_class.configure do |c|
12
+ c.notification_subject = 'Foo'
13
+ end
14
+
15
+ described_class.configure do |c|
16
+ c.environment = 'production'
17
+ end
18
+
19
+ described_class.configuration.notification_subject.should == 'Foo'
20
+ described_class.configuration.environment.should == 'production'
21
+ end
22
+
23
+ it 'requires a block' do
24
+ expect { described_class.configure }.to raise_error(ArgumentError)
25
+ end
26
+ end
27
+
28
+ describe ".configure!" do
29
+ it 'resets configuration and yields new configuration' do
30
+ existing_configuration = described_class.configuration { |c| c.environment = 'boo' }
31
+ described_class.configure! do |c|
32
+ expect(c).not_to equal(existing_configuration)
33
+ expect(c).to equal(described_class.configuration)
34
+ end
35
+ end
36
+
37
+ it 'requires a block and does not reset without one' do
38
+ existing_configuration = described_class.configuration { |c| c.environment = 'boo' }
39
+ expect { described_class.configure! }.to raise_error(ArgumentError)
40
+ expect(described_class.configuration).to eq(existing_configuration)
41
+ end
42
+ end
43
+
44
+ describe '.clear_configuration!' do
45
+ it 'resets configuration' do
46
+ old_config = described_class.configuration
47
+ described_class.clear_configuration!
48
+ described_class.configuration.should_not == old_config
49
+ end
50
+ end
51
+
52
+ describe '.environment' do
53
+ it 'can set directly' do
54
+ described_class.environment = 'foo'
55
+ described_class.configuration.environment.should == 'foo'
56
+ end
57
+ end
58
+
59
+ describe '.configuration' do
60
+ it 'creates an instance of RfLogger::Configuration' do
61
+ described_class.configuration.should be_an_instance_of(RfLogger::Configuration)
62
+ end
63
+
64
+ it 'returns the same instance when called multiple times' do
65
+ configuration = described_class.configuration
66
+ described_class.configuration.should == configuration
67
+ end
68
+ end
69
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rf_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Miller
@@ -31,84 +31,84 @@ dependencies:
31
31
  name: rake
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - '>='
34
+ - - ! '>='
35
35
  - !ruby/object:Gem::Version
36
36
  version: '0'
37
37
  type: :development
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - '>='
41
+ - - ! '>='
42
42
  - !ruby/object:Gem::Version
43
43
  version: '0'
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: rspec
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - '>='
48
+ - - ! '>='
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - '>='
55
+ - - ! '>='
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: watchr
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - '>='
62
+ - - ! '>='
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '>='
69
+ - - ! '>='
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: debugger
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '>='
76
+ - - ! '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  type: :development
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - '>='
83
+ - - ! '>='
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: simplecov
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - '>='
90
+ - - ! '>='
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  type: :development
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - '>='
97
+ - - ! '>='
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: sequel
102
102
  requirement: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - '>='
104
+ - - ! '>='
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  type: :development
108
108
  prerelease: false
109
109
  version_requirements: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ! '>='
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  description: A logger that allows specification of severity, applicable entity/records,
@@ -139,6 +139,7 @@ files:
139
139
  - spec/lib/rf_logger/notifications/error_notification_spec.rb
140
140
  - spec/lib/rf_logger/sequel_logger_spec.rb
141
141
  - spec/lib/rf_logger/simple_logger_spec.rb
142
+ - spec/lib/rf_logger_spec.rb
142
143
  - spec/spec_helper.rb
143
144
  homepage: ''
144
145
  licenses:
@@ -150,17 +151,17 @@ require_paths:
150
151
  - lib
151
152
  required_ruby_version: !ruby/object:Gem::Requirement
152
153
  requirements:
153
- - - '>='
154
+ - - ! '>='
154
155
  - !ruby/object:Gem::Version
155
156
  version: '0'
156
157
  required_rubygems_version: !ruby/object:Gem::Requirement
157
158
  requirements:
158
- - - '>='
159
+ - - ! '>='
159
160
  - !ruby/object:Gem::Version
160
161
  version: '0'
161
162
  requirements: []
162
163
  rubyforge_project:
163
- rubygems_version: 2.0.14
164
+ rubygems_version: 2.1.11
164
165
  signing_key:
165
166
  specification_version: 4
166
167
  summary: A logger that adheres to Renewable Funding logging conventions
@@ -171,4 +172,5 @@ test_files:
171
172
  - spec/lib/rf_logger/notifications/error_notification_spec.rb
172
173
  - spec/lib/rf_logger/sequel_logger_spec.rb
173
174
  - spec/lib/rf_logger/simple_logger_spec.rb
175
+ - spec/lib/rf_logger_spec.rb
174
176
  - spec/spec_helper.rb