logging 0.6.1 → 0.6.2

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.
@@ -1,3 +1,10 @@
1
+ == 0.6.2 / 2008-02-06
2
+
3
+ 2 bugfixes
4
+ - An extra e-mail was being pushed out when the e-mail
5
+ appender was closed
6
+ - Created an at_exit handler to close all appenders
7
+
1
8
  == 0.6.1 / 2008-01-01
2
9
 
3
10
  1 bugfix
@@ -26,8 +26,10 @@ tasks/annotations.rake
26
26
  tasks/doc.rake
27
27
  tasks/gem.rake
28
28
  tasks/manifest.rake
29
+ tasks/post_load.rake
29
30
  tasks/rubyforge.rake
30
31
  tasks/setup.rb
32
+ tasks/svn.rake
31
33
  tasks/test.rake
32
34
  test/appenders/test_console.rb
33
35
  test/appenders/test_email.rb
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  # $Id$
2
2
 
3
3
  load 'tasks/setup.rb'
4
+
4
5
  ensure_in_path 'lib'
5
6
  require 'logging'
6
7
 
@@ -11,16 +12,15 @@ PROJ.summary = 'A flexible and extendable logging library for Ruby'
11
12
  PROJ.authors = 'Tim Pease'
12
13
  PROJ.email = 'tim.pease@gmail.com'
13
14
  PROJ.url = 'http://logging.rubyforge.org/'
14
- PROJ.description = paragraphs_of('README.txt', 3).join("\n\n")
15
- PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
16
15
  PROJ.rubyforge_name = 'logging'
17
16
  PROJ.rdoc_dir = 'doc/rdoc'
18
17
  #PROJ.rdoc_remote_dir = 'rdoc'
19
18
  PROJ.rdoc_remote_dir = ''
20
19
  PROJ.version = Logging::VERSION
21
20
 
22
- PROJ.exclude << '^tags$' << '^tasks/archive'
21
+ PROJ.exclude << '^tags$' << '^tasks/archive' << '^coverage'
23
22
  PROJ.rdoc_exclude << '^data'
23
+ PROJ.svn = true
24
24
 
25
25
  depend_on 'flexmock'
26
26
  depend_on 'lockfile'
@@ -1,4 +1,4 @@
1
- # $Id: logging.rb 80 2008-01-01 22:39:52Z tim_pease $
1
+ # $Id: logging.rb 85 2008-02-06 17:59:00Z tim_pease $
2
2
 
3
3
  require 'logging/utils'
4
4
  require 'logging/log_event'
@@ -30,7 +30,7 @@ require 'logging/config/yaml_configurator'
30
30
  #
31
31
  module Logging
32
32
 
33
- VERSION = '0.6.1' # :nodoc:
33
+ VERSION = '0.6.2' # :nodoc:
34
34
 
35
35
  LEVELS = {} # :nodoc:
36
36
  LNAMES = {} # :nodoc:
@@ -255,4 +255,14 @@ module Logging
255
255
 
256
256
  end # module Logging
257
257
 
258
+ # This exit handler will close all the appenders that exist in the system.
259
+ # This is needed for closing IO streams and connections to the syslog server
260
+ # or e-mail servers, etc.
261
+ #
262
+ at_exit {
263
+ Logging::Appender.instance_variable_get(:@appenders).values.each do |ap|
264
+ ap.close
265
+ end
266
+ }
267
+
258
268
  # EOF
@@ -1,4 +1,4 @@
1
- # $Id: appender.rb 77 2007-12-30 02:21:33Z tim_pease $
1
+ # $Id: appender.rb 85 2008-02-06 17:59:00Z tim_pease $
2
2
 
3
3
  require 'thread'
4
4
 
@@ -39,7 +39,7 @@ module Logging
39
39
 
40
40
  @mutex = Mutex.new
41
41
  header = @layout.header
42
- sync {write(header, false)} unless header.nil? || header.empty?
42
+ sync {write(header)} unless header.nil? || header.empty?
43
43
 
