puts_debuggerer 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +71 -26
  3. data/VERSION +1 -0
  4. data/lib/puts_debuggerer.rb +1 -0
  5. metadata +48 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0b6b423e48750ec42b8ba75d9d11b9bee413f968
4
- data.tar.gz: 436e88ff0bae84786ae496c93e9051c6a7e038f2
2
+ SHA256:
3
+ metadata.gz: 8b80118305f3b8201241cb75a16fab616e1db9789daf829c5b4ea68ad7a6d94d
4
+ data.tar.gz: dd345085a3bcbf718cdb49983b3c2d1838b1914b231e6fc033ff30ea992fac32
5
5
  SHA512:
6
- metadata.gz: 8d1fd6d211ef47039e03d2fcf0dd4e093bf68d28bae54fb3285a72fc7cb179889eefd2e4340eaecea7c630c8ec7b671a2d9b26ffbd01fc2acaccbed99e90fb17
7
- data.tar.gz: 627007999c72fd0c33d7ea60aa6703f68b56ea55c3698e0cca578e41f961aaac5f01dd924a0fd3e9fac9a97364b416d82534e4cedc6855fa2f4720e988cf78ae
6
+ metadata.gz: 1ac9056936792d4f8c46e4ae4114b0911a6442ef5b6ee5a6a1aebd6e405c3abc37466d207f19e94c6eaf9bd58374cd30ab2f66581777b9e37b2f572953c9261a
7
+ data.tar.gz: 7e0bbb0fcb9c502a252227b74a68a91d39f8ecbbf5cf85a18c4f561dae0a71baa5d258680835c573d2c5f6555e142f1b911f6a3c94302022cbd3a3ac4caeda01
data/README.md CHANGED
@@ -3,21 +3,35 @@
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)
5
5
 
6
- Yes, many of us avoid debuggers like the plague and clamp on to our puts
7
- statements like an umbrella in a stormy day.
8
- Why not make it official and have puts debugging become its own perfectly
9
- legitimate thing?!!
6
+ Debuggers are great! They help us troubleshoot complicated programming problems by inspecting values produced by code, line by line. They are invaluable when trying to understand what is going on in a large application composed of thousands or millions of lines of code.
10
7
 
11
- Enter puts_debuggerer. A guilt-free puts debugging Ruby gem FTW!
8
+ In day-to-day test-driven development and simple debugging though, a puts statement can be a lot quicker in revealing what is going on than halting execution completely just to inspect a single value or a few. This is certainly true when writing the simplest possible code that could possibly work, and running a test every few seconds or minutes. Problem is you need to locate puts statements in large output logs, know which methods were invoked, find out what variable names are being printed, and see nicely formatted output. Enter puts_debuggerer. A guilt-free puts debugging Ruby gem FTW that prints file names, line numbers, code statements, and formats output nicely courtesy of awesome_print.
12
9
 
13
- For background, please read this blog post by Aaron Patterson:
14
- https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html
10
+ Basic Example:
11
+
12
+ ```ruby
13
+ # /Users/User/trivia_app.rb # line 1
14
+ require 'puts_debuggerer' # line 2
15
+ bug_or_band = 'beattle' # line 3
16
+ pd bug_or_band # line 4
17
+ ```
18
+
19
+ Output:
20
+
21
+ ```bash
22
+ [PD] trivia_app.rb:4
23
+ > pd bug_or_band # line 4
24
+ => "beattle"
25
+ ```
15
26
 
16
27
  ## Background
17
28
 
18
- It can be quite frustrating to lose puts statements in a large output or log file. One way to help find them is add a header (e.g. `puts "The Order Total"`) or an announcer (e.g. `puts '*'*80`) before every puts statement, leading to repetitive wasteful effort.
29
+ For initial background, please read this blog post by Aaron Patterson (part of the inspiration for this gem):
30
+ https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html
31
+
32
+ It can be quite frustrating to lose puts statements in a large output or log file. One way to help find them is add a header (e.g. `puts "The Order Total"`) or an announcer (e.g. `puts '*'*80`) before every puts statement. Unfortunately, that leads to repetitive wasteful effort that adds up quickly over many work sessions and interrupts thinking flow while solving problems.
19
33
 
