logging 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ == 0.6.1 / 2008-01-01
2
+
3
+ 1 bugfix
4
+ - Fixed include order to avoid double loading when testing
5
+
1
6
  == 0.6.0 / 2007-12-26
2
7
 
3
8
  * Using the new 'getopt' method for handling option hashes
@@ -22,13 +22,13 @@ lib/logging/logger.rb
22
22
  lib/logging/repository.rb
23
23
  lib/logging/root_logger.rb
24
24
  lib/logging/utils.rb
25
- rakelib/doc.rake
26
- rakelib/gem.rake
27
- rakelib/manifest.rake
28
- rakelib/rubyforge.rake
29
- rakelib/setup.rb
30
- rakelib/test.rake
31
- rakelib/website.rake
25
+ tasks/annotations.rake
26
+ tasks/doc.rake
27
+ tasks/gem.rake
28
+ tasks/manifest.rake
29
+ tasks/rubyforge.rake
30
+ tasks/setup.rb
31
+ tasks/test.rake
32
32
  test/appenders/test_console.rb
33
33
  test/appenders/test_email.rb
34
34
  test/appenders/test_file.rb
data/Rakefile CHANGED
@@ -1,8 +1,7 @@
1
1
  # $Id$
2
2
 
3
- load 'rakelib/setup.rb'
3
+ load 'tasks/setup.rb'
4
4
  ensure_in_path 'lib'
5
-
6
5
  require 'logging'
7
6
 
8
7
  task :default => 'test:run'
@@ -20,11 +19,8 @@ PROJ.rdoc_dir = 'doc/rdoc'
20
19
  PROJ.rdoc_remote_dir = ''
21
20
  PROJ.version = Logging::VERSION
22
21
 
23
- PROJ.exclude << '^(\.\/|\/)?website/output'
24
- PROJ.exclude << '^(\.\/|\/)?doc'
25
- PROJ.exclude << '^(\.\/|\/)?tags$'
26
- PROJ.rdoc_exclude << '^(\.\/|\/)?data'
27
- PROJ.rdoc_exclude << '^(\.\/|\/)?website'
22
+ PROJ.exclude << '^tags$' << '^tasks/archive'
23
+ PROJ.rdoc_exclude << '^data'
28
24
 
29
25
  depend_on 'flexmock'
30
26
  depend_on 'lockfile'
@@ -1,15 +1,21 @@
1
- # $Id: logging.rb 65 2007-12-23 04:48:55Z tim_pease $
1
+ # $Id: logging.rb 80 2008-01-01 22:39:52Z tim_pease $
2
2
 
3
3
  require 'logging/utils'
4
+ require 'logging/log_event'
5
+ require 'logging/logger'
6
+ require 'logging/root_logger'
4
7
  require 'logging/repository'
8
+ require 'logging/appender'
9
+ require 'logging/layout'
5
10
 
6
11
  # require all appenders
12
+ require 'logging/appenders/static_appender'
13
+ require 'logging/appenders/io'
7
14
  require 'logging/appenders/console'
8
15
  require 'logging/appenders/email'
9
16
  require 'logging/appenders/file'
10
17
  require 'logging/appenders/growl'
11
18
  require 'logging/appenders/rolling_file'
12
- require 'logging/appenders/static_appender'
13
19
  require 'logging/appenders/syslog'
14
20
 
15
21
  # require all layouts
@@ -24,7 +30,7 @@ require 'logging/config/yaml_configurator'
24
30
  #
25
31
  module Logging
26
32
 
27
- VERSION = '0.6.0' # :nodoc:
33
+ VERSION = '0.6.1' # :nodoc:
28
34
 
29
35
  LEVELS = {} # :nodoc:
30
36
  LNAMES = {} # :nodoc:
@@ -1,10 +1,6 @@
1
- # $Id: appender.rb 67 2007-12-26 16:27:06Z tim_pease $
1
+ # $Id: appender.rb 77 2007-12-30 02:21:33Z tim_pease $
2
2
 
3
3
  require 'thread'
