yell 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -92,18 +92,28 @@ module Yell #:nodoc:
92
92
  # end
93
93
  def compile!( name, &block )
94
94
  # Get the already defined method
95
- m = instance_method name
95
+ m = instance_method( name )
96
96
 
97
97
  # Create a new method with leading underscore
98
- define_method "_#{name}", &block
99
- _m = instance_method "_#{name}"
100
- remove_method "_#{name}"
98
+ define_method( "_#{name}", &block )
99
+ _m = instance_method( "_#{name}" )
100
+ remove_method( "_#{name}" )
101
101
 
102
102
  # Define instance method
103
+ define!( name, _m, m, &block )
104
+ end
105
+
106
+ # Define instance method by given name and call the unbound
107
+ # methods in order with provided block.
108
+ def define!( name, *methods, &block )
103
109
  if block.arity == 0
104
- define_method(name) { _m.bind(self).call; m.bind(self).call }
110
+ define_method( name ) do
111
+ methods.each { |m| m.bind(self).call }
112
+ end
105
113
  else
106
- define_method(name) { |*args| _m.bind(self).call(*args); m.bind(self).call(*args) }
114
+ define_method( name ) do |*args|
115
+ methods.each { |m| m.bind(self).call(*args) }
116
+ end
107
117
  end
108
118
  end
109
119
  end
@@ -18,11 +18,11 @@ module Yell #:nodoc:
18
18
  setup do |options|
19
19
  @date = nil # default; do not override --R
20
20
 
21
- self.date_pattern = options.fetch( :date_pattern, DefaultDatePattern )
22
- self.symlink_original_filename = options.fetch( :symlink_original_filename, false )
23
- self.keep = options.fetch( :keep, 0 )
21
+ self.date_pattern = options.fetch(:date_pattern, DefaultDatePattern)
22
+ self.symlink_original_filename = options.fetch(:symlink_original_filename, false)
23
+ self.keep = options.fetch(:keep, 0)
24
24
 
25
- @original_filename = options.fetch( :filename, default_filename )
25
+ @original_filename = ::File.expand_path options.fetch(:filename, default_filename)
26
26
  options[:filename] = @original_filename
27
27
  end
28
28
 
@@ -8,7 +8,7 @@ module Yell #:nodoc:
8
8
  class File < Yell::Adapters::Io
9
9
 
10
10
  setup do |options|
11
- @filename = options.fetch( :filename, default_filename )
11
+ @filename = ::File.expand_path options.fetch(:filename, default_filename)
12
12
  end
13
13
 
14
14
 
@@ -27,7 +27,9 @@ module Yell #:nodoc:
27
27
  end
28
28
 
29
29
  def default_filename #:nodoc:
30
- ::File.directory?("log") ? "log/#{Yell.env}.log" : "#{Yell.env}.log"
30
+ logdir = ::File.expand_path("log")
31
+
32
+ ::File.expand_path ::File.directory?(logdir) ? "#{logdir}/#{Yell.env}.log" : "#{Yell.env}.log"
31
33
  end
32
34
 
33
35
  end
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.12.0"
4
+ VERSION = "0.12.1"
5
5
 
6
6
  end
7
7
 
@@ -19,7 +19,7 @@ describe Yell::Adapters::File do
19
19
  let( :event ) { Yell::Event.new(1, "Hello World") }
20
20
 
21
21
  context "default filename" do
22
- let( :filename ) { "#{Yell.env}.log" }
22
+ let( :filename ) { File.expand_path "#{Yell.env}.log" }
23
23
  let( :adapter ) { Yell::Adapters::File.new }
24
24
 
25
25
  it "should print to file" do
@@ -30,7 +30,7 @@ describe Yell::Adapters::File do
30
30
  end
31
31
 
32
32
  context "with given filename" do
33
- let( :filename ) { 'filename.log' }
33
+ let( :filename ) { File.expand_path 'filename.log' }
34
34
  let( :adapter ) { Yell::Adapters::File.new( :filename => filename ) }
35
35
 
36
36
  it "should print to file" do
data/yell.gemspec CHANGED
@@ -19,3 +19,4 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
  end
22
+
metadata CHANGED
@@ -1,103 +1,97 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: yell
3
- version: !ruby/object:Gem::Version
4
- version: 0.12.0
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.12.1
6
6
  platform: ruby
7
- authors:
8
- - Rudolf Schmidt
7
+ authors:
8
+ - Rudolf Schmidt
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-29 00:00:00.000000000 Z
12
+
13
+ date: 2012-08-29 00:00:00 Z
13
14
  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
15
+
16
+ description: Yell - Your Extensible Logging Library. Define multiple adapters, various log level combinations or message formatting options like you've never done before
16
17
  email:
17
18
  executables: []
19
+
18
20
  extensions: []
21
+
19
22
  extra_rdoc_files: []