20
- puts_debuggerer automates that work via the short and simple `pd` command, automatically printing meaningful headers for output.
34
+ puts_debuggerer automates that work via the short and simple `pd` command, automatically printing meaningful headers for output and accelerating problem solving work due to ease of typing.
21
35
 
22
36
  Example without pd:
23
37
 
@@ -44,7 +58,29 @@ Which gets lost in a logging stream such as:
44
58
  (0.2ms) COMMIT
45
59
  ```
46
60
 
47
- Example with pd:
61
+ Problem can be mitigated by adding a few more puts statements:
62
+
63
+ ```ruby
64
+ puts "*"*40
65
+ puts "order_total"
66
+ puts order_total
67
+ ```
68
+
69
+ But those add up pretty quickly when inspecting multiple variables:
70
+
71
+ ```ruby
72
+ puts "*"*40
73
+ puts "order_total"
74
+ puts order_total
75
+ puts "*"*40
76
+ puts "order_summary"
77
+ puts order_summary
78
+ puts "*"*40
79
+ puts "order_details"
80
+ puts order_details
81
+ ```
82
+
83
+ Here is a simple example using `pd` instead:
48
84
 
49
85
  ```ruby
50
86
  pd order_total
@@ -77,7 +113,15 @@ This is not only easy to locate in a logging stream such as the one below, but a
77
113
  (0.2ms) COMMIT
78
114
  ```
79
115
 
80
- And it is easy to search for using the `[PD]` announcer.
116
+ And it is easy to search for using the `[PD]` announcer (customizable).
117
+
118
+ When inspecting multiple variables, debugging code is still a snap:
119
+
120
+ ```ruby
121
+ pd order_total
122
+ pd order_summary
123
+ pd order_details
124
+ ```
81
125
 
82
126
  ## Instructions
83
127
 
@@ -86,7 +130,7 @@ And it is easy to search for using the `[PD]` announcer.
86
130
  Add the following to bundler's `Gemfile`.
87
131
 
88
132
  ```ruby
89
- gem 'puts_debuggerer', '~> 0.8.1'
133
+ gem 'puts_debuggerer', '~> 0.8.2'
90
134
  ```
91
135
 
92
136
  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.
@@ -96,13 +140,24 @@ This is the recommended way for [Rails](rubyonrails.org) apps. Optionally, you m
96
140
  Or manually install and require library.
97
141
 
98
142
  ```bash
99
- gem install puts_debuggerer -v0.8.1
143
+ gem install puts_debuggerer -v0.8.2
100
144
  ```
101
145
 
102
146
  ```ruby
103
147
  require 'puts_debuggerer'