4
- require 'logging'
5
- require 'logging/logger'
6
- require 'logging/layout'
7
- require 'logging/layouts/basic'
8
4
 
9
5
  module Logging
10
6
 
@@ -1,6 +1,4 @@
1
- # $Id: console.rb 65 2007-12-23 04:48:55Z tim_pease $
2
-
3
- require 'logging/appenders/io'
1
+ # $Id: console.rb 77 2007-12-30 02:21:33Z tim_pease $
4
2
 
5
3
  module Logging::Appenders
6
4
 
@@ -1,6 +1,4 @@
1
- # $Id: file.rb 62 2007-12-22 20:37:05Z tim_pease $
2
-
3
- require 'logging/appenders/io'
1
+ # $Id: file.rb 77 2007-12-30 02:21:33Z tim_pease $
4
2
 
5
3
  module Logging::Appenders
6
4
 
@@ -1,6 +1,4 @@
1
- # $Id: growl.rb 69 2007-12-26 20:53:33Z tim_pease $
2
-
3
- require 'logging/appender'
1
+ # $Id: growl.rb 77 2007-12-30 02:21:33Z tim_pease $
4
2
 
5
3
  module Logging::Appenders
6
4
 
@@ -1,6 +1,4 @@
1
- # $Id: io.rb 72 2007-12-26 21:59:58Z tim_pease $
2
-
3
- require 'logging/appender'
1
+ # $Id: io.rb 77 2007-12-30 02:21:33Z tim_pease $
4
2
 
5
3
  module Logging::Appenders
6
4
 
@@ -1,7 +1,11 @@
1
- # $Id: rolling_file.rb 67 2007-12-26 16:27:06Z tim_pease $
2
-
3
- require 'logging/appenders/file'
4
- require 'lockfile'
1
+ # $Id: rolling_file.rb 77 2007-12-30 02:21:33Z tim_pease $
2
+
3
+ begin
4
+ require 'lockfile'
5
+ rescue LoadError
6
+ require 'rubygems'
7
+ require 'lockfile'
8
+ end
5
9
 
6
10
  module Logging::Appenders
7
11
 
@@ -1,6 +1,4 @@
1
- # $Id: static_appender.rb 37 2007-10-26 19:12:44Z tim_pease $
2
-
3
- require 'logging/appenders/console'
1
+ # $Id: static_appender.rb 77 2007-12-30 02:21:33Z tim_pease $
4
2
 
5
3
  module Logging
6
4
  class Appender
@@ -1,7 +1,6 @@
1
- # $Id: syslog.rb 72 2007-12-26 21:59:58Z tim_pease $
1
+ # $Id: syslog.rb 77 2007-12-30 02:21:33Z tim_pease $
2
2
 
3
3
  begin
4
- require 'logging/appender'
5
4
  require 'syslog'
6
5
  HAVE_SYSLOG = true
7
6
  rescue LoadError
@@ -1,7 +1,6 @@
1
- # $Id: yaml_configurator.rb 52 2007-11-27 23:53:23Z tim_pease $
1
+ # $Id: yaml_configurator.rb 77 2007-12-30 02:21:33Z tim_pease $
2
2
 
3
3
  require 'yaml'
4
- require 'logging'
5
4
 
6
5
  module Logging
7
6
  module Config
@@ -1,7 +1,6 @@
1
- # $Id: layout.rb 62 2007-12-22 20:37:05Z tim_pease $
1
+ # $Id: layout.rb 77 2007-12-30 02:21:33Z tim_pease $
2
2
 
3
3
  require 'yaml'
4
- require 'logging'
5
4
 
6
5
  module Logging
7
6
 
@@ -1,8 +1,4 @@
1
- # $Id: basic.rb 37 2007-10-26 19:12:44Z tim_pease $
2
-
3
- require 'logging'
4
- require 'logging/layout'
5
-
1
+ # $Id: basic.rb 77 2007-12-30 02:21:33Z tim_pease $
6
2
 
7
3
  module Logging
8
4
  module Layouts
