relevance-log_buddy 0.0.5 → 0.1.0
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.
- data/CHANGELOG +4 -0
- data/LICENSE +20 -0
- data/Manifest +8 -4
- data/README.rdoc +9 -4
- data/Rakefile +7 -0
- data/examples.rb +1 -0
- data/init.rb +2 -1
- data/lib/log_buddy.rb +1 -1
- data/log_buddy.gemspec +4 -5
- data/spec/helper.rb +14 -0
- data/spec/log_buddy_init_spec.rb +27 -0
- data/{test/test_log_buddy.rb → spec/log_buddy_spec.rb} +2 -13
- metadata +13 -9
data/CHANGELOG
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 Relevance, Inc. - http://thinkrelevance.com
|
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 NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
CHANGELOG
|
2
|
-
Manifest
|
3
|
-
README.rdoc
|
4
|
-
Rakefile
|
5
2
|
examples.rb
|
6
3
|
init.rb
|
7
4
|
lib/log_buddy.rb
|
8
|
-
|
5
|
+
LICENSE
|
6
|
+
log_buddy.gemspec
|
7
|
+
Manifest
|
8
|
+
Rakefile
|
9
|
+
README.rdoc
|
10
|
+
spec/helper.rb
|
11
|
+
spec/log_buddy_init_spec.rb
|
12
|
+
spec/log_buddy_spec.rb
|
data/README.rdoc
CHANGED
@@ -6,16 +6,18 @@ log_buddy is your friendly little log buddy at your side, helping you dev, debug
|
|
6
6
|
|
7
7
|
== SYNOPSIS:
|
8
8
|
|
9
|
-
|
9
|
+
Require the init.rb file to use log_buddy. By default, it will add two methods to every object at the instance and class level: "d" and "logger". To use log_buddy without the automatic object intrusion, set ENV["SAFE_LOG_BUDDY"] = true before requiring the init.rb.
|
10
|
+
|
11
|
+
You can use your own logger with Logbuddy by passing it into init's options hash:
|
10
12
|
|
11
13
|
LogBuddy.init :default_logger => Logger.new('my_log.log')
|
12
14
|
|
13
15
|
Now you have your logger available from any object, at the instance level and class level:
|
14
16
|
|
15
17
|
obj = Object.new
|
16
|
-
obj.logger.debug("hi")
|
18
|
+
obj.logger.debug("hi") # logs to 'my_log.log'
|
17
19
|
class MyClass; end
|
18
|
-
MyClass.logger.info("heya")
|
20
|
+
MyClass.logger.info("heya") # also logs to 'my_log.log'
|
19
21
|
|
20
22
|
You also have a method called "d" (for "debug") on any object, which is used for quick debugging and logging of things while you are developing.
|
21
23
|
Its especially useful while using autotest. When you call the "d" method with an inline block, it will log the name of the things
|
@@ -39,7 +41,7 @@ See examples.rb for live examples you can run.
|
|
39
41
|
== REQUIREMENTS:
|
40
42
|
|
41
43
|
* Ruby 1.8.6 or JRuby (tested with 1.1RC3)
|
42
|
-
* untested on Ruby
|
44
|
+
* untested on Ruby versions before 1.8.6, but should work fine
|
43
45
|
|
44
46
|
== ISSUES
|
45
47
|
|
@@ -81,3 +83,6 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
81
83
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
82
84
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
83
85
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
86
|
+
|
87
|
+
|
88
|
+
|
data/Rakefile
CHANGED
@@ -22,5 +22,12 @@ echoe = Echoe.new('log_buddy', LogBuddy::VERSION) do |p|
|
|
22
22
|
p.rdoc_template = rdoc_template
|
23
23
|
end
|
24
24
|
|
25
|
+
desc 'Test LogBuddy.'
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.pattern = 'spec/**/*_spec.rb'
|
29
|
+
t.verbose = true
|
30
|
+
end
|
31
|
+
|
25
32
|
echoe.spec.add_development_dependency "allison"
|
26
33
|
echoe.spec.add_development_dependency "markaby"
|
data/examples.rb
CHANGED
data/init.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
require 'log_buddy'
|
1
|
+
require 'log_buddy'
|
2
|
+
LogBuddy.init unless ENV["SAFE_LOG_BUDDY"]
|
data/lib/log_buddy.rb
CHANGED
data/log_buddy.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{log_buddy}
|
3
|
-
s.version = "0.0
|
3
|
+
s.version = "0.1.0"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new("= 1.2") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["Rob Sanheim - Relevance"]
|
7
|
-
s.date = %q{2008-
|
7
|
+
s.date = %q{2008-09-29}
|
8
8
|
s.description = %q{Log statements along with their name easily. Mixin a logger everywhere when you need it.}
|
9
9
|
s.email = %q{opensource@thinkrelevance.com}
|
10
|
-
s.extra_rdoc_files = ["CHANGELOG", "
|
11
|
-
s.files = ["CHANGELOG", "
|
10
|
+
s.extra_rdoc_files = ["CHANGELOG", "lib/log_buddy.rb", "LICENSE", "README.rdoc"]
|
11
|
+
s.files = ["CHANGELOG", "examples.rb", "init.rb", "lib/log_buddy.rb", "LICENSE", "log_buddy.gemspec", "Manifest", "Rakefile", "README.rdoc", "spec/helper.rb", "spec/log_buddy_init_spec.rb", "spec/log_buddy_spec.rb"]
|
12
12
|
s.has_rdoc = true
|
13
13
|
s.homepage = %q{http://opensource.thinkrelevance.com/wiki/log_buddy}
|
14
14
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Log_buddy", "--main", "README.rdoc"]
|
@@ -16,7 +16,6 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.rubyforge_project = %q{thinkrelevance}
|
17
17
|
s.rubygems_version = %q{1.2.0}
|
18
18
|
s.summary = %q{Log Buddy is your little development buddy.}
|
19
|
-
s.test_files = ["test/test_log_buddy.rb"]
|
20
19
|
|
21
20
|
if s.respond_to? :specification_version then
|
22
21
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
data/spec/helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "test/unit"
|
3
|
+
require "test/spec"
|
4
|
+
require "test/spec/should-output"
|
5
|
+
require "mocha"
|
6
|
+
require "redgreen" rescue nil
|
7
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "log_buddy"))
|
8
|
+
|
9
|
+
def silence_warnings
|
10
|
+
old_verbose, $VERBOSE = $VERBOSE, nil
|
11
|
+
yield
|
12
|
+
ensure
|
13
|
+
$VERBOSE = old_verbose
|
14
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), *%w[helper]))
|
2
|
+
|
3
|
+
describe "LogBuddy init" do
|
4
|
+
after { reset_safe_log_buddy_mode }
|
5
|
+
|
6
|
+
it "doesnt mixin to object if SAFE_LOG_BUDDY is true" do
|
7
|
+
LogBuddy.expects(:init).never
|
8
|
+
ENV["SAFE_LOG_BUDDY"] = "true"
|
9
|
+
load_init
|
10
|
+
end
|
11
|
+
|
12
|
+
it "mixin to object if SAFE_LOG_BUDDY is true" do
|
13
|
+
LogBuddy.expects(:init).once
|
14
|
+
load_init
|
15
|
+
end
|
16
|
+
|
17
|
+
def load_init
|
18
|
+
silence_warnings do
|
19
|
+
load File.join(File.dirname(__FILE__), *%w[.. init.rb])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def reset_safe_log_buddy_mode
|
24
|
+
ENV["SAFE_LOG_BUDDY"] = nil
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -1,10 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require "test/unit"
|
3
|
-
require "test/spec"
|
4
|
-
require "test/spec/should-output"
|
5
|
-
require 'mocha'
|
6
|
-
require 'logger'
|
7
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "log_buddy"))
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), *%w[helper]))
|
8
2
|
|
9
3
|
module SomeModule
|
10
4
|
def self.say_something(name)
|
@@ -17,13 +11,8 @@ module SomeModule
|
|
17
11
|
end
|
18
12
|
|
19
13
|
describe "LogBuddy" do
|
20
|
-
|
21
|
-
describe "raise no method error if init isn't called" do
|
22
|
-
lambda { Object.new.d }.should.raise NoMethodError
|
23
|
-
end
|
24
|
-
|
25
14
|
describe "object extensions" do
|
26
|
-
it "mixes itself into Object
|
15
|
+
it "mixes itself into Object instance and class level by default" do
|
27
16
|
Object.expects(:include).with(LogBuddy::Mixin)
|
28
17
|
Object.expects(:extend).with(LogBuddy::Mixin)
|
29
18
|
LogBuddy.init
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relevance-log_buddy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Sanheim - Relevance
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-09-29 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -47,18 +47,22 @@ extensions: []
|
|
47
47
|
|
48
48
|
extra_rdoc_files:
|
49
49
|
- CHANGELOG
|
50
|
-
- README.rdoc
|
51
50
|
- lib/log_buddy.rb
|
51
|
+
- LICENSE
|
52
|
+
- README.rdoc
|
52
53
|
files:
|
53
54
|
- CHANGELOG
|
54
|
-
- Manifest
|
55
|
-
- README.rdoc
|
56
|
-
- Rakefile
|
57
55
|
- examples.rb
|
58
56
|
- init.rb
|
59
57
|
- lib/log_buddy.rb
|
60
|
-
-
|
58
|
+
- LICENSE
|
61
59
|
- log_buddy.gemspec
|
60
|
+
- Manifest
|
61
|
+
- Rakefile
|
62
|
+
- README.rdoc
|
63
|
+
- spec/helper.rb
|
64
|
+
- spec/log_buddy_init_spec.rb
|
65
|
+
- spec/log_buddy_spec.rb
|
62
66
|
has_rdoc: true
|
63
67
|
homepage: http://opensource.thinkrelevance.com/wiki/log_buddy
|
64
68
|
post_install_message:
|
@@ -90,5 +94,5 @@ rubygems_version: 1.2.0
|
|
90
94
|
signing_key:
|
91
95
|
specification_version: 2
|
92
96
|
summary: Log Buddy is your little development buddy.
|
93
|
-
test_files:
|
94
|
-
|
97
|
+
test_files: []
|
98
|
+
|