104
148
  ```
105
149
 
150
+ ### Awesome Print
151
+
152
+ puts_debuggerer comes with [awesome_print](https://github.com/awesome-print/awesome_print).
153
+
154
+ You may disable when needed by not requiring in Ruby or by adding an explicit reference to awesome_print with `require: false` in bundler:
155
+
156
+ ```ruby
157
+ gem "awesome_print", require: false
158
+ gem "puts_debugger"
159
+ ```
160
+
106
161
  ### Usage
107
162
 
108
163
  First, add `pd` method anywhere in your code to display details about an object or expression (if you're used to awesome_print, you're in luck! puts_debuggerer includes awesome_print as the default print engine for output).
@@ -509,20 +564,9 @@ And:
509
564
  `PutsDebuggerer.reset_run_at_numbers`
510
565
  for piecemeal usage.
511
566
 
512
- ### Bonus
513
-
514
- puts_debuggerer comes with a number of bonus goodies.
515
-
516
- It comes with [awesome_print](https://github.com/awesome-print/awesome_print).
517
-
518
- You may disable by not requiring in Ruby or by adding an explicit reference to awesome_print with `require: false` in bundler:
519
-
520
- ```ruby
521
- gem "awesome_print", require: false
522
- gem "puts_debugger"
523
- ```
567
+ ### Bonus API
524
568
 
525
- Additionally, puts_debuggerer comes with the following bonus utility methods:
569
+ puts_debuggerer comes with the following bonus API methods:
526
570
 
527
571
  #### `__caller_line_number__(caller_depth=0)`
528
572
 
@@ -566,6 +610,7 @@ Prints out `puts __caller_source_line__`
566
610
 
567
611
  ## Release Notes
568
612
 
613
+ * v0.8.2: require 'stringio' for projects that don't require automatically via other gems
569
614
  * v0.8.1: `printer` option support for Rails test environment
570
615
  * v0.8.0: `printer` option support
571
616
  * v0.7.1: default print engine to :ap (AwesomePrint)
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.8.2
@@ -1,5 +1,6 @@
1
1
  require 'ripper'
2
2
  require 'awesome_print'
3
+ require 'stringio'
3
4
 
4
5
  module PutsDebuggerer
5
6
  HEADER_DEFAULT = '*'*80
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.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-30 00:00:00.000000000 Z
11
+ date: 2020-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -67,71 +67,93 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.12'
69
69
  - !ruby/object:Gem::Dependency
70
- name: bundler
70
+ name: jeweler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.0'
75
+ version: 2.3.9
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.0'
82
+ version: 2.3.9
83
83
  - !ruby/object:Gem::Dependency
84
- name: jeweler
84
+ name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 2.3.0
89
+ version: 2.1.4
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 2.3.0
96
+ version: 2.1.4
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: coveralls
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 0.8.5
103
+ version: 0.8.23
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 0.8.5
110
+ version: 0.8.23
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.10.0
117
+ version: 0.16.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.16.1
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov-lcov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.7.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.7.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: undercover
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.3.4
118
146
  type: :development
119
147
  prerelease: false
120
148
  version_requirements: !ruby/object:Gem::Requirement
121
149
  requirements:
122
150
  - - "~>"
123
151
  - !ruby/object:Gem::Version
124
- version: 0.10.0
152
+ version: 0.3.4
125
153
  description: |
126
- Yes, many of us avoid debuggers like the plague and clamp on to our puts statements like an umbrella in a stormy day. Why not make it official and have puts debugging become its own perfectly legitimate thing?!!
127
-
128
- Enter puts_debuggerer. A guilt-free puts debugger Ruby gem FTW!
129
-
130
- In other words, puts_debuggerer is a Ruby library for improved puts debugging, automatically displaying bonus useful information such as source line number and source code.
131
-
132
- Partially inspired (only partially ;) by this blog post:
133
- https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html
134
- (Credit to Tenderlove.)
154
+ Debuggers are great! They help us troubleshoot complicated programming problems by inspecting values produced by code, line by line. They are invaluable when trying to understand what is going on in a large application composed of thousands or millions of lines of code.
155
+ In day-to-day test-driven development and simple debugging though, a puts statement can be a lot quicker in revealing what is going on than halting execution completely just to inspect a single value or a few. This is certainly true when writing the simplest possible code that could possibly work, and running a test every few seconds or minutes. Problem is you need to locate puts statements in large output logs, know which methods were invoked, find out what variable names are being printed, and see nicely formatted output. Enter puts_debuggerer. A guilt-free puts debugging Ruby gem FTW that prints file names, line numbers, code statements, and formats output nicely courtesy of awesome_print.
156
+ Partially inspired by this blog post: https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html (Credit to Tenderlove.)
135
157
  email: andy.am@gmail.com
136
158
  executables: []
137
159
  extensions: []
@@ -141,12 +163,13 @@ extra_rdoc_files:
141
163
  files:
142
164
  - LICENSE.txt
143
165
  - README.md
166
+ - VERSION
144
167
  - lib/puts_debuggerer.rb
145
168
  homepage: http://github.com/AndyObtiva/puts_debuggerer
146
169
  licenses:
147
170
  - MIT
148
171
  metadata: {}
149
- post_install_message:
172
+ post_install_message:
150
173
  rdoc_options: []
151
174
  require_paths:
152
175
  - lib
@@ -161,9 +184,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
184
  - !ruby/object:Gem::Version
162
185
  version: '0'
163
186
  requirements: []
164
- rubyforge_project:
165
- rubygems_version: 2.6.10
166
- signing_key:
187
+ rubygems_version: 3.1.2
188
+ signing_key:
167
189
  specification_version: 4
168
190
  summary: Ruby library for improved puts debugging, automatically displaying bonus
169
191
  useful information such as source line number and source code.