@@ -1,7 +1,4 @@
1
- # $Id: pattern.rb 62 2007-12-22 20:37:05Z tim_pease $
2
-
3
- require 'logging'
4
- require 'logging/layout'
1
+ # $Id: pattern.rb 77 2007-12-30 02:21:33Z tim_pease $
5
2
 
6
3
  module Logging
7
4
  module Layouts
@@ -1,11 +1,6 @@
1
- # $Id: logger.rb 52 2007-11-27 23:53:23Z tim_pease $
1
+ # $Id: logger.rb 77 2007-12-30 02:21:33Z tim_pease $
2
2
 
3
3
  require 'thread'
4
- require 'logging'
5
- require 'logging/appender'
6
- require 'logging/log_event'
7
- require 'logging/repository'
8
-
9
4
 
10
5
  module Logging
11
6
 
@@ -1,8 +1,6 @@
1
- # $Id: repository.rb 52 2007-11-27 23:53:23Z tim_pease $
1
+ # $Id: repository.rb 77 2007-12-30 02:21:33Z tim_pease $
2
2
 
3
3
  require 'singleton'
4
- require 'logging/root_logger'
5
-
6
4
 
7
5
  module Logging
8
6
 
@@ -1,7 +1,4 @@
1
- # $Id: root_logger.rb 52 2007-11-27 23:53:23Z tim_pease $
2
-
3
- require 'logging'
4
- require 'logging/logger'
1
+ # $Id: root_logger.rb 77 2007-12-30 02:21:33Z tim_pease $
5
2
 
6
3
  module Logging
7
4
 
@@ -0,0 +1,30 @@
1
+ # $Id$
2
+
3
+ if HAVE_BONES
4
+
5
+ desc "Enumerate all annotations"
6
+ task :notes do
7
+ Bones::AnnotationExtractor.enumerate(
8
+ PROJ, "OPTIMIZE|FIXME|TODO", :tag => true)
9
+ end
10
+
11
+ namespace :notes do
12
+ desc "Enumerate all OPTIMIZE annotations"
13
+ task :optimize do
14
+ Bones::AnnotationExtractor.enumerate(PROJ, "OPTIMIZE")
15
+ end
16
+
17
+ desc "Enumerate all FIXME annotations"
18
+ task :fixme do
19
+ Bones::AnnotationExtractor.enumerate(PROJ, "FIXME")
20
+ end
21
+
22
+ desc "Enumerate all TODO annotations"
23
+ task :todo do
24
+ Bones::AnnotationExtractor.enumerate(PROJ, "TODO")
25
+ end
26
+ end
27
+
28
+ end # if HAVE_BONES
29
+
30
+ # EOF
@@ -1,4 +1,4 @@
1
- # $Id: doc.rake 11 2007-08-23 15:45:16Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  require 'rake/rdoctask'
4
4
 
@@ -38,6 +38,12 @@ namespace :doc do
38
38
 
39
39
  end # namespace :doc
40
40
 
41
+ desc 'Alias to doc:rdoc'
42
+ task :doc => 'doc:rdoc'
43
+
44
+ desc 'Remove all build products'
41
45
  task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
42
46
 
47
+ remove_desc_for_task %w(doc:clobber_rdoc doc:clobber_ri)
48
+
43
49
  # EOF
@@ -1,4 +1,4 @@
1
- # $Id: gem.rake 11 2007-08-23 15:45:16Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  require 'rake/gempackagetask'
4
4
 
@@ -18,7 +18,6 @@ namespace :gem do
18
18
  PROJ.dependencies.each do |dep|
19
19
  s.add_dependency(*dep)
20
20
  end
21
- s.add_dependency('rake', ">= #{RAKEVERSION}")
22
21
 
23
22
  s.files = PROJ.files
24
23
  s.executables = PROJ.executables.map {|fn| File.basename(fn)}
@@ -80,6 +79,11 @@ namespace :gem do
80
79
 
81
80
  end # namespace :gem
82
81
 
82
+ desc 'Alias to gem:package'
83
+ task :gem => 'gem:package'
84
+
83
85
  task :clobber => 'gem:clobber_package'
84
86
 
