remote_logger 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,21 +1,21 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/HISTORY ADDED
@@ -0,0 +1,11 @@
1
+ == 0.0.0 / 2010-09-06
2
+
3
+ * Birthday!
4
+
5
+ == 0.0.2 / 2010-09-06
6
+
7
+ * Migrated to new project structure
8
+
9
+ == 0.0.3 / 2010-09-06
10
+
11
+ * Gemspec fixed
data/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2009 arvicco
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2010 Arvicco
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc CHANGED
@@ -1,61 +1,61 @@
1
- remote_logger
2
- by: arvicco
3
- url: http://github.com/arvicco/remote_logger
4
-
5
- == DESCRIPTION:
6
-
7
- Log server/client with sensible defaults that can be used for remote/centralized logging.
8
-
9
- == FEATURES:
10
-
11
- Log4r is a customizable logger with advanced functionality. Unfortunately, it only supports (rarely used) ROMP protocol
12
- for remote logging support. This project aims to improve remote logging by creatting a wrapper around Log4r that:
13
- * Exposes Log4r functionality remotely through multiple protocols
14
- * Writes to (log server) stdout AND log file 'remote.log' by default
15
- * Allows client to use Drb uri or Ring server to find the logger service
16
-
17
- == PROBLEMS/TODO:
18
-
19
- * TODO: add AMQP rpc support
20
-
21
- Work in progress, please do not use it just yet...
22
-
23
- == SYNOPSIS:
24
-
25
- server:
26
- ---
27
- include RemoteLogger
28
- start_drb_logger [options] # or,
29
- start_ringy_logger [options]
30
- ---
31
-
32
- client:
33
- ---
34
- include RemoteLogger
35
- log = find_drb_logger [options] # or,
36
- log = find_ringy_logger [options]
37
- log.info 'This is my log message'
38
- ---
39
-
40
- == REQUIREMENTS:
41
-
42
- * FIXME (list of requirements)
43
-
44
- == INSTALL:
45
-
46
- sudo gem install remote_logger
47
-
48
-
49
- == Note on Patches/Pull Requests
50
-
51
- * Fork the project.
52
- * Make your feature addition or bug fix.
53
- * Add tests for it. This is important so I don't break it in a
54
- future version unintentionally.
55
- * Commit, do not mess with rakefile, version, or history.
56
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
57
- * Send me a pull request. Bonus points for topic branches.
58
-
59
- == Copyright
60
-
61
- Copyright (c) 2010 arvicco. See LICENSE for details.
1
+ remote_logger
2
+ by: arvicco
3
+ url: http://github.com/arvicco/remote_logger
4
+
5
+ == DESCRIPTION:
6
+
7
+ Log server/client with sensible defaults that can be used for remote/centralized logging.
8
+
9
+ == FEATURES:
10
+
11
+ Log4r is a customizable logger with advanced functionality. Unfortunately, it only supports (rarely used) ROMP protocol
12
+ for remote logging support. This project aims to improve remote logging by creatting a wrapper around Log4r that:
13
+ * Exposes Log4r functionality remotely through multiple protocols
14
+ * Writes to (log server) stdout AND log file 'remote.log' by default
15
+ * Allows client to use Drb uri or Ring server to find the logger service
16
+
17
+ == PROBLEMS/TODO:
18
+
19
+ * TODO: add AMQP rpc support
20
+
21
+ Work in progress, please do not use it just yet...
22
+
23
+ == INSTALL:
24
+
25
+ sudo gem install remote_logger
26
+
27
+
28
+ == SYNOPSIS:
29
+
30
+ server:
31
+ ---
32
+ include RemoteLogger
33
+ start_drb_logger [options] # or,
34
+ start_ringy_logger [options]
35
+ ---
36
+
37
+ client:
38
+ ---
39
+ include RemoteLogger
40
+ log = find_drb_logger [options] # or,
41
+ log = find_ringy_logger [options]
42
+ log.info 'This is my log message'
43
+ ---
44
+
45
+ == REQUIREMENTS:
46
+
47
+ * FIXME (list of requirements)
48
+
49
+ == Note on Patches/Pull Requests
50
+
51
+ * Fork the project.
52
+ * Make your feature addition or bug fix.
53
+ * Add tests for it. This is important so I don't break it in a
54
+ future version unintentionally.
55
+ * Commit, do not mess with rakefile, version, or history.
56
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
57
+ * Send me a pull request. Bonus points for topic branches.
58
+
59
+ == Copyright
60
+
61
+ Copyright (c) 2010 arvicco. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,57 +1,24 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "remote_logger"
8
- gem.summary = %Q{Remote logger based on Log4r}
9
- gem.description = %Q{Remote logger based on Log4r}
10
- gem.email = "arvitallian@gmail.com"
11
- gem.homepage = "http://github.com/arvicco/remote_logger"
12
- gem.authors = ["arvicco"]
13
- gem.add_development_dependency "rspec", ">= 1.2.9"
14
- gem.add_development_dependency "cucumber", ">= 0"
15
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
- end
17
- Jeweler::GemcutterTasks.new
18
- rescue LoadError
19
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
- end
21
-
22
- require 'spec/rake/spectask'
23
- Spec::Rake::SpecTask.new(:spec) do |spec|
24
- spec.libs << 'lib' << 'spec'
25
- spec.spec_files = FileList['spec/**/*_spec.rb']
26
- end
27
-
28
- Spec::Rake::SpecTask.new(:rcov) do |spec|
29
- spec.libs << 'lib' << 'spec'
30
- spec.pattern = 'spec/**/*_spec.rb'
31
- spec.rcov = true
32
- end
33
-
34
- task :spec => :check_dependencies
35
-
36
- begin
37
- require 'cucumber/rake/task'
38
- Cucumber::Rake::Task.new(:features)
39
-
40
- task :features => :check_dependencies
41
- rescue LoadError
42
- task :features do
43
- abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
44
- end
45
- end
46
-
47
- task :default => :spec
48
-
49
- require 'rake/rdoctask'
50
- Rake::RDocTask.new do |rdoc|
51
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
-
53
- rdoc.rdoc_dir = 'rdoc'
54
- rdoc.title = "remote_logger #{version}"
55
- rdoc.rdoc_files.include('README*')
56
- rdoc.rdoc_files.include('lib/**/*.rb')
57
- end
1
+ require 'pathname'
2
+ NAME = 'remote_logger'
3
+ BASE_PATH = Pathname.new(__FILE__).dirname
4
+ LIB_PATH = BASE_PATH + 'lib'
5
+ PKG_PATH = BASE_PATH + 'pkg'
6
+ DOC_PATH = BASE_PATH + 'rdoc'
7
+
8
+ $LOAD_PATH.unshift LIB_PATH.to_s
9
+ require 'version'
10
+
11
+ CLASS_NAME = RemoteLogger
12
+ VERSION = CLASS_NAME::VERSION
13
+
14
+ begin
15
+ require 'rake'
16
+ rescue LoadError
17
+ require 'rubygems'
18
+ gem 'rake', '~> 0.8.3.1'
19
+ require 'rake'
20
+ end
21
+
22
+ # Load rakefile tasks
23
+ Dir['tasks/*.rake'].sort.each { |file| load file }
24
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.3
data/bin/remote_logger ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require Pathname.new(__FILE__).dirname + '../lib/remote_logger'
5
+
6
+ # Put your code here
7
+
@@ -1,9 +1,9 @@
1
- Feature: something something
2
- In order to something something
3
- A user something something
4
- something something something
5
-
6
- Scenario: something something
7
- Given inspiration
8
- When I create a sweet new gem
9
- Then everyone should see how awesome I am
1
+ Feature: something something
2
+ In order to something something
3
+ A user something something
4
+ something something something
5
+
6
+ Scenario: something something
7
+ Given inspiration
8
+ When I create a sweet new gem
9
+ Then everyone should see how awesome I am
@@ -1,4 +1,7 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
- require 'remote_logger'
3
-
4
- require 'spec/expectations'
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
+ require 'remote_logger'
3
+ require 'spec/expectations'
4
+ require 'spec/stubs/cucumber'
5
+
6
+ require 'pathname'
7
+ BASE_PATH = Pathname.new(__FILE__).dirname + '../..'
@@ -1,104 +1,104 @@
1
- #encoding: UTF-8
2
- # TODO: Set up ACL, SSL and other security stuff
3
- module RemoteLogger
4
- include Log4r
5
-
6
- DRB_URI = 'druby://127.0.0.1:61626'
7
- LOGGER_NAME = 'RemoteLogger' # Default service/logger name - used by Ring or retrieved via Log4R::Logger[LOGGER_NAME]
8
- FILE_NAME = 'remote.log' # File name of log file
9
- FILE_ENCODING = 'CP1251:UTF-8' # Encoding pair of log file ('File external:Ruby internal')
10
- STDOUT_ENCODING = 'CP866:UTF-8' # Encoding pair of stdout ('Stdout external:Ruby internal')
11
- PATTERN = '%1.1l %d - %m' # Log entry pattern
12
- DATE_PATTERN = '%Y-%m-%d %H:%M:%S.%3N'
13
-
14
- # Creates a new Log4r logger. The following options are available:
15
- #
16
- # <tt>:name</tt>:: Service/logger name - default 'RemoteLogger'
17
- # <tt>:outputters</tt>:: Replace outputters (should be Log4r::Outputter subclasses) - default [log file, stdout]
18
- # <tt>:file_name</tt>:: Log file name - default 'remote.log'
19
- # <tt>:file_encoding</tt>:: Log file encoding - default FILE_ENCODING (Windows Cyrillic)
20
- # <tt>:stdout_encoding</tt>:: Stdout encoding - default STDOUT_ENCODING (DOS/IBM Cyrillic)
21
- # <tt>:replace</tt>:: Replacement for undefined conversion chars - default '?'
22
- # <tt>:pattern</tt>:: Log message pattern - default PATTERN
23
- # <tt>:date_pattern</tt>:: Timestamp pattern - default DATE_PATTERN
24
- # <tt>:trunc</tt>:: Truncate (rewrite) log file upon creation - default false (append to file)
25
- # <tt>:verbose</tt>:: Log all internal messages of RemoteLogger - default false (do not log logger-specific messages)
26
- #
27
- def self.create_logger options = {}
28
- # define outputters: http://log4r.sourceforge.net/rdoc/files/log4r/outputter/outputter_rb.html
29
- if options[:outputters]
30
- outputters = options[:outputters]
31
- else
32
- # specify log message format: http://log4r.sourceforge.net/rdoc/files/log4r/formatter/patternformatter_rb.html
33
- format = PatternFormatter.new :pattern => options[:pattern]||PATTERN,
34
- :date_pattern => options[:date_pattern]||DATE_PATTERN
35
-
36
- # Set up IO streams with correct transcoding and conversion options: log file and (Windows) console
37
- conversion = {:undef=>:replace, :replace=>options[:replace]||'?'}
38
- file = File.new(options[:file_name]||FILE_NAME, (options[:trunc] ? 'w:' : 'a:') +
39
- (options[:file_encoding]||FILE_ENCODING), conversion )
40
- $stdout.set_encoding(options[:stdout_encoding]||STDOUT_ENCODING, conversion)
41
-
42
- outputters = [StdoutOutputter.new('console', :formatter => format),
43
- IOOutputter.new('file', file, :formatter => format) ]
44
- # file_o = FileOutputter.new 'file', :filename => 'remote.log', :trunc => false, :formatter => format # wrong encoding
45
- # err_o = StderrOutputter.new 'error', :formatter => format # just in case
46
- end
47
-
48
- # create new logger named LOG_NAME
49
- Logger.new(options[:name]||LOGGER_NAME).tap do |logger|
50
- logger.outputters = outputters
51
- logger.info "#{name}: Logger created" if options[:verbose]
52
- end
53
- end
54
-
55
- def self.start_ringy_logger(name = LOGGER_NAME, options = {})
56
- # Adding some security (disable remote eval)
57
- $SAFE = 1
58
-
59
- # Creating logger instance
60
- logger = create_logger options
61
-
62
- DRb.start_service
63
-
64
- # Raising new RingyDingy service
65
- logger.info "#{name}: Initializing service..." if options[:verbose]
66
- RingyDingy.new(logger, name.to_sym).run
67
- logger.info "#{name}: Service started" if options[:verbose]
68
-
69
- DRb.thread.join
70
- logger.info "#{name}: Service finished" if options[:verbose]
71
- end
72
-
73
- def self.find_ringy_logger(name = LOGGER_NAME, options = {})
74
- DRb.start_service
75
- # Connecting to Logger
76
- ring_server = Rinda::RingFinger.primary
77
- service = ring_server.read [:name, name.to_sym, nil, nil]
78
- service[2]
79
- end
80
-
81
- def self.start_drb_logger(name = LOGGER_NAME, options = {})
82
- # Adding some security (disable remote eval)
83
- $SAFE = 1
84
-
85
- # Creating logger instance
86
- logger = create_logger options
87
-
88
- # Raising new RingyDingy service
89
- logger.info "#{name}: Initializing service..." if options[:verbose]
90
- DRb.start_service(options[:uri]||DRB_URI, logger)
91
- logger.info "#{name}: Service started" if options[:verbose]
92
-
93
- DRb.thread.join
94
- logger.info "#{name}: Service finished" if options[:verbose]
95
- end
96
-
97
- def self.find_drb_logger(name = LOGGER_NAME, options = {})
98
- DRb.start_service
99
- # Connecting to Logger
100
- log = DRbObject.new_with_uri(options[:uri]||DRB_URI)
101
- end
102
-
103
-
104
- end
1
+ #encoding: UTF-8
2
+ # TODO: Set up ACL, SSL and other security stuff
3
+ module RemoteLogger
4
+ include Log4r
5
+
6
+ DRB_URI = 'druby://127.0.0.1:61626'
7
+ LOGGER_NAME = 'RemoteLogger' # Default service/logger name - used by Ring or retrieved via Log4R::Logger[LOGGER_NAME]
8
+ FILE_NAME = 'remote.log' # File name of log file
9
+ FILE_ENCODING = 'CP1251:UTF-8' # Encoding pair of log file ('File external:Ruby internal')
10
+ STDOUT_ENCODING = 'CP866:UTF-8' # Encoding pair of stdout ('Stdout external:Ruby internal')
11
+ PATTERN = '%1.1l %d - %m' # Log entry pattern
12
+ DATE_PATTERN = '%Y-%m-%d %H:%M:%S.%3N'
13
+
14
+ # Creates a new Log4r logger. The following options are available:
15
+ #
16
+ # <tt>:name</tt>:: Service/logger name - default 'RemoteLogger'
17
+ # <tt>:outputters</tt>:: Replace outputters (should be Log4r::Outputter subclasses) - default [log file, stdout]
18
+ # <tt>:file_name</tt>:: Log file name - default 'remote.log'
19
+ # <tt>:file_encoding</tt>:: Log file encoding - default FILE_ENCODING (Windows Cyrillic)
20
+ # <tt>:stdout_encoding</tt>:: Stdout encoding - default STDOUT_ENCODING (DOS/IBM Cyrillic)
21
+ # <tt>:replace</tt>:: Replacement for undefined conversion chars - default '?'
22
+ # <tt>:pattern</tt>:: Log message pattern - default PATTERN
23
+ # <tt>:date_pattern</tt>:: Timestamp pattern - default DATE_PATTERN
24
+ # <tt>:trunc</tt>:: Truncate (rewrite) log file upon creation - default false (append to file)
25
+ # <tt>:verbose</tt>:: Log all internal messages of RemoteLogger - default false (do not log logger-specific messages)
26
+ #
27
+ def self.create_logger options = {}
28
+ # define outputters: http://log4r.sourceforge.net/rdoc/files/log4r/outputter/outputter_rb.html
29
+ if options[:outputters]
30
+ outputters = options[:outputters]
31
+ else
32
+ # specify log message format: http://log4r.sourceforge.net/rdoc/files/log4r/formatter/patternformatter_rb.html
33
+ format = PatternFormatter.new :pattern => options[:pattern]||PATTERN,
34
+ :date_pattern => options[:date_pattern]||DATE_PATTERN
35
+
36
+ # Set up IO streams with correct transcoding and conversion options: log file and (Windows) console
37
+ conversion = {:undef=>:replace, :replace=>options[:replace]||'?'}
38
+ file = File.new(options[:file_name]||FILE_NAME, (options[:trunc] ? 'w:' : 'a:') +
39
+ (options[:file_encoding]||FILE_ENCODING), conversion )
40
+ $stdout.set_encoding(options[:stdout_encoding]||STDOUT_ENCODING, conversion)
41
+
42
+ outputters = [StdoutOutputter.new('console', :formatter => format),
43
+ IOOutputter.new('file', file, :formatter => format) ]
44
+ # file_o = FileOutputter.new 'file', :filename => 'remote.log', :trunc => false, :formatter => format # wrong encoding
45
+ # err_o = StderrOutputter.new 'error', :formatter => format # just in case
46
+ end
47
+
48
+ # create new logger named LOG_NAME
49
+ Logger.new(options[:name]||LOGGER_NAME).tap do |logger|
50
+ logger.outputters = outputters
51
+ logger.info "#{name}: Logger created" if options[:verbose]
52
+ end
53
+ end
54
+
55
+ def self.start_ringy_logger(name = LOGGER_NAME, options = {})
56
+ # Adding some security (disable remote eval)
57
+ $SAFE = 1
58
+
59
+ # Creating logger instance
60
+ logger = create_logger options
61
+
62
+ DRb.start_service
63
+
64
+ # Raising new RingyDingy service
65
+ logger.info "#{name}: Initializing service..." if options[:verbose]
66
+ RingyDingy.new(logger, name.to_sym).run
67
+ logger.info "#{name}: Service started" if options[:verbose]
68
+
69
+ DRb.thread.join
70
+ logger.info "#{name}: Service finished" if options[:verbose]
71
+ end
72
+
73
+ def self.find_ringy_logger(name = LOGGER_NAME, options = {})
74
+ DRb.start_service
75
+ # Connecting to Logger
76
+ ring_server = Rinda::RingFinger.primary
77
+ service = ring_server.read [:name, name.to_sym, nil, nil]
78
+ service[2]
79
+ end
80
+
81
+ def self.start_drb_logger(name = LOGGER_NAME, options = {})
82
+ # Adding some security (disable remote eval)
83
+ $SAFE = 1
84
+
85
+ # Creating logger instance
86
+ logger = create_logger options
87
+
88
+ # Raising new RingyDingy service
89
+ logger.info "#{name}: Initializing service..." if options[:verbose]
90
+ DRb.start_service(options[:uri]||DRB_URI, logger)
91
+ logger.info "#{name}: Service started" if options[:verbose]
92
+
93
+ DRb.thread.join
94
+ logger.info "#{name}: Service finished" if options[:verbose]
95
+ end
96
+
97
+ def self.find_drb_logger(name = LOGGER_NAME, options = {})
98
+ DRb.start_service
99
+ # Connecting to Logger
100
+ log = DRbObject.new_with_uri(options[:uri]||DRB_URI)
101
+ end
102
+
103
+
104
+ end
data/lib/remote_logger.rb CHANGED
@@ -1,24 +1,29 @@
1
- require 'log4r'
2
- require 'rinda/ring'
3
- require 'ringy_dingy'
4
- #require 'ringy_dingy/ring_server'
5
-
6
- module RemoteLogger
7
-
8
- # Utility method used to require all files ending in .rb that lie in the
9
- # directory below this file that has the same name as the filename passed
10
- # in. Optionally, a specific _directory_ name can be passed in such that
11
- # the _filename_ does not have to be equivalent to the directory.
12
- #
13
- def self.require_all_libs_relative_to( fname, dir = nil )
14
- dir ||= ::File.basename(fname, '.*')
15
- search_me = ::File.expand_path(
16
- ::File.join(::File.dirname(fname), dir, '**', '*.rb'))
17
-
18
- Dir.glob(search_me).sort.each {|rb| require rb}
19
- end
20
-
21
- end # module RemoteLogger
22
-
23
- RemoteLogger.require_all_libs_relative_to(__FILE__)
24
-
1
+ require 'version'
2
+ require 'log4r'
3
+ require 'rinda/ring'
4
+ require 'ringy_dingy'
5
+ #require 'ringy_dingy/ring_server'
6
+
7
+ module RemoteLogger
8
+
9
+ # require "bundler"
10
+ # Bundler.setup
11
+
12
+ # Requires ruby source file(s). Accepts either single filename/glob or Array of filenames/globs.
13
+ # Accepts following options:
14
+ # :*file*:: Lib(s) required relative to this file - defaults to __FILE__
15
+ # :*dir*:: Required lib(s) located under this dir name - defaults to gem name
16
+ #
17
+ def self.require_libs( libs, opts={} )
18
+ file = Pathname.new(opts[:file] || __FILE__)
19
+ [libs].flatten.each do |lib|
20
+ name = file.dirname + (opts[:dir] || file.basename('.*')) + lib.gsub(/(?<!.rb)$/, '.rb')
21
+ Pathname.glob(name.to_s).sort.each {|rb| require rb}
22
+ end
23
+ end
24
+ end # module RemoteLogger
25
+
26
+ # Require all ruby source files located under directory lib/remote_logger
27
+ # If you need files in specific order, you should specify it here before the glob
28
+ RemoteLogger.require_libs %W[**/*]
29
+
data/lib/version.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'pathname'
2
+
3
+ module RemoteLogger
4
+
5
+ VERSION_FILE = Pathname.new(__FILE__).dirname + '../VERSION' # :nodoc:
6
+ VERSION = VERSION_FILE.exist? ? VERSION_FILE.read.strip : nil
7
+
8
+ end