flowerbox 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Flowerbox
2
2
 
3
- TODO: Write a gem description
3
+ Flowerbox gives you pretty log output for debugging rails applications
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,32 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ Flowerbox extends ActiveSupport::BufferedLogger with the method #flowerbox
22
+
23
+ It logs the inspected arguments at info loglevel along with the file and line where it was called.
24
+
25
+ ```ruby
26
+ logger.flowerbox([], {})
27
+ ```
28
+
29
+ ```
30
+ ================================================================================
31
+ /Users/ehrenmurdick/projects/flowerbox/test.rb:29:in `block (2 levels) in <top (required)>'
32
+ --------------------------------------------------------------------------------
33
+ []
34
+ --------------------------------------------------------------------------------
35
+ {}
36
+ ================================================================================
37
+ ```
38
+
39
+
40
+ By default flowerbox only outputs in the log in development mode. To enable it in test or any other environment, create
41
+ config/initializers/flowerbox.rb and add
42
+
43
+ ```ruby
44
+ Flowerbox.enable("test")
45
+ ```
46
+
22
47
 
23
48
  ## Contributing
24
49
 
@@ -1,3 +1,3 @@
1
1
  module Flowerbox
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/flowerbox.rb CHANGED
@@ -1,20 +1,26 @@
1
1
  require "flowerbox/version"
2
2
 
3
3
  module Flowerbox
4
- if Rails.env == "development"
5
- def flowerbox *objs
6
- info "=" * 80
7
- info caller[1]
8
- objs.each do |o|
9
- info "-" * 80
10
- info o.inspect
4
+ def flowerbox *objs
5
+ end
6
+
7
+ def self.enable(env)
8
+ if Rails.env == env
9
+ class_eval do
10
+ def flowerbox *objs
11
+ info "=" * 80
12
+ info caller[1]
13
+ objs.each do |o|
14
+ info "-" * 80
15
+ info o.inspect
16
+ end
17
+ info "=" * 80
18
+ end
11
19
  end
12
- info "=" * 80
13
- end
14
- else
15
- def flowerbox *objs
16
20
  end
17
21
  end
22
+
23
+ enable "development"
18
24
  end
19
25
 
20
26
  ActiveSupport::BufferedLogger.send(:include, Flowerbox)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flowerbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -56,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
56
  version: '0'
57
57
  segments:
58
58
  - 0
59
- hash: 3855520414111520791
59
+ hash: 1705221955776818042
60
60
  required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  version: '0'
66
66
  segments:
67
67
  - 0
68
- hash: 3855520414111520791
68
+ hash: 1705221955776818042
69
69
  requirements: []
70
70
  rubyforge_project:
71
71
  rubygems_version: 1.8.24