87
+ remove_desc_for_task %w(gem:clobber_package)
88
+
85
89
  # EOF
@@ -1,18 +1,19 @@
1
- # $Id: manifest.rake 11 2007-08-23 15:45:16Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  require 'find'
4
4
 
5
5
  namespace :manifest do
6
6
 
7
- desc 'Verify the manfiest'
7
+ desc 'Verify the manifest'
8
8
  task :check do
9
9
  fn = 'Manifest.tmp'
10
10
  files = []
11
11
  exclude = Regexp.new(PROJ.exclude.join('|'))
12
12
  Find.find '.' do |path|
13
+ path.sub! %r/^(\.\/|\/)/o, ''
13
14
  next unless test ?f, path
14
15
  next if path =~ exclude
15
- files << path[2..-1]
16
+ files << path
16
17
  end
17
18
 
18
19
  File.open(fn, 'w') {|fp| fp.puts files.sort}
@@ -26,9 +27,10 @@ namespace :manifest do
26
27
  files = []
27
28
  exclude = Regexp.new(PROJ.exclude.join('|'))
28
29
  Find.find '.' do |path|
30
+ path.sub! %r/^(\.\/|\/)/o, ''
29
31
  next unless test ?f, path
30
32
  next if path =~ exclude
31
- files << path[2..-1]
33
+ files << path
32
34
  end
33
35
 
34
36
  files << fn unless test ?f, fn
@@ -1,4 +1,4 @@
1
- # $Id: rubyforge.rake 11 2007-08-23 15:45:16Z tim_pease $
1
+ # $Id$
2
2
 
3
3
  if PROJ.rubyforge_name && HAVE_RUBYFORGE
4
4
 
@@ -1,4 +1,4 @@
1
- # $Id: setup.rb 63 2007-12-22 20:47:54Z tim_pease $
1
+ # $Id: setup.rb 79 2008-01-01 20:29:30Z 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)
19
+ PROJ.exclude = %w(tmp$ bak$ ~$ CVS \.svn ^pkg ^doc)
20
20
 
21
21
  # Rspec
22
22
  PROJ.specs = FileList['spec/**/*_spec.rb']
@@ -56,6 +56,13 @@ PROJ.dependencies = []
56
56
  PROJ.need_tar = true
57
57
  PROJ.need_zip = false
58
58
 
59
+ # File Annotations
60
+ PROJ.annotation_exclude = []
61
+ PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
62
+
63
+ # Load the other rake files in the tasks folder
64
+ Dir.glob('tasks/*.rake').sort.each {|fn| import fn}
65
+
59
66
  # Setup some constants
60
67
  WIN32 = %r/win32/ =~ RUBY_PLATFORM unless defined? WIN32
61
68
 
@@ -86,12 +93,12 @@ SUDO = if WIN32 then ''
86
93
  RCOV = WIN32 ? 'rcov.cmd' : 'rcov'
87
94
  GEM = WIN32 ? 'gem.cmd' : 'gem'
88
95
 
89
- %w(rcov spec rubyforge).each do |lib|
96
+ %w(rcov spec/rake/spectask rubyforge bones).each do |lib|
90
97
  begin
91
98
  require lib
92
- Object.instance_eval {const_set "HAVE_#{lib.upcase}", true}
99
+ Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
93
100
  rescue LoadError
94
- Object.instance_eval {const_set "HAVE_#{lib.upcase}", false}
101
+ Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", false}
95
102
  end
96
103
  end
97
104
 
@@ -120,7 +127,18 @@ end
120
127
  #
121
128
  def ensure_in_path( path )
122
129
  path = File.expand_path(path)
123
- $: << path if test(?d, path) and not $:.include?(path)
130
+ $:.unshift(path) if test(?d, path) and not $:.include?(path)
131
+ end
132
+
133
+ # Find a rake task using the task name and remove any description text. This
134
+ # will prevent the task from being displayed in the list of available tasks.
135
+ #
136
+ def remove_desc_for_task( names )
137
+ Array(names).each do |task_name|
138
+ task = Rake.application.tasks.find {|t| t.name == task_name}
139
+ next if task.nil?
140
+ task.instance_variable_set :@comment, nil
141
+ end
124
142
  end