44
44
  ::Logging::Appender[@name] = self
45
45
  end
@@ -56,7 +56,7 @@ module Logging
56
56
  "appender '<#{self.class.name}: #{@name}>' is closed"
57
57
  end
58
58
 
59
- sync {write(event, true)} unless @level > event.level
59
+ sync {write(event)} unless @level > event.level
60
60
  self
61
61
  end
62
62
 
@@ -72,7 +72,7 @@ module Logging
72
72
  "appender '<#{self.class.name}: #{@name}>' is closed"
73
73
  end
74
74
 
75
- sync {write(str, false)} unless @level >= ::Logging::LEVELS.length
75
+ sync {write(str)} unless @level >= ::Logging::LEVELS.length
76
76
  self
77
77
  end
78
78
 
@@ -141,8 +141,12 @@ module Logging
141
141
  #
142
142
  def close( footer = true )
143
143
  return self if @closed
144
+ ::Logging::Appender.remove(@name)
144
145
  @closed = true
145
- sync {write(@layout.footer, false)} if footer
146
+ if footer
147
+ footer = @layout.footer
148
+ sync {write(footer)} unless footer.nil? || footer.empty?
149
+ end
146
150
  self
147
151
  end
148
152
 
@@ -171,15 +175,14 @@ module Logging
171
175
  private
172
176
 
173
177
  # call-seq:
174
- # write( event, do_layout = true )
178
+ # write( event )
175
179
  #
176
180
  # Writes the given _event_ to the logging destination. Subclasses should
177
- # provide an implementation of this method. If the _do_layout_ flag is
178
- # set to +true+, then the event will be formatted using the configured
179
- # layout object. If set to false, then the event will be stringiied and
180
- # appended to the logging destination.
181
+ # provide an implementation of this method. The _event_ can be either a
182
+ # LogEvent or a String. If a LogEvent, then it will be formatted using
183
+ # the layout given to the appender when it was created.
181
184
  #
182
- def write( event, do_layout = true )
185
+ def write( event )
183
186
  nil
184
187
  end
185
188
 
@@ -1,4 +1,4 @@
1
- # $Id: email.rb 68 2007-12-26 18:45:34Z tim_pease $
1
+ # $Id: email.rb 85 2008-02-06 17:59:00Z tim_pease $
2
2
 
3
3
  require 'net/smtp'
4
4
  require 'time' # get rfc822 time format
@@ -80,20 +80,23 @@ class Email < ::Logging::Appender
80
80
  private
81
81
 
82
82
  # call-seq:
83
- # write( event, do_layout = true )
83
+ # write( event )
84
84
  #
85
85
  # Write the given _event_ to the e-mail message buffer. The log event will
86
86
  # be processed through the Layout associated with this appender.
87
87
  #
88
- # If the _do_layout_ flag is set to false, the _event_ will be converted
89
- # to a string and then written to the e-mail message buffer "as is" -- no
90
- # layout formatting will be performed.
91
- #
92
- def write( event, do_layout = true )
93
- str = do_layout ? @layout.format(event) : event.to_s
88
+ def write( event )
89
+ immediate = false
90
+ str = if ::Logging::LogEvent === event
91
+ immediate = @immediate[event.level]
92
+ @layout.format(event)
93
+ else
94
+ event.to_s
95
+ end
96
+ return if str.empty?
97
+
94
98
  @buff << str
95
- send_mail if @buff.length >= @buffsize ||
96
- (do_layout && @immediate[event.level])
99
+ send_mail if @buff.length >= @buffsize || immediate
97
100
  self
98
101
  end
99
102
 
@@ -1,4 +1,4 @@
1
- # $Id: growl.rb 77 2007-12-30 02:21:33Z tim_pease $
1
+ # $Id: growl.rb 85 2008-02-06 17:59:00Z tim_pease $
2
2
 
3
3
  module Logging::Appenders
