yell 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -5,5 +5,9 @@ gemspec
5
5
 
6
6
  group :development, :test do
7
7
  gem "rake"
8
+
9
+ gem "rspec"
10
+ gem "rr"
11
+ gem "timecop"
8
12
  end
9
13
 
@@ -9,7 +9,7 @@ module Yell #:nodoc:
9
9
  class Configuration
10
10
 
11
11
  def self.load!( file )
12
- YAML.load( ::File.read(file) )
12
+ YAML.load_file( file )[ Yell.env ] || {}
13
13
  end
14
14
 
15
15
  end
data/lib/yell/level.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Yell #:nodoc:
4
- InterpretRegexp = /(at|gt|gte|lt|lte)?\.?(#{Yell::Severities.join('|')}})/i
5
4
 
6
5
  # The +Level+ class handles the severities for you in order to determine
7
6
  # if an adapter should log or not.
@@ -42,6 +41,8 @@ module Yell #:nodoc:
42
41
  end
43
42
  end
44
43
 
44
+ InterpretRegexp = /(at|gt|gte|lt|lte)?\.?(#{Yell::Severities.join('|')})/i
45
+
45
46
  attr_reader :severities
46
47
 
47
48
  # Create a new level instance.
data/lib/yell/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Yell #:nodoc:
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0"
5
5
 
6
6
  end
7
7
 
data/lib/yell.rb CHANGED
@@ -49,7 +49,7 @@ module Yell #:nodoc:
49
49
  end
50
50
 
51
51
  def env #:nodoc:
52
- ENV['YELL_ENV'] || ENV['RACK_ENV'] || 'development'
52
+ ENV['YELL_ENV'] || ENV['RACK_ENV'] ||ENV['RAILS_ENV'] || 'development'
53
53
  end
54
54
 
55
55
  def load!( file )
@@ -68,11 +68,11 @@ module Yell #:nodoc:
68
68
 
69
69
  end
70
70
 
71
+ require File.dirname(__FILE__) + '/yell/configuration'
72
+
71
73
  require File.dirname(__FILE__) + '/yell/event'
72
74
  require File.dirname(__FILE__) + '/yell/level'
73
75
  require File.dirname(__FILE__) + '/yell/formatter'
74
76
  require File.dirname(__FILE__) + '/yell/adapters'
75
77
  require File.dirname(__FILE__) + '/yell/logger'
76
78
 
77
- require File.dirname(__FILE__) + '/yell/configuration'
78
-
@@ -1,7 +1,7 @@
1
- :level: info
1
+ development:
2
+ :level: info
2
3
 
3
- :adapters:
4
- - :stdout:
5
- :level: "lt.error"
6
- - :stderr:
7
- :level: "gte.error"
4
+ :adapters:
5
+ - :stdout
6
+ - :stderr:
7
+ :level: "gte.error"
@@ -3,11 +3,32 @@ require 'spec_helper'
3
3
  describe Yell::Configuration do
4
4
 
5
5
  describe ":load!" do
6
- let( :file ) { File.expand_path File.dirname(__FILE__) + '/../fixtures/yell.yml' }
7
- let( :configuration ) { Yell::Configuration.load!( file ) }
6
+ let( :file ) { File.dirname(__FILE__) + '/../fixtures/yell.yml' }
7
+ let( :config ) { Yell::Configuration.load!( file ) }
8
8
 
9
- it "should return the hash from the given file" do
10
- YAML.load( File.read(file) ).should == configuration
9
+ subject { config }
10
+
11
+ it { should be_kind_of Hash }
12
+ it { should have_key :level }
13
+ it { should have_key :adapters }
14
+
15
+ context :level do
16
+ subject { config[:level] }
17
+
18
+ it { should == "info" }
19
+ end
20
+
21
+ context :adapters do
22
+ subject { config[:adapters] }
23
+
24
+ it { should be_kind_of Array }
25
+
26
+ # stdout
27
+ it { subject.first.should == :stdout }
28
+
29
+ # stderr
30
+ it { subject.last.should be_kind_of Hash }
31
+ it { subject.last.should == { :stderr => {:level => 'gte.error'} } }
11
32
  end
12
33
  end
13
34
 
data/spec/yell_spec.rb CHANGED
@@ -22,16 +22,14 @@ describe Yell do
22
22
  end
23
23
 
24
24
  context :load! do
25
- subject { Yell.load!( File.dirname(__FILE__) + '/fixtures/yell.yml' ) }
25
+ subject { Yell.load!( 'yell.yml' ) }
26
26
 
27
- let( :adapters ) { subject.instance_variable_get :@adapters }
27
+ before do
28
+ mock( Yell::Configuration ).load!( 'yell.yml' ) { {} }
29
+ end
28
30
 
29
31
  it { should be_kind_of Yell::Logger }
30
-
31
- it "should return a Yell instacne with the configuration for a file" do
32
- adapters.first.should be_kind_of Yell::Adapters::Stdout
33
- adapters.last.should be_kind_of Yell::Adapters::Stderr
34
- end
35
32
  end
36
33
 
37
34
  end
35
+
data/yell.gemspec CHANGED
@@ -18,8 +18,4 @@ Gem::Specification.new do |s|
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
-
22
- s.add_development_dependency "rspec"
23
- s.add_development_dependency "rr"
24
- s.add_development_dependency "timecop"
25
21
  end
metadata CHANGED
@@ -1,67 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: yell
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 9
8
- - 0
9
- version: 0.9.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.10.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Rudolf Schmidt
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-05-11 00:00:00 +02:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: rspec
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
30
- type: :development
31
- version_requirements: *id001
32
- - !ruby/object:Gem::Dependency
33
- name: rr
34
- prerelease: false
35
- requirement: &id002 !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- segments:
40
- - 0
41
- version: "0"
42
- type: :development
43
- version_requirements: *id002
44
- - !ruby/object:Gem::Dependency
45
- name: timecop
46
- prerelease: false
47
- requirement: &id003 !ruby/object:Gem::Requirement
48
- requirements:
49
- - - ">="
50
- - !ruby/object:Gem::Version
51
- segments:
52
- - 0
53
- version: "0"
54
- type: :development
55
- version_requirements: *id003
56
- description: Yell - Your Extensible Logging Library. Define multiple adapters, various log level combinations or message formatting options like you've never done before
12
+ date: 2012-05-12 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Yell - Your Extensible Logging Library. Define multiple adapters, various
15
+ log level combinations or message formatting options like you've never done before
57
16
  email:
58
17
  executables: []
59
-
60
18
  extensions: []
61
-
62
19
  extra_rdoc_files: []
63
-
64
- files:
20
+ files:
65
21
  - .gitignore
66
22
  - .travis.yml
67
23
  - Gemfile
@@ -105,37 +61,31 @@ files:
105
61
  - spec/yell/logger_spec.rb
106
62
  - spec/yell_spec.rb
107
63
  - yell.gemspec
108
- has_rdoc: true
109
64
  homepage: http://rudionrails.github.com/yell
110
65
  licenses: []
111
-
112
66
  post_install_message:
113
67
  rdoc_options: []
114
-
115
- require_paths:
68
+ require_paths:
116
69
  - lib
117
- required_ruby_version: !ruby/object:Gem::Requirement
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- segments:
122
- - 0
123
- version: "0"
124
- required_rubygems_version: !ruby/object:Gem::Requirement
125
- requirements:
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- segments:
129
- - 0
130
- version: "0"
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
131
82
  requirements: []
132
-
133
83
  rubyforge_project: yell
134
- rubygems_version: 1.3.6
84
+ rubygems_version: 1.8.23
135
85
  signing_key:
136
86
  specification_version: 3
137
87
  summary: Yell - Your Extensible Logging Library
138
- test_files:
88
+ test_files:
139
89
  - spec/fixtures/yell.yml
140
90
  - spec/spec_helper.rb
141
91
  - spec/yell/adapters/base_spec.rb