125
143
 
126
144
  # EOF
@@ -30,6 +30,11 @@ namespace :test do
30
30
 
31
31
  end # namespace :test
32
32
 
33
+ desc 'Alias to test:run'
34
+ task :test => 'test:run'
35
+
33
36
  task :clobber => 'test:clobber_rcov' if HAVE_RCOV
34
37
 
38
+ remove_desc_for_task %w(test:clobber_rcov)
39
+
35
40
  # EOF
@@ -1,4 +1,4 @@
1
- # $Id: setup.rb 72 2007-12-26 21:59:58Z tim_pease $
1
+ # $Id: setup.rb 77 2007-12-30 02:21:33Z tim_pease $
2
2
 
3
3
  require 'test/unit'
4
4
 
@@ -7,15 +7,7 @@ require 'test/unit'
7
7
  #
8
8
  KeyError = IndexError if not defined? KeyError
9
9
 
10
- begin
11
- require 'rubygems'
12
- require 'logging'
13
- rescue LoadError
14
- path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
15
- raise if $:.include? path
16
- $: << path
17
- retry
18
- end
10
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'logging')
19
11
 
20
12
  begin
21
13
  require 'turn'
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.0
4
+ version: 0.6.1
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: 2007-12-26 00:00:00 -07:00
12
+ date: 2008-01-01 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,15 +30,6 @@ dependencies:
30
30
  - !ruby/object:Gem::Version
31
31
  version: 1.4.3
32
32
  version:
33
- - !ruby/object:Gem::Dependency
34
- name: rake
35
- version_requirement:
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: 0.8.1
41
- version:
42
33
  description: Logging is a flexible logging library for use in Ruby programs based on the design of Java's log4j library. It features a hierarchical logging system, custom level names, multiple output destinations per log event, custom formatting, and more.
43
34
  email: tim.pease@gmail.com
44
35
  executables: []
@@ -73,13 +64,13 @@ files:
73
64
  - lib/logging/repository.rb
74
65
  - lib/logging/root_logger.rb
75
66
  - lib/logging/utils.rb
76
- - rakelib/doc.rake
77
- - rakelib/gem.rake
78
- - rakelib/manifest.rake
79
- - rakelib/rubyforge.rake
80
- - rakelib/setup.rb
81
- - rakelib/test.rake
82
- - rakelib/website.rake
67
+ - tasks/annotations.rake
68
+ - tasks/doc.rake
69
+ - tasks/gem.rake
70
+ - tasks/manifest.rake
71
+ - tasks/rubyforge.rake
72
+ - tasks/setup.rb
73
+ - tasks/test.rake
83
74
  - test/appenders/test_console.rb
84
75
  - test/appenders/test_email.rb
85
76
  - test/appenders/test_file.rb
@@ -1,38 +0,0 @@
1
- # $Id: website.rake 12 2007-08-23 16:43:11Z tim_pease $
2
-
3
- namespace :website do
4
-
5
- desc 'Build the Logging website'
6
- task :build do
7
- begin
8
- olddir = pwd
9
- chdir 'website'
10
- sh 'rake build'
11
- cp_r 'output/.', olddir + '/doc'
12
- ensure
13
- chdir olddir
14
- end
15
- end
16
-
17
- desc 'Remove the Logging website'
18
- task :clobber do
19
- rm_r 'doc' rescue nil
20
- end
21
-
22
- desc 'Publish the website to RubyForge'
23
- task :release => %w(website:clobber doc:rdoc website:build) do
24
- config = YAML.load(
25
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
26
- )
27
-
28
- host = "#{config['username']}@rubyforge.org"
29
- remote_dir = "/var/www/gforge-projects/#{PROJ.rubyforge_name}/"
30
-
31
- sh "rsync --delete -rulptzCF doc/ #{host}:#{remote_dir}"
32
- end
33
-
34
- end # namespace :website
35
-
36
- task :clobber => 'website:clobber'
37
-
38
- # EOF