4
4
 
@@ -67,27 +67,23 @@ module Logging::Appenders
67
67
  private
68
68
 
69
69
  # call-seq:
70
- # write( event, do_layout = true )
70
+ # write( event )
71
71
  #
72
72
  # Write the given _event_ to the growl notification facility. The log
73
73
  # event will be processed through the Layout assciated with this
74
- # appender if the _do_layout_ flag is set to +true+. The message will be
75
- # logged at the level specified by the event.
74
+ # appender. The message will be logged at the level specified by the
75
+ # event.
76
76
  #
77
- # If the _do_layout_ flag is set to +false+, the _event_ will be
78
- # converted to a string and wirtten to the growl notification facility
79
- # "as is" -- no layout formatting will be performed. The string will be
80
- # logged at the 0 notification level of the Growl framework.
81
- #
82
- def write( event, do_layout = true )
77
+ def write( event )
83
78
  title = ''
84
79
  priority = 0
85
- message = if do_layout
80
+ message = if ::Logging::LogEvent === event
86
81
  priority = @map[event.level]
87
82
  @layout.format(event)
88
83
  else
89
84
  event.to_s
90
85
  end
86
+ return if message.empty?
91
87
 
92
88
  if @title_sep
93
89
  title, message = message.split(@title_sep)
@@ -1,4 +1,4 @@
1
- # $Id: io.rb 77 2007-12-30 02:21:33Z tim_pease $
1
+ # $Id: io.rb 85 2008-02-06 17:59:00Z tim_pease $
2
2
 
3
3
  module Logging::Appenders
4
4
 
@@ -58,18 +58,15 @@ module Logging::Appenders
58
58
  private
59
59
 
60
60
  # call-seq:
61
- # write( event, do_layout = true )
61
+ # write( event )
62
62
  #
63
63
  # Writes the given _event_ to the IO stream. If an +IOError+ is detected,
64
64
  # than this appender will be turned off and the error reported.
65
65
  #
66
- # If the _do_layout_ flag is set to +true+, then the event will be
67
- # formatted using the configured layout object. If set to false, then
68
- # the event will be stringiied and appended to the IO stream.
69
- #
70
- def write( event, do_layout = true )
66
+ def write( event )
71
67
  begin
72
- str = do_layout ? @layout.format(event) : event.to_s
68
+ str = ::Logging::LogEvent === event ? @layout.format(event) : event.to_s
69
+ return if str.empty?
73
70
  @io.print str
74
71
  rescue IOError
75
72
  self.level = :off
@@ -1,4 +1,4 @@
1
- # $Id: rolling_file.rb 77 2007-12-30 02:21:33Z tim_pease $
1
+ # $Id: rolling_file.rb 85 2008-02-06 17:59:00Z tim_pease $
2
2
 
3
3
  begin
4
4
  require 'lockfile'
@@ -154,21 +154,18 @@ module Logging::Appenders
154
154
  private
155
155
 
156
156
  # call-seq:
157
- # write( event, do_layout = true )
157
+ # write( event )
158
158
  #
159
159
  # Write the given _event_ to the log file. The log file will be rolled
160
160
  # if the maximum file size is exceeded or if the file is older than the
161
161
  # maximum age.
162
162
  #
163
- # If the _do_layout_ flag is set to +true+, then the event will be
164
- # formatted using the configured layout object. If set to false, then
165
- # the event will be stringiied and appended to the current log file.
166
- #
167
- def write( event, do_layout = true )
168
- check_logfile
163
+ def write( event )
164
+ str = ::Logging::LogEvent === event ? @layout.format(event) : event.to_s
165
+ return if str.empty?
169
166
 
170
- str = do_layout ? @layout.format(event) : event.to_s
171
- super(str, false)
167
+ check_logfile
168
+ super(str)
172
169
 
173
170
  if roll_required?(str)
174
171
  return roll unless @lockfile
