logging 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.4.1 / 2010-03-23
2
+
3
+ Bug Fixes
4
+ - flock(LOCK_UN) was causing errors on windows [issue 4]
5
+
1
6
  == 1.4.0 / 2010-03-16
2
7
 
3
8
  Minor Enhancements
data/lib/logging.rb CHANGED
@@ -353,16 +353,34 @@ module Logging
353
353
  # they will be joined to the end of the libray path using
354
354
  # <tt>File.join</tt>.
355
355
  #
356
- def libpath( *args )
357
- args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
356
+ def libpath( *args, &block )
357
+ rv = args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
358
+ if block
359
+ begin
360
+ $LOAD_PATH.unshift LIBPATH
361
+ rv = block.call
362
+ ensure
363
+ $LOAD_PATH.shift
364
+ end
365
+ end
366
+ return rv
358
367
  end
359
368
 
360
369
  # Returns the lpath for the module. If any arguments are given,
361
370
  # they will be joined to the end of the path using
362
371
  # <tt>File.join</tt>.
363
372
  #
364
- def path( *args )
365
- args.empty? ? PATH : ::File.join(PATH, args.flatten)
373
+ def path( *args, &block )
374
+ rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)
375
+ if block
376
+ begin
377
+ $LOAD_PATH.unshift PATH
378
+ rv = block.call
379
+ ensure
380
+ $LOAD_PATH.shift
381
+ end
382
+ end
383
+ return rv
366
384
  end
367
385
 
368
386
  # call-seq:
@@ -482,18 +500,20 @@ module Logging
482
500
  end # module Logging
483
501
 
484
502
 
485
- require Logging.libpath(%w[logging appender])
486
- require Logging.libpath(%w[logging layout])
487
- require Logging.libpath(%w[logging log_event])
488
- require Logging.libpath(%w[logging logger])
489
- require Logging.libpath(%w[logging repository])
490
- require Logging.libpath(%w[logging root_logger])
491
- require Logging.libpath(%w[logging stats])
492
- require Logging.libpath(%w[logging appenders])
493
- require Logging.libpath(%w[logging layouts])
494
-
495
- require Logging.libpath(%w[logging config configurator])
496
- require Logging.libpath(%w[logging config yaml_configurator])
503
+ Logging.libpath {
504
+ require 'logging/appender'
505
+ require 'logging/layout'
506
+ require 'logging/log_event'
507
+ require 'logging/logger'
508
+ require 'logging/repository'
509
+ require 'logging/root_logger'
510
+ require 'logging/stats'
511
+ require 'logging/appenders'
512
+ require 'logging/layouts'
513
+
514
+ require 'logging/config/configurator'
515
+ require 'logging/config/yaml_configurator'
516
+ }
497
517
 
498
518
 
499
519
  # This exit handler will close all the appenders that exist in the system.
@@ -122,10 +122,16 @@ module Logging
122
122
  end # module Appenders
123
123
  end # module Logging
124
124
 
125
-
126
- %w[buffering io console email file growl rolling_file string_io syslog].
127
- each do |fn|
128
- require ::Logging.libpath('logging', 'appenders', fn)
129
- end
125
+ Logging.libpath {
126
+ require 'logging/appenders/buffering'
127
+ require 'logging/appenders/io'
128
+ require 'logging/appenders/console'
129
+ require 'logging/appenders/email'
130
+ require 'logging/appenders/file'
131
+ require 'logging/appenders/growl'
132
+ require 'logging/appenders/rolling_file'
133
+ require 'logging/appenders/string_io'
134
+ require 'logging/appenders/syslog'
135
+ }
130
136
 
131
137
  # EOF
@@ -38,10 +38,10 @@ module Logging
38
38
  end # module Layouts
39
39
  end # module Logging
40
40
 
41
-
42
- %w[basic parseable pattern].
43
- each do |fn|
44
- require ::Logging.libpath('logging', 'layouts', fn)
45
- end
41
+ Logging.libpath {
42
+ require 'logging/layouts/basic'
43
+ require 'logging/layouts/parseable'
44
+ require 'logging/layouts/pattern'
45
+ }
46
46
 
47
47
  # EOF
data/lib/logging/utils.rb CHANGED
@@ -162,6 +162,14 @@ class File
162
162
  flock LOCK_UN
163
163
  end
164
164
 
165
+ # :stopdoc:
166
+ if %r/mswin|mingw/ =~ RUBY_PLATFORM
167
+ undef :flock?, :flock_sh
168
+ def flock?() yield; end
169
+ def flock_sh() yield; end
170
+ end
171
+ # :startdoc:
172
+
165
173
  end
166
174
 
167
175
  # --------------------------------------------------------------------------
data/version.txt CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.1
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 4
8
- - 0
9
- version: 1.4.0
8
+ - 1
9
+ version: 1.4.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tim Pease
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-16 00:00:00 -06:00
17
+ date: 2010-03-23 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency