relevance-log_buddy 0.1.3 → 0.1.5
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/Manifest +11 -8
- data/README.rdoc +4 -3
- data/Rakefile +25 -9
- data/{spec/helper.rb → examples/example_helper.rb} +6 -4
- data/examples/log_buddy_example.rb +37 -0
- data/examples/log_buddy_init_example.rb +30 -0
- data/{spec/log_buddy_spec.rb → examples/log_example.rb} +44 -41
- data/init.rb +1 -1
- data/lib/log_buddy.rb +34 -75
- data/lib/log_buddy/mixin.rb +32 -0
- data/lib/log_buddy/utils.rb +29 -0
- data/lib/log_buddy/version.rb +9 -0
- data/log_buddy.gemspec +5 -5
- metadata +19 -11
- data/spec/log_buddy_init_spec.rb +0 -27
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
v0.1.5 Clean up specs and remove noise from spec run
|
2
|
+
|
3
|
+
v0.1.4 Micronauts Unite! Test Suite now runs via Micronaut - http://github.com/spicycode/micronaut/
|
4
|
+
|
1
5
|
v0.1.3 Use plain old echoe; really fix rubygems errors (I hope)
|
2
6
|
|
3
7
|
v0.1.2 Attempting to fix rubygems errors
|
data/Manifest
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
CHANGELOG
|
2
|
-
examples.rb
|
3
|
-
init.rb
|
4
|
-
lib/log_buddy.rb
|
5
2
|
LICENSE
|
6
|
-
log_buddy.gemspec
|
7
3
|
Manifest
|
8
|
-
Rakefile
|
9
4
|
README.rdoc
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
Rakefile
|
6
|
+
examples/example_helper.rb
|
7
|
+
examples/log_buddy_example.rb
|
8
|
+
examples/log_buddy_init_example.rb
|
9
|
+
examples/log_example.rb
|
10
|
+
examples.rb
|
11
|
+
init.rb
|
12
|
+
lib/log_buddy/mixin.rb
|
13
|
+
lib/log_buddy/utils.rb
|
14
|
+
lib/log_buddy/version.rb
|
15
|
+
lib/log_buddy.rb
|
data/README.rdoc
CHANGED
@@ -54,10 +54,11 @@ See examples.rb for live examples you can run.
|
|
54
54
|
|
55
55
|
== URLS
|
56
56
|
|
57
|
-
* Log bugs, issues, and suggestions
|
58
|
-
* View Source: http://github.com/relevance/logbuddy
|
57
|
+
* Log bugs, issues, and suggestions at Lighthouse: http://relevance.lighthouseapp.com/projects/19074-log-buddy/overview
|
58
|
+
* View Source: http://github.com/relevance/logbuddy
|
59
59
|
* Git clone Source: git://github.com/relevance/logbuddy.git
|
60
|
-
*
|
60
|
+
* Continuous Integration: http://runcoderun.com/relevance/logbuddy
|
61
|
+
* RDocs: http://thinkrelevance.rubyforge.org/log_buddy
|
61
62
|
|
62
63
|
== LICENSE:
|
63
64
|
|
data/Rakefile
CHANGED
@@ -1,27 +1,43 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
gem 'echoe'
|
3
3
|
require 'echoe'
|
4
|
-
require
|
4
|
+
require File.join(File.dirname(__FILE__), *%w[lib log_buddy version])
|
5
5
|
|
6
|
-
echoe = Echoe.new('log_buddy', LogBuddy::VERSION) do |p|
|
6
|
+
echoe = Echoe.new('log_buddy', LogBuddy::VERSION::STRING) do |p|
|
7
7
|
p.rubyforge_name = 'thinkrelevance'
|
8
8
|
p.author = 'Rob Sanheim - Relevance'
|
9
9
|
p.email = 'opensource@thinkrelevance.com'
|
10
10
|
p.summary = 'Log Buddy is your little development buddy.'
|
11
11
|
p.description = 'Log statements along with their name easily. Mixin a logger everywhere when you need it.'
|
12
|
-
p.url = "http://
|
13
|
-
p.rdoc_pattern = /^(lib|bin|ext)|txt|rdoc|CHANGELOG|LICENSE$/
|
12
|
+
p.url = "http://github.com/relevance/logbuddy"
|
13
|
+
p.rdoc_pattern = /^(lib|bin|ext)|txt|rdoc|gemspec|CHANGELOG|LICENSE$/
|
14
14
|
rdoc_template = `allison --path`.strip << ".rb"
|
15
15
|
p.rdoc_template = rdoc_template
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
Rake
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
Rake.application.instance_variable_get(:@tasks).delete("default")
|
19
|
+
Rake.application.instance_variable_get(:@tasks).delete("test")
|
20
|
+
|
21
|
+
namespace :micronaut do
|
22
|
+
|
23
|
+
desc 'Run all examples'
|
24
|
+
task :examples do
|
25
|
+
examples = Dir["examples/**/*_example.rb"].map { |g| Dir.glob(g) }.flatten
|
26
|
+
examples.map! {|f| %Q(require "#{f}")}
|
27
|
+
command = "-e '#{examples.join("; ")}'"
|
28
|
+
ruby command
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "Run all examples using rcov"
|
32
|
+
task :coverage do
|
33
|
+
examples = Dir["examples/**/*_example.rb"].map { |g| Dir.glob(g) }.flatten
|
34
|
+
system "rcov --exclude \"examples/*,gems/*,db/*,/Library/Ruby/*,config/*\" --text-report --sort coverage --no-validator-links #{examples.join(' ')}"
|
35
|
+
end
|
36
|
+
|
23
37
|
end
|
24
38
|
|
39
|
+
task :default => 'micronaut:coverage'
|
40
|
+
|
25
41
|
# The below results in 'input stream exhausted' - dunno why?
|
26
42
|
# task :release => [:test, :publish_docs, :announce]
|
27
43
|
|
@@ -1,9 +1,9 @@
|
|
1
|
+
require 'logger'
|
1
2
|
require 'rubygems'
|
2
|
-
|
3
|
-
|
4
|
-
require "test/spec/should-output"
|
3
|
+
gem 'spicycode-micronaut', "= 0.0.4"
|
4
|
+
gem 'mocha'
|
5
5
|
require "mocha"
|
6
|
-
require
|
6
|
+
require 'micronaut'
|
7
7
|
require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "log_buddy"))
|
8
8
|
|
9
9
|
def silence_warnings
|
@@ -12,3 +12,5 @@ def silence_warnings
|
|
12
12
|
ensure
|
13
13
|
$VERBOSE = old_verbose
|
14
14
|
end
|
15
|
+
|
16
|
+
Micronaut::Runner.autorun
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), *%w[example_helper]))
|
2
|
+
|
3
|
+
describe LogBuddy do
|
4
|
+
|
5
|
+
it "has logger" do
|
6
|
+
LogBuddy.should respond_to(:logger)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "has stdout config option" do
|
10
|
+
LogBuddy.should respond_to(:log_to_stdout?)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "init" do
|
14
|
+
it "mixes itself into Object instance and class level by default" do
|
15
|
+
Object.expects(:include).with(LogBuddy::Mixin)
|
16
|
+
Object.expects(:extend).with(LogBuddy::Mixin)
|
17
|
+
LogBuddy.init
|
18
|
+
end
|
19
|
+
|
20
|
+
it "adds logger method to Object instance and class" do
|
21
|
+
LogBuddy.init
|
22
|
+
Object.new.should respond_to(:logger)
|
23
|
+
Object.should respond_to(:logger)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "defaults to log to stdout (as well as logger)" do
|
27
|
+
LogBuddy.init
|
28
|
+
LogBuddy.log_to_stdout?.should == true
|
29
|
+
end
|
30
|
+
|
31
|
+
it "can be configured to log to stdout" do
|
32
|
+
LogBuddy.init :stdout => false
|
33
|
+
LogBuddy.log_to_stdout?.should == true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), *%w[example_helper]))
|
2
|
+
|
3
|
+
describe LogBuddy do
|
4
|
+
describe "init" do
|
5
|
+
after { reset_safe_log_buddy_mode }
|
6
|
+
|
7
|
+
it "doesnt mixin to object if SAFE_LOG_BUDDY is true" do
|
8
|
+
LogBuddy.expects(:init).never
|
9
|
+
ENV["SAFE_LOG_BUDDY"] = "true"
|
10
|
+
load_init
|
11
|
+
end
|
12
|
+
|
13
|
+
it "mixin to object if SAFE_LOG_BUDDY is true" do
|
14
|
+
LogBuddy.expects(:init).once
|
15
|
+
load_init
|
16
|
+
end
|
17
|
+
|
18
|
+
def load_init
|
19
|
+
silence_warnings do
|
20
|
+
load File.join(File.dirname(__FILE__), *%w[.. init.rb])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def reset_safe_log_buddy_mode
|
25
|
+
ENV["SAFE_LOG_BUDDY"] = nil
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), *%w[
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), *%w[example_helper]))
|
2
2
|
|
3
3
|
module SomeModule
|
4
4
|
def self.say_something(name)
|
@@ -9,58 +9,45 @@ module SomeModule
|
|
9
9
|
"hello"
|
10
10
|
end
|
11
11
|
|
12
|
-
def self.
|
13
|
-
raise
|
12
|
+
def self.raise_runtime_error
|
13
|
+
raise RuntimeError
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
describe
|
18
|
-
describe "object extensions" do
|
19
|
-
it "mixes itself into Object instance and class level by default" do
|
20
|
-
Object.expects(:include).with(LogBuddy::Mixin)
|
21
|
-
Object.expects(:extend).with(LogBuddy::Mixin)
|
22
|
-
LogBuddy.init
|
23
|
-
end
|
17
|
+
describe LogBuddy::Mixin, " behavior" do
|
24
18
|
|
25
|
-
|
19
|
+
it "uses RAILS_DEFAULT_LOGGER if its defined" do
|
20
|
+
begin
|
21
|
+
Object.const_set "RAILS_DEFAULT_LOGGER", stub_everything
|
26
22
|
LogBuddy.init
|
27
|
-
Object.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
it "uses RAILS_DEFAULT_LOGGER if its defined" do
|
32
|
-
begin
|
33
|
-
Object.const_set "RAILS_DEFAULT_LOGGER", stub_everything
|
34
|
-
LogBuddy.init
|
35
|
-
Object.logger.should == RAILS_DEFAULT_LOGGER
|
36
|
-
ensure
|
37
|
-
Object.send :remove_const, "RAILS_DEFAULT_LOGGER"
|
38
|
-
end
|
23
|
+
Object.logger.should == RAILS_DEFAULT_LOGGER
|
24
|
+
ensure
|
25
|
+
Object.send :remove_const, "RAILS_DEFAULT_LOGGER"
|
39
26
|
end
|
27
|
+
end
|
40
28
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
29
|
+
it "uses a plain STDOUT Ruby logger if there is no RAILS_DEFAULT_LOGGER" do
|
30
|
+
LogBuddy.init
|
31
|
+
Object.logger.should == LogBuddy.logger
|
32
|
+
end
|
45
33
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
34
|
+
it "can override the default logger" do
|
35
|
+
file_logger = Logger.new "test.log"
|
36
|
+
LogBuddy.init :logger => file_logger
|
37
|
+
Object.logger.should == file_logger
|
51
38
|
end
|
52
39
|
|
53
40
|
describe "outputting the code being logged and its result" do
|
54
|
-
before { LogBuddy.init }
|
41
|
+
before { LogBuddy.init :log_to_stdout => false }
|
55
42
|
it "should log to default logger" do
|
56
|
-
LogBuddy.expects(:
|
43
|
+
LogBuddy.expects(:logger).returns(logger = mock)
|
57
44
|
logger.expects(:debug).with(anything)
|
58
|
-
d {'hi'}
|
45
|
+
d {'hi man'}
|
59
46
|
end
|
60
47
|
|
61
48
|
it "should log a plain arg" do
|
62
|
-
LogBuddy.expects(:debug).with('
|
63
|
-
d '
|
49
|
+
LogBuddy.expects(:debug).with('hey yo')
|
50
|
+
d 'hey yo'
|
64
51
|
end
|
65
52
|
|
66
53
|
it "logs both if given an arg and a block" do
|
@@ -71,7 +58,7 @@ describe "LogBuddy" do
|
|
71
58
|
end
|
72
59
|
|
73
60
|
it "does nothing without a block" do
|
74
|
-
|
61
|
+
lambda { d }.should_not raise_error
|
75
62
|
end
|
76
63
|
|
77
64
|
it "should output only local vars in the block" do
|
@@ -114,9 +101,25 @@ describe "LogBuddy" do
|
|
114
101
|
d { local1; local2; @ivar1 }
|
115
102
|
end
|
116
103
|
|
117
|
-
it "should gracefully handle
|
118
|
-
LogBuddy.expects(:debug).with('LogBuddy caught an exception:
|
119
|
-
d { SomeModule.
|
104
|
+
it "should gracefully handle runtimer errors" do
|
105
|
+
LogBuddy.expects(:debug).with('LogBuddy caught an exception: RuntimeError')
|
106
|
+
d { SomeModule.raise_runtime_error }
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "stdout" do
|
112
|
+
before { Logger.any_instance.stubs(:debug) }
|
113
|
+
it "logs to stdout as well as the default logger" do
|
114
|
+
LogBuddy.init :log_to_stdout => true
|
115
|
+
LogBuddy.expects(:stdout_puts).with(%["foo" = 'foo'\n])
|
116
|
+
d { "foo" }
|
117
|
+
end
|
118
|
+
|
119
|
+
it "doesnt log to stdout if stdout configured off" do
|
120
|
+
LogBuddy.init :log_to_stdout => false
|
121
|
+
LogBuddy.expects(:stdout_puts).never
|
122
|
+
d { "foo" }
|
120
123
|
end
|
121
124
|
end
|
122
125
|
end
|
data/init.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
1
|
+
require File.join(File.dirname(__FILE__), *%w[lib log_buddy])
|
2
2
|
LogBuddy.init unless ENV["SAFE_LOG_BUDDY"]
|
data/lib/log_buddy.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), *%w[log_buddy utils])
|
2
|
+
require File.join(File.dirname(__FILE__), *%w[log_buddy mixin])
|
3
|
+
require File.join(File.dirname(__FILE__), *%w[log_buddy version])
|
4
|
+
|
1
5
|
=begin rdoc
|
2
6
|
LogBuddy is a developer tool for easy logging while testing, debugging, and inspecting.
|
3
7
|
|
4
|
-
|
8
|
+
The log shortcut method to give you easy, concise output of variables with their names and values.
|
5
9
|
|
6
10
|
Examples:
|
7
11
|
a = "foo"
|
@@ -15,15 +19,19 @@ Examples:
|
|
15
19
|
d { bark } # logs "bark = woof!"
|
16
20
|
|
17
21
|
=end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
#
|
22
|
+
module LogBuddy
|
23
|
+
# Configure and include LogBuddy into Object.
|
24
|
+
# You can pass in any of the following configuration options:
|
25
|
+
#
|
26
|
+
# * <tt>:logger</tt> - the logger instance that LogBuddy should use (if not provided,
|
27
|
+
# tries to default to RAILS_DEFAULT_LOGGER, and then to a STDOUT logger).
|
28
|
+
# * <tt):log_to_stdout</tt> - whether LogBuddy should _also_ log to STDOUT, very helpful for Autotest (default is +true+).
|
22
29
|
def self.init(options = {})
|
23
|
-
@logger = options[:
|
30
|
+
@logger = options[:logger]
|
31
|
+
@log_to_stdout = options.has_key?(:log_to_stdout) ? options[:log_to_stdout] : true
|
24
32
|
mixin_to_object
|
25
33
|
end
|
26
|
-
|
34
|
+
|
27
35
|
# Add the LogBuddy::Mixin to Object instance and class level.
|
28
36
|
def self.mixin_to_object
|
29
37
|
Object.class_eval {
|
@@ -31,77 +39,28 @@ class LogBuddy
|
|
31
39
|
extend LogBuddy::Mixin
|
32
40
|
}
|
33
41
|
end
|
34
|
-
|
35
|
-
# The main Mixin that gets added on the #init call
|
36
|
-
module Mixin
|
37
|
-
# This is where the magic happens. This method can take a plain old string, and it will log
|
38
|
-
# it like any call to Logger#debug. To get the name of the thing you are logging and its value,
|
39
|
-
# use the block form:
|
40
|
-
# d { @a }
|
41
|
-
#
|
42
|
-
# Seperate with semicolons for multiple things - pretty much any valid ruby will work.
|
43
|
-
# d { @@foo; MY_CONST }
|
44
|
-
# d { @person; @@place; object.method() }
|
45
|
-
#
|
46
|
-
def d(msg = nil, &blk)
|
47
|
-
LogBuddy.debug(msg) if msg
|
48
|
-
return unless block_given?
|
49
|
-
begin
|
50
|
-
logged_line = LogBuddy.read_line(caller[0])
|
51
|
-
arguments = LogBuddy.parse_args(logged_line)
|
52
|
-
arguments.each do |arg|
|
53
|
-
result = eval(arg, blk.binding)
|
54
|
-
LogBuddy.debug(%[#{arg} = '#{result}'\n])
|
55
|
-
end
|
56
|
-
rescue Exception => e
|
57
|
-
LogBuddy.debug "LogBuddy caught an exception: #{e.message}"
|
58
|
-
end
|
59
|
-
end
|
60
42
|
|
61
|
-
|
43
|
+
class << self
|
44
|
+
include LogBuddy::Utils
|
62
45
|
def logger
|
63
|
-
|
46
|
+
return @logger if @logger
|
47
|
+
@logger = init_default_logger
|
64
48
|
end
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
@logger = Object.const_get("RAILS_DEFAULT_LOGGER")
|
80
|
-
else
|
81
|
-
require 'logger'
|
82
|
-
@logger = Logger.new(STDOUT)
|
49
|
+
|
50
|
+
def log_to_stdout?
|
51
|
+
@log_to_stdout
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def init_default_logger
|
57
|
+
if Object.const_defined?("RAILS_DEFAULT_LOGGER")
|
58
|
+
@logger = Object.const_get("RAILS_DEFAULT_LOGGER")
|
59
|
+
else
|
60
|
+
require 'logger'
|
61
|
+
@logger = Logger.new(STDOUT)
|
62
|
+
end
|
83
63
|
end
|
84
|
-
end
|
85
|
-
|
86
|
-
# Just debug it
|
87
|
-
def self.debug(str)
|
88
|
-
default_logger.debug(str)
|
89
|
-
end
|
90
|
-
|
91
|
-
# Returns array of arguments in the block
|
92
|
-
# You must ues the brace form (ie d { "hi" }) and not do...end
|
93
|
-
def self.parse_args(logged_line)
|
94
|
-
block_contents = logged_line[/\{(.*)\}/, 1]
|
95
|
-
args = block_contents.split(";").map {|arg| arg.strip }
|
96
|
-
end
|
97
|
-
|
98
|
-
# Return the calling line
|
99
|
-
def self.read_line(frame)
|
100
|
-
file, line_number = frame.split(/:/, 2)
|
101
|
-
line_number = line_number.to_i
|
102
|
-
lines = File.readlines(file)
|
103
64
|
|
104
|
-
lines[line_number - 1]
|
105
65
|
end
|
106
|
-
|
107
|
-
end
|
66
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module LogBuddy
|
2
|
+
# The main Mixin that gets added on the #init call
|
3
|
+
module Mixin
|
4
|
+
# This is where the magic happens. This method can take a plain old string, and it will log
|
5
|
+
# it like any call to Logger#debug. To get the name of the thing you are logging and its value,
|
6
|
+
# use the block form:
|
7
|
+
# d { @a }
|
8
|
+
#
|
9
|
+
# Seperate with semicolons for multiple things - pretty much any valid ruby will work.
|
10
|
+
# d { @@foo; MY_CONST }
|
11
|
+
# d { @person; @@place; object.method() }
|
12
|
+
#
|
13
|
+
def d(msg = nil, &blk)
|
14
|
+
LogBuddy.debug(msg) if msg
|
15
|
+
return unless block_given?
|
16
|
+
begin
|
17
|
+
logged_line = LogBuddy.read_line(caller[0])
|
18
|
+
arguments = LogBuddy.parse_args(logged_line)
|
19
|
+
arguments.each do |arg|
|
20
|
+
result = eval(arg, blk.binding)
|
21
|
+
LogBuddy.debug(%[#{arg} = '#{result}'\n])
|
22
|
+
end
|
23
|
+
rescue RuntimeError => e
|
24
|
+
LogBuddy.debug "LogBuddy caught an exception: #{e.message}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def logger
|
29
|
+
LogBuddy.logger
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module LogBuddy
|
2
|
+
module Utils
|
3
|
+
|
4
|
+
def debug(str)
|
5
|
+
stdout_puts(str) if log_to_stdout?
|
6
|
+
logger.debug(str)
|
7
|
+
end
|
8
|
+
|
9
|
+
def stdout_puts(str)
|
10
|
+
puts str
|
11
|
+
end
|
12
|
+
|
13
|
+
# Returns array of arguments in the block
|
14
|
+
# You must ues the brace form (ie d { "hi" }) and not do...end
|
15
|
+
def parse_args(logged_line)
|
16
|
+
block_contents = logged_line[/\{(.*)\}/, 1]
|
17
|
+
args = block_contents.split(";").map {|arg| arg.strip }
|
18
|
+
end
|
19
|
+
|
20
|
+
# Return the calling line
|
21
|
+
def read_line(frame)
|
22
|
+
file, line_number = frame.split(/:/, 2)
|
23
|
+
line_number = line_number.to_i
|
24
|
+
lines = File.readlines(file)
|
25
|
+
|
26
|
+
lines[line_number - 1]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/log_buddy.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{log_buddy}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Rob Sanheim - Relevance"]
|
9
|
-
s.date = %q{2008-
|
9
|
+
s.date = %q{2008-12-05}
|
10
10
|
s.description = %q{Log statements along with their name easily. Mixin a logger everywhere when you need it.}
|
11
11
|
s.email = %q{opensource@thinkrelevance.com}
|
12
|
-
s.extra_rdoc_files = ["CHANGELOG", "lib/log_buddy.rb", "
|
13
|
-
s.files = ["CHANGELOG", "
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.rdoc", "lib/log_buddy/mixin.rb", "lib/log_buddy/utils.rb", "lib/log_buddy/version.rb", "lib/log_buddy.rb", "log_buddy.gemspec"]
|
13
|
+
s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.rdoc", "Rakefile", "examples/example_helper.rb", "examples/log_buddy_example.rb", "examples/log_buddy_init_example.rb", "examples/log_example.rb", "examples.rb", "init.rb", "lib/log_buddy/mixin.rb", "lib/log_buddy/utils.rb", "lib/log_buddy/version.rb", "lib/log_buddy.rb", "log_buddy.gemspec"]
|
14
14
|
s.has_rdoc = true
|
15
|
-
s.homepage = %q{http://
|
15
|
+
s.homepage = %q{http://github.com/relevance/logbuddy}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Log_buddy", "--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = %q{thinkrelevance}
|
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.1.
|
4
|
+
version: 0.1.5
|
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-12-05 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -56,24 +56,32 @@ extensions: []
|
|
56
56
|
|
57
57
|
extra_rdoc_files:
|
58
58
|
- CHANGELOG
|
59
|
-
- lib/log_buddy.rb
|
60
59
|
- LICENSE
|
61
60
|
- README.rdoc
|
61
|
+
- lib/log_buddy/mixin.rb
|
62
|
+
- lib/log_buddy/utils.rb
|
63
|
+
- lib/log_buddy/version.rb
|
64
|
+
- lib/log_buddy.rb
|
65
|
+
- log_buddy.gemspec
|
62
66
|
files:
|
63
67
|
- CHANGELOG
|
68
|
+
- LICENSE
|
69
|
+
- Manifest
|
70
|
+
- README.rdoc
|
71
|
+
- Rakefile
|
72
|
+
- examples/example_helper.rb
|
73
|
+
- examples/log_buddy_example.rb
|
74
|
+
- examples/log_buddy_init_example.rb
|
75
|
+
- examples/log_example.rb
|
64
76
|
- examples.rb
|
65
77
|
- init.rb
|
78
|
+
- lib/log_buddy/mixin.rb
|
79
|
+
- lib/log_buddy/utils.rb
|
80
|
+
- lib/log_buddy/version.rb
|
66
81
|
- lib/log_buddy.rb
|
67
|
-
- LICENSE
|
68
82
|
- log_buddy.gemspec
|
69
|
-
- Manifest
|
70
|
-
- Rakefile
|
71
|
-
- README.rdoc
|
72
|
-
- spec/helper.rb
|
73
|
-
- spec/log_buddy_init_spec.rb
|
74
|
-
- spec/log_buddy_spec.rb
|
75
83
|
has_rdoc: true
|
76
|
-
homepage: http://
|
84
|
+
homepage: http://github.com/relevance/logbuddy
|
77
85
|
post_install_message:
|
78
86
|
rdoc_options:
|
79
87
|
- --line-numbers
|
data/spec/log_buddy_init_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
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
|