@@ -1,4 +1,4 @@
1
- # $Id: static_appender.rb 77 2007-12-30 02:21:33Z tim_pease $
1
+ # $Id: static_appender.rb 85 2008-02-06 17:59:00Z tim_pease $
2
2
 
3
3
  module Logging
4
4
  class Appender
@@ -23,6 +23,14 @@ class Appender
23
23
  #
24
24
  def []=( name, val ) @appenders[name] = val end
25
25
 
26
+ # call-seq:
27
+ # Appenders.remove( name )
28
+ #
29
+ # Removes the appender instance stored in the Appender hash under the
30
+ # key _name_.
31
+ #
32
+ def remove( name ) @appenders.delete(name) end
33
+
26
34
  # call-seq:
27
35
  # Appender.stdout
28
36
  #
@@ -1,4 +1,4 @@
1
- # $Id: syslog.rb 77 2007-12-30 02:21:33Z tim_pease $
1
+ # $Id: syslog.rb 85 2008-02-06 17:59:00Z tim_pease $
2
2
 
3
3
  begin
4
4
  require 'syslog'
@@ -157,28 +157,23 @@ module Logging::Appenders
157
157
  private
158
158
 
159
159
  # call-seq:
160
- # write( event, do_layout = true )
160
+ # write( event )
161
161
  #
162
162
  # Write the given _event_ to the syslog facility. The log event will be
163
- # processed through the Layout assciated with this appender if the
164
- # _do_layout_ flag is set to +true+. The message will be logged at the
165
- # level specified by the event.
163
+ # processed through the Layout assciated with this appender. The message
164
+ # will be logged at the level specified by the event.
166
165
  #
167
- # If the _do_layout_ flag is set to +false+, the _event_ will be
168
- # converted to a string and wirtten to the syslog facility "as is" -- no
169
- # layout formatting will be performed. The string will be logged at the
170
- # LOG_DEBUG level of the syslog facility.
171
- #
172
- def write( event, do_layout = true )
166
+ def write( event )
173
167
  pri = LOG_DEBUG
174
- msg = if do_layout
168
+ message = if ::Logging::LogEvent === event
175
169
  pri = @map[event.level]
176
170
  @layout.format(event)
177
171
  else
178
172
  event.to_s
179
173
  end
174
+ return if message.empty?
180
175
 
181
- @syslog.log(pri, '%s', msg)
176
+ @syslog.log(pri, '%s', message)
182
177
  self
183
178
  end
184
179
 
@@ -7,7 +7,6 @@ namespace :doc do
7
7
  desc 'Generate RDoc documentation'
8
8
  Rake::RDocTask.new do |rd|
9
9
  rd.main = PROJ.rdoc_main
10
- rd.options << '-d' if !WIN32 and `which dot` =~ %r/\/dot/
11
10
  rd.rdoc_dir = PROJ.rdoc_dir
12
11
 
13
12
  incl = Regexp.new(PROJ.rdoc_include.join('|'))
@@ -24,6 +23,7 @@ namespace :doc do
24
23
  title = "#{PROJ.rubyforge_name}'s " + title if PROJ.rubyforge_name != title
25
24
 
26
25
  rd.options << "-t #{title}"
26
+ rd.options.concat(PROJ.rdoc_opts)
27
27
  end
28
28
 
29
29
  desc 'Generate ri locally for testing'
@@ -69,12 +69,12 @@ namespace :gem do
69
69
 
70
70
  desc 'Install the gem'
71
71
  task :install => [:clobber, :package] do
72
- sh "#{SUDO} #{GEM} install pkg/#{PROJ.spec.file_name}"
72
+ sh "#{SUDO} #{GEM} install pkg/#{PROJ.spec.full_name}"
73
73
  end
74
74
 
75
75
  desc 'Uninstall the gem'
76
76
  task :uninstall do
77
- sh "#{SUDO} #{GEM} uninstall -v '#{PROJ.version}' #{PROJ.name}"
77
+ sh "#{SUDO} #{GEM} uninstall -v '#{PROJ.version}' -x #{PROJ.name}"
78
78
  end