20
- files:
21
- - .gitignore
22
- - .travis.yml
23
- - Gemfile
24
- - LICENSE.txt
25
- - README.md
26
- - Rakefile
27
- - examples/001-basic-usage.rb
28
- - examples/002.1-log-level-basics.rb
29
- - examples/002.2-log-level-on-certain-severities-only.rb
30
- - examples/002.3-log-level-within-range.rb
31
- - examples/003.1-formatting-DefaultFormat.rb
32
- - examples/003.2-formatting-BasicFormat.rb
33
- - examples/003.3-formatting-ExtendedFormat.rb
34
- - examples/003.4-formatting-on-your-own.rb
35
- - examples/004.1-colorizing-the-log-output.rb
36
- - lib/yell.rb
37
- - lib/yell/adapters.rb
38
- - lib/yell/adapters/base.rb
39
- - lib/yell/adapters/datefile.rb
40
- - lib/yell/adapters/file.rb
41
- - lib/yell/adapters/io.rb
42
- - lib/yell/adapters/streams.rb
43
- - lib/yell/configuration.rb
44
- - lib/yell/event.rb
45
- - lib/yell/formatter.rb
46
- - lib/yell/level.rb
47
- - lib/yell/logger.rb
48
- - lib/yell/version.rb
49
- - spec/fixtures/yell.yml
50
- - spec/spec_helper.rb
51
- - spec/yell/adapters/base_spec.rb
52
- - spec/yell/adapters/datefile_spec.rb
53
- - spec/yell/adapters/file_spec.rb
54
- - spec/yell/adapters/io_spec.rb
55
- - spec/yell/adapters/streams_spec.rb
56
- - spec/yell/adapters_spec.rb
57
- - spec/yell/configuration_spec.rb
58
- - spec/yell/event_spec.rb
59
- - spec/yell/formatter_spec.rb
60
- - spec/yell/level_spec.rb
61
- - spec/yell/logger_spec.rb
62
- - spec/yell_spec.rb
63
- - yell.gemspec
23
+
24
+ files:
25
+ - .gitignore
26
+ - .travis.yml
27
+ - Gemfile
28
+ - LICENSE.txt
29
+ - README.md
30
+ - Rakefile
31
+ - examples/001-basic-usage.rb
32
+ - examples/002.1-log-level-basics.rb
33
+ - examples/002.2-log-level-on-certain-severities-only.rb
34
+ - examples/002.3-log-level-within-range.rb
35
+ - examples/003.1-formatting-DefaultFormat.rb
36
+ - examples/003.2-formatting-BasicFormat.rb
37
+ - examples/003.3-formatting-ExtendedFormat.rb
38
+ - examples/003.4-formatting-on-your-own.rb
39
+ - examples/004.1-colorizing-the-log-output.rb
40
+ - lib/yell.rb
41
+ - lib/yell/adapters.rb
42
+ - lib/yell/adapters/base.rb
43
+ - lib/yell/adapters/datefile.rb
44
+ - lib/yell/adapters/file.rb
45
+ - lib/yell/adapters/io.rb
46
+ - lib/yell/adapters/streams.rb
47
+ - lib/yell/configuration.rb
48
+ - lib/yell/event.rb
49
+ - lib/yell/formatter.rb
50
+ - lib/yell/level.rb
51
+ - lib/yell/logger.rb
52
+ - lib/yell/version.rb
53
+ - spec/fixtures/yell.yml
54
+ - spec/spec_helper.rb
55
+ - spec/yell/adapters/base_spec.rb
56
+ - spec/yell/adapters/datefile_spec.rb
57
+ - spec/yell/adapters/file_spec.rb
58
+ - spec/yell/adapters/io_spec.rb
59
+ - spec/yell/adapters/streams_spec.rb
60
+ - spec/yell/adapters_spec.rb
61
+ - spec/yell/configuration_spec.rb
62
+ - spec/yell/event_spec.rb
63
+ - spec/yell/formatter_spec.rb
64
+ - spec/yell/level_spec.rb
65
+ - spec/yell/logger_spec.rb
66
+ - spec/yell_spec.rb
67
+ - yell.gemspec
64
68
  homepage: http://rudionrails.github.com/yell
65
69
  licenses: []
70
+
66
71
  post_install_message:
67
72
  rdoc_options: []
68
- require_paths:
69
- - lib
70
- required_ruby_version: !ruby/object:Gem::Requirement
73
+
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
71
77
  none: false
72
- requirements:
73
- - - ! '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
83
  none: false
78
- requirements:
79
- - - ! '>='
80
- - !ruby/object:Gem::Version
81
- version: '0'
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
82
88
  requirements: []
89
+
83
90
  rubyforge_project: yell
84
- rubygems_version: 1.8.23
91
+ rubygems_version: 1.8.15
85
92
  signing_key:
86
93
  specification_version: 3
87
94
  summary: Yell - Your Extensible Logging Library
88
- test_files:
89
- - spec/fixtures/yell.yml
90
- - spec/spec_helper.rb
91
- - spec/yell/adapters/base_spec.rb
92
- - spec/yell/adapters/datefile_spec.rb
93
- - spec/yell/adapters/file_spec.rb
94
- - spec/yell/adapters/io_spec.rb
95
- - spec/yell/adapters/streams_spec.rb
96
- - spec/yell/adapters_spec.rb
97
- - spec/yell/configuration_spec.rb
98
- - spec/yell/event_spec.rb
99
- - spec/yell/formatter_spec.rb
100
- - spec/yell/level_spec.rb
101
- - spec/yell/logger_spec.rb
102
- - spec/yell_spec.rb
95
+ test_files: []
96
+
103
97
  has_rdoc: