Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump nokogiri from 1.13.1 to 1.14.3 #19

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ GEM
little-plugger (~> 1.1)
multi_json (~> 1.14)
mime-types (2.99.3)
mini_portile2 (2.7.1)
mini_portile2 (2.8.1)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
nokogiri (1.13.1)
mini_portile2 (~> 2.7.0)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
oauth2 (1.4.7)
faraday (>= 0.8, < 2.0)
Expand All @@ -62,7 +62,7 @@ GEM
tty-color (~> 0.5)
psych (4.0.3)
stringio
racc (1.6.0)
racc (1.6.2)
rack (2.2.3)
rake (13.0.6)
rake-tui (0.2.3)
Expand Down
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

(credit to Aaron Patterson for partial inspiration: https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html)

If you like Awesome Print (or Amazing Print), you will love Puts Debuggerer (which builds upon them)!

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.

In day-to-day test-driven development and simple app 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. Still, there are a number of problems with puts debugging, like difficulty in locating puts statements in a large output log, knowing which methods and line numbers were invoked, identifying which variables were printed, and seeing the content of structured hashes and arrays in an understandable format.
Expand All @@ -20,7 +22,7 @@ Basic Example:
```ruby
# /Users/User/trivia_app.rb # line 1
require 'pd' # line 2
bug_or_band = 'beattle' # line 3
bug_or_band = 'beatles' # line 3
pd bug_or_band # line 4
```

Expand All @@ -29,7 +31,7 @@ Output:
```bash
[PD] /Users/User/trivia_app.rb:4
> pd bug_or_band # line 4
=> "beattle"
=> "beatles"
```

## Background
Expand Down Expand Up @@ -320,7 +322,7 @@ There are many more options and features in [puts_debuggerer](https://rubygems.o

This is the recommended way for installing in [Rails](rubyonrails.org) apps in addition to configuring the [`app_path` option](#putsdebuggererapp_path).

Add the following to bundler's `Gemfile`.
Add the following to bundler's `Gemfile` (in Rails, you can optionally limit to the `:development` and `:test` groups).

```ruby
gem 'puts_debuggerer', '~> 0.13.5'
Expand All @@ -334,6 +336,16 @@ bundle

Optionally, you may configure the [Rails](rubyonrails.org) initializer `config/initializers/puts_debuggerer_options.rb` with further customizations as per the [Options](#options) section below.

Also, you may want to add the following to the initializer too if you limited the `puts_debuggerer` gem to the `:development` and `:test` groups:

```ruby
unless Rails.env.development? || Rails.env.test?
def pd(*args, &block) # `pd(...)` in Ruby 2.7+
# No Op (just a stub in case developers forget troubleshooting pd calls in the code and deploy to production)
end
end
```

### Option 2: Manual

Or manually install and require library.
Expand Down Expand Up @@ -364,7 +376,7 @@ Still, if you do not need it, you may disable by setting `PutsDebuggerer.print_e
PutsDebuggerer.print_engine = :puts
```

If you also avoid requiring 'awesome_print', PutsDebuggerer won't require it either if it sees that you have a different `print_engine`
If you also avoid requiring 'awesome_print', PutsDebuggerer will NOT require it either if it sees that you have a different `print_engine`. In fact, you may switch to another print engine if you prefer like [amazing_print](https://github.com/amazing-print/amazing_print) as [explained here](https://github.com/AndyObtiva/puts_debuggerer#putsdebuggererprint_engine).

You may also avoid requiring in Bundler `Gemfile` with `require: false`:

Expand All @@ -381,7 +393,7 @@ Example:

```ruby
# /Users/User/finance_calculator_app/pd_test.rb # line 1
bug = 'beattle' # line 2
bug = 'beatles' # line 2
pd "Show me the source of the bug: #{bug}" # line 3
pd "Show me the result of the calculation: #{(12.0/3.0)}" # line 4
```
Expand All @@ -391,7 +403,7 @@ Output:
```bash
[PD] /Users/User/finance_calculator_app/pd_test.rb:3
> pd "Show me the source of the bug: #{bug}"
=> "Show me the source of the bug: beattle"
=> "Show me the source of the bug: beatles"
[PD] /Users/User/finance_calculator_app/pd_test.rb:4
> pd "Show me the result of the calculation: #{(12.0/3.0)}"
=> "Show me the result of the calculation: 4.0"
Expand Down Expand Up @@ -505,7 +517,7 @@ Example:
```ruby
# /Users/User/finance_calculator_app/pd_test.rb # line 1
PutsDebuggerer.app_path = File.join('/Users', 'User', 'finance_calculator_app') # line 2
bug = 'beattle' # line 3
bug = 'beatles' # line 3
pd "Show me the source of the bug: #{bug}" # line 4
```

Expand All @@ -514,7 +526,7 @@ Example Printout:
```bash
[PD] /pd_test.rb:4
> pd "Show me the source of the bug: #{bug}"
=> "Show me the source of the bug: beattle"
=> "Show me the source of the bug: beatles"
```

#### `PutsDebuggerer.header`
Expand Down
7 changes: 7 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ Here are tasks considered for future versions. Once done, they are moved to the

## Next

- Fix issue with attempting to modify a frozen hash when passed as value for `pd` command (check if frozen)
- Automatically print class and method name as part of the file name and line number printout
- Automatically print `self`
- Support displaying the date/time of the pd printout via an option (local and global)
- Consider supporting `header: :method` to print the Class#method name as the header (consider supporting in footer/wrapper too)
- Consider adding performance profiling to pd methods automatically, with some customization options too
- Fix issue with no printing code in bigger rails apps filled with other gems (perhaps there is some conflict?)
- Support passing options directly without an object (e.g. pd caller: true)
- When using last arg as hash for options, leave out options that are not puts_debuggerer-specific for printing out
- Add the ability to disable all pd statement with a switch for convenience when going back and forth with printing/not-printing (e.g. troubleshooting while testing performance)
- Consider supporting `lines` and `line_count` as aliases for the `source_line_count` option
- Have `caller` printing in Glimmer DSL for Opal print one statement per line
- Support header: 30 to customize the length of the header (and do the same for footer and wrapper)
- Support header: '#' to customize the character of the header (and do the same for footer and wrapper)
Expand All @@ -32,3 +38,4 @@ Here are tasks considered for future versions. Once done, they are moved to the
- Consider the idea of customizing print stream (e.g. stderr instead of stdout). Currently possible through setting `printer`
- Highlight the pd being printed if multiple pds exist in the same line (perhaps by calling .red on its string reusing that from ap)
- Have pd support running from JAR files in JRuby
- Fix issue with using SimpleDelegator, which seems to break puts_debuggerer output for the class that inherits from it