79
79
 
80
80
  end # namespace :gem
@@ -17,7 +17,18 @@ namespace :manifest do
17
17
  end
18
18
 
19
19
  File.open(fn, 'w') {|fp| fp.puts files.sort}
20
- system "#{DIFF} -du Manifest.txt #{fn}"
20
+ lines = %x(#{DIFF} -du Manifest.txt #{fn}).split("\n")
21
+ if HAVE_FACETS_ANSICODE and ENV.has_key?('TERM')
22
+ lines.map! do |line|
23
+ case line
24
+ when %r/^(-{3}|\+{3})/; nil
25
+ when %r/^@/; Console::ANSICode.blue line
26
+ when %r/^\+/; Console::ANSICode.green line
27
+ when %r/^\-/; Console::ANSICode.red line
28
+ else line end
29
+ end
30
+ end
31
+ puts lines.compact
21
32
  rm fn rescue nil
22
33
  end
23
34
 
@@ -36,6 +47,9 @@ namespace :manifest do
36
47
  files << fn unless test ?f, fn
37
48
  File.open(fn, 'w') {|fp| fp.puts files.sort}
38
49
  end
39
- end
50
+ end # namespace :manifest
51
+
52
+ desc 'Alias to manifest:check'
53
+ task :manifest => 'manifest:check'
40
54
 
41
55
  # EOF
@@ -0,0 +1,18 @@
1
+ # $Id: post_load.rake 85 2008-02-06 17:59:00Z tim_pease $
2
+
3
+ # This file does not define any rake tasks. It is used to load some project
4
+ # settings if they are not defined by the user.
5
+
6
+ unless PROJ.changes
7
+ PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
8
+ end
9
+
10
+ unless PROJ.description
11
+ PROJ.description = paragraphs_of('README.txt', 'description').join("\n\n")
12
+ end
13
+
14
+ unless PROJ.summary
15
+ PROJ.summary = PROJ.description.split('.').first
16
+ end
17
+
18
+ # EOF
@@ -45,7 +45,7 @@ namespace :doc do
45
45
 
46
46
  host = "#{config['username']}@rubyforge.org"
47
47
  remote_dir = "/var/www/gforge-projects/#{PROJ.rubyforge_name}/"
48
- remote_dir << PROJ.rdoc_remote_dir || PROJ.name
48
+ remote_dir << PROJ.rdoc_remote_dir if PROJ.rdoc_remote_dir
49
49
  local_dir = PROJ.rdoc_dir
50
50
 
51
51
  Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
@@ -1,4 +1,4 @@
1
- # $Id: setup.rb 79 2008-01-01 20:29:30Z tim_pease $
1
+ # $Id: setup.rb 85 2008-02-06 17:59:00Z tim_pease $
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rake'
@@ -16,7 +16,7 @@ PROJ.email = nil
16
16
  PROJ.url = nil
17
17
  PROJ.version = ENV['VERSION'] || '0.0.0'
18
18
  PROJ.rubyforge_name = nil
19
- PROJ.exclude = %w(tmp$ bak$ ~$ CVS \.svn ^pkg ^doc)
19
+ PROJ.exclude = %w(tmp$ bak$ ~$ CVS .svn/ ^pkg/ ^doc/)
20
20
 
21
21
  # Rspec
22
22
  PROJ.specs = FileList['spec/**/*_spec.rb']
@@ -32,8 +32,8 @@ PROJ.rcov_opts = ['--sort', 'coverage', '-T']
32
32
 
33
33
  # Rdoc
34
34
  PROJ.rdoc_opts = []
35
- PROJ.rdoc_include = %w(^lib ^bin ^ext txt$)
36
- PROJ.rdoc_exclude = %w(extconf\.rb$ ^Manifest\.txt$)
35
+ PROJ.rdoc_include = %w(^lib/ ^bin/ ^ext/ .txt$)
36
+ PROJ.rdoc_exclude = %w(extconf.rb$ ^Manifest.txt$)
37
37
  PROJ.rdoc_main = 'README.txt'
38
38
  PROJ.rdoc_dir = 'doc'
39
39
  PROJ.rdoc_remote_dir = nil
@@ -60,11 +60,20 @@ PROJ.need_zip = false
60
60
  PROJ.annotation_exclude = []
61
61
  PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
62
62
 
63
+ # Subversion Repository
64
+ PROJ.svn = false
65
+ PROJ.svn_root = nil
66
+ PROJ.svn_trunk = 'trunk'
67
+ PROJ.svn_tags = 'tags'
68
+ PROJ.svn_branches = 'branches'
69
+
63
70
  # Load the other rake files in the tasks folder
64
- Dir.glob('tasks/*.rake').sort.each {|fn| import fn}
71
+ rakefiles = Dir.glob('tasks/*.rake').sort
72
+ rakefiles.unshift(rakefiles.delete('tasks/post_load.rake')).compact!
73
+ import(*rakefiles)
65
74
 
66
75
  # Setup some constants
67
- WIN32 = %r/win32/ =~ RUBY_PLATFORM unless defined? WIN32
76
+ WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32
68
77
 
69
78
  DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
70
79
 
@@ -93,7 +102,7 @@ SUDO = if WIN32 then ''
93
102
  RCOV = WIN32 ? 'rcov.cmd' : 'rcov'
94
103
  GEM = WIN32 ? 'gem.cmd' : 'gem'
95
104
 
96
- %w(rcov spec/rake/spectask rubyforge bones).each do |lib|
105
+ %w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
97
106
  begin
98
107
  require lib
99
108
  Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
@@ -108,8 +117,28 @@ end
108
117
  # changes = paragraphs_of('History.txt', 0..1).join("\n\n")
109
118
  # summary, *description = paragraphs_of('README.txt', 3, 3..8)
110
119
  #
111
- def paragraphs_of(path, *paragraphs)
112
- File.read(path).delete("\r").split(/\n\n+/).values_at(*paragraphs)
120
+ def paragraphs_of( path, *paragraphs )
121
+ title = String === paragraphs.first ? paragraphs.shift : nil
122
+ ary = File.read(path).delete("\r").split(/\n\n+/)
123
+
124
+ result = if title
125
+ tmp, matching = [], false
126
+ rgxp = %r/^=+\s*#{Regexp.escape(title)}/i
127
+ paragraphs << (0..-1) if paragraphs.empty?
128
+
129
+ ary.each do |val|
130
+ if val =~ rgxp
131
+ break if matching
132
+ matching = true
133
+ rgxp = %r/^=+/i
134
+ elsif matching
135
+ tmp << val
136
+ end
137
+ end
138
+ tmp
139
+ else ary end
140
+
141
+ result.values_at(*paragraphs)
113
142
  end
114
143
 
115
144
  # Adds the given gem _name_ to the current project's dependency list. An
@@ -123,11 +152,13 @@ def depend_on( name, version = nil )
123
152
  PROJ.dependencies << (version.nil? ? [name] : [name, ">= #{version}"])
124
153
  end
125
154
 
126
- # Adds the given _path_ to the include path if it is not already there
155
+ # Adds the given arguments to the include path if they are not already there
127
156
  #
128
- def ensure_in_path( path )
129
- path = File.expand_path(path)
130
- $:.unshift(path) if test(?d, path) and not $:.include?(path)
157
+ def ensure_in_path( *args )
158
+ args.each do |path|
159
+ path = File.expand_path(path)
160
+ $:.unshift(path) if test(?d, path) and not $:.include?(path)
161
+ end
131
162
  end
132
163
 
133
164
  # Find a rake task using the task name and remove any description text. This
@@ -141,4 +172,18 @@ def remove_desc_for_task( names )
141
172
  end
142
173
  end
143
174
 
175
+ # Change working directories to _dir_, call the _block_ of code, and then
176
+ # change back to the original working directory (the current directory when
177
+ # this method was called).
178
+ #
179
+ def in_directory( dir, &block )
180
+ curdir = pwd
181
+ begin
182
+ cd dir
183
+ return block.call
184
+ ensure
185
+ cd curdir
186
+ end
187
+ end
188
+
144
189
  # EOF
@@ -0,0 +1,44 @@
1
+ # $Id$
2
+
3
+
4
+ if PROJ.svn and system("svn --version 2>&1 > #{DEV_NULL}")
5
+
6
+ unless PROJ.svn_root
7
+ info = %x/svn info ./
8
+ m = %r/^Repository Root:\s+(.*)$/.match(info)
9
+ PROJ.svn_root = (m.nil? ? '' : m[1])
10
+ end
11
+ PROJ.svn_root = File.join(PROJ.svn_root, PROJ.svn) if String === PROJ.svn
12
+
13
+ namespace :svn do
14
+
15
+ desc 'Show tags from the SVN repository'
16
+ task :show_tags do |t|
17
+ tags = %x/svn list #{File.join(PROJ.svn_root, PROJ.svn_tags)}/
18
+ tags.gsub!(%r/\/$/, '')
19
+ puts tags
20
+ end
21
+
22
+ desc 'Create a new tag in the SVN repository'
23
+ task :create_tag do |t|
24
+ v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
25
+ abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
26
+
27
+ trunk = File.join(PROJ.svn_root, PROJ.svn_trunk)
28
+ tag = "%s-%s" % [PROJ.name, PROJ.version]
29
+ tag = File.join(PROJ.svn_root, PROJ.svn_tags, tag)
30
+ msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
31
+
32
+ puts "Creating SVN tag '#{tag}'"
33
+ unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
34
+ abort "Tag creation failed"
35
+ end
36
+ end
37
+
38
+ end # namespace :svn
39
+
40
+ task 'gem:release' => 'svn:create_tag'
41
+
42
+ end # if PROJ.svn
43
+
44
+ # EOF
@@ -1,4 +1,4 @@
1
- # $Id: test_appender.rb 67 2007-12-26 16:27:06Z tim_pease $
1
+ # $Id: test_appender.rb 85 2008-02-06 17:59:00Z tim_pease $
2
2
 
3
3
  require 'test/setup.rb'
4
4
 
@@ -20,8 +20,8 @@ module TestLogging
20
20
  def test_append
21
21
  ary = []
22
22
  @appender.instance_variable_set :@ary, ary
23
- def @appender.write( event, do_layout = true )
24
- str = do_layout ? @layout.format(event) : event.to_s
23
+ def @appender.write( event )
24
+ str = ::Logging::LogEvent === event ? @layout.format(event) : event.to_s
25
25
  @ary << str
26
26
  end
27
27
 
@@ -71,8 +71,8 @@ module TestLogging
71
71
  def test_concat
72
72
  ary = []
73
73
  @appender.instance_variable_set :@ary, ary
74
- def @appender.write( event, do_layout = true )
75
- str = do_layout ? @layout.format(event) : event.to_s
74
+ def @appender.write( event )
75
+ str = ::Logging::LogEvent === event ? @layout.format(event) : event.to_s
76
76
  @ary << str
77
77
  end
78
78
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-01 00:00:00 -07:00
12
+ date: 2008-02-06 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -68,8 +68,10 @@ files:
68
68
  - tasks/doc.rake
69
69
  - tasks/gem.rake
70
70
  - tasks/manifest.rake
71
+ - tasks/post_load.rake
71
72
  - tasks/rubyforge.rake
72
73
  - tasks/setup.rb
74
+ - tasks/svn.rake
73
75
  - tasks/test.rake
74
76
  - test/appenders/test_console.rb
75
77
  - test/appenders/test_email.rb