puts_debuggerer 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -8
  3. data/lib/puts_debuggerer.rb +5 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f63870f52c5a1fcfde9556bca624180ad098c43
4
- data.tar.gz: 5e4b9f5af1b8f2d3daabb519ecc5bb490779e7c8
3
+ metadata.gz: 0b6b423e48750ec42b8ba75d9d11b9bee413f968
4
+ data.tar.gz: 436e88ff0bae84786ae496c93e9051c6a7e038f2
5
5
  SHA512:
6
- metadata.gz: 29c620c7faec7a524ee775cf3108aaad57a21ec3891763733a5222b552b7dc6507881b0b8dd173b42dacd668783d3d0fd95d4b63123943b02509b0cfb432ad62
7
- data.tar.gz: f53bdfb0185323d065bca4dc15f8bbbf319d28c545b03441102f91d05ad5db3bb336997598334e0a5682d0aec972f91ffffa7df4c17828b15861ba6ef4b87a85
6
+ metadata.gz: 8d1fd6d211ef47039e03d2fcf0dd4e093bf68d28bae54fb3285a72fc7cb179889eefd2e4340eaecea7c630c8ec7b671a2d9b26ffbd01fc2acaccbed99e90fb17
7
+ data.tar.gz: 627007999c72fd0c33d7ea60aa6703f68b56ea55c3698e0cca578e41f961aaac5f01dd924a0fd3e9fac9a97364b416d82534e4cedc6855fa2f4720e988cf78ae
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # puts_debuggerer v0.8.0
1
+ # Puts Debuggerer (debugger-less debugging FTW)
2
2
  [![Gem Version](https://badge.fury.io/rb/puts_debuggerer.svg)](http://badge.fury.io/rb/puts_debuggerer)
3
3
  [![Build Status](https://travis-ci.org/AndyObtiva/puts_debuggerer.svg?branch=master)](https://travis-ci.org/AndyObtiva/puts_debuggerer)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/puts_debuggerer/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/puts_debuggerer?branch=master)
@@ -10,11 +10,8 @@ legitimate thing?!!
10
10
 
11
11
  Enter puts_debuggerer. A guilt-free puts debugging Ruby gem FTW!
12
12
 
13
- Partially inspired (only partially ;) by this blog post:
13
+ For background, please read this blog post by Aaron Patterson:
14
14
  https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html
15
- (Credit to Tenderlove.)
16
-
17
- Love PD?! Why not promote with [merchandise](https://www.zazzle.com/i+heart+pd+gifts)? Maybe I'll buy everyone wearing the merchandise a beer at software conferences.
18
15
 
19
16
  ## Background
20
17
 
@@ -89,7 +86,7 @@ And it is easy to search for using the `[PD]` announcer.
89
86
  Add the following to bundler's `Gemfile`.
90
87
 
91
88
  ```ruby
92
- gem 'puts_debuggerer', '~> 0.8.0'
89
+ gem 'puts_debuggerer', '~> 0.8.1'
93
90
  ```
94
91
 
95
92
  This is the recommended way for [Rails](rubyonrails.org) apps. Optionally, you may create an initializer under `config/initializers` named `puts_debuggerer_options.rb` to enable further customizations as per the [Options](#options) section below.
@@ -99,7 +96,7 @@ This is the recommended way for [Rails](rubyonrails.org) apps. Optionally, you m
99
96
  Or manually install and require library.
100
97
 
101
98
  ```bash
102
- gem install puts_debuggerer -v0.8.0
99
+ gem install puts_debuggerer -v0.8.1
103
100
  ```
104
101
 
105
102
  ```ruby
@@ -287,7 +284,13 @@ Examples of global methods are `:puts` and `:print`.
287
284
  An example of a lambda expression is `lambda {|output| Rails.logger.info(output)}`
288
285
 
289
286
  Defaults to `:puts`
290
- In Rails, it defaults to: `lambda {|output| Rails.logger.debug(output)}`
287
+ In Rails, it defaults to:
288
+ ```ruby
289
+ lambda do |output|
290
+ puts output if Rails.env.test?
291
+ Rails.logger.debug(output)
292
+ end
293
+ ```
291
294
 
292
295
  Example:
293
296
 
@@ -563,6 +566,7 @@ Prints out `puts __caller_source_line__`
563
566
 
564
567
  ## Release Notes
565
568
 
569
+ * v0.8.1: `printer` option support for Rails test environment
566
570
  * v0.8.0: `printer` option support
567
571
  * v0.7.1: default print engine to :ap (AwesomePrint)
568
572
  * v0.7.0: `run_at` option, global and piecemeal.
@@ -577,7 +581,10 @@ Prints out `puts __caller_source_line__`
577
581
 
578
582
  ## TODO
579
583
 
584
+ * fix issue with printing in rspec inside a Rails project without having to do extra configuration
585
+ * fix issue with erb support
580
586
  * display run_at run number in printout
587
+ * implement fallback in irb for when line number cannot be discovered (issue happens in pry, perhaps this just means support pry)
581
588
 
582
589
  ## Contributing
583
590
 
@@ -5,6 +5,10 @@ module PutsDebuggerer
5
5
  HEADER_DEFAULT = '*'*80
6
6
  FOOTER_DEFAULT = '*'*80
7
7
  PRINTER_DEFAULT = :puts
8
+ PRINTER_RAILS = lambda do |output|
9
+ puts output if Rails.env.test?
10
+ Rails.logger.debug(output)
11
+ end
8
12
  PRINT_ENGINE_DEFAULT = :ap
9
13
  PRINTER_MESSAGE_INVALID = 'printer must be a valid global method symbol (e.g. :puts) or lambda/proc receiving a text arg'
10
14
  PRINT_ENGINE_MESSAGE_INVALID = 'print_engine must be a valid global method symbol (e.g. :p, :ap or :pp) or lambda/proc receiving an object arg'
@@ -131,7 +135,7 @@ module PutsDebuggerer
131
135
  def printer=(printer)
132
136
  if printer.nil?
133
137
  if Object.const_defined?(:Rails)
134
- @printer = lambda {|output| Rails.logger.debug(output)}
138
+ @printer = PRINTER_RAILS
135
139
  else
136
140
  @printer = PRINTER_DEFAULT
137
141
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puts_debuggerer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-25 00:00:00.000000000 Z
11
+ date: 2019-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print