punchy_pp 0.0.0
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.
- checksums.yaml +7 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Guardfile +42 -0
- data/LICENSE.txt +21 -0
- data/README.md +34 -0
- data/Rakefile +10 -0
- data/image.png +0 -0
- data/lib/punchy_pp.rb +105 -0
- data/sig/punchy_pp.rbs +4 -0
- metadata +57 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 808209467a2fcb9c60e695e881084e699769337e805954690c40c776146a86e5
|
|
4
|
+
data.tar.gz: d06ca534f20422316534dfcecc2e7b1f6ce51e60d3469a6b52b81ea02dcf427d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ffbe103d697878d16637a587297aa81ea3c6a80a0989589b2b8f0ac80d007be75b441e8e5ca33892e9ff1f70290057061167577befb01ef8700a378fc53439a8
|
|
7
|
+
data.tar.gz: f552143fae9f666bb1f70f011f09ccea4d6d0e5733cbdf4216ed08e50d4a54343e01cd363ae0e4dc3a7a76ca3a9d6975bf6f905653c0110c98a6265bec63fc0f
|
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
+
|
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
22
|
+
advances of any kind
|
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
+
* Public or private harassment
|
|
25
|
+
* Publishing others' private information, such as a physical or email
|
|
26
|
+
address, without their explicit permission
|
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
28
|
+
professional setting
|
|
29
|
+
|
|
30
|
+
## Enforcement Responsibilities
|
|
31
|
+
|
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
33
|
+
|
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
35
|
+
|
|
36
|
+
## Scope
|
|
37
|
+
|
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
39
|
+
|
|
40
|
+
## Enforcement
|
|
41
|
+
|
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at F-3r@users.noreply.github.com. All complaints will be reviewed and investigated promptly and fairly.
|
|
43
|
+
|
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
45
|
+
|
|
46
|
+
## Enforcement Guidelines
|
|
47
|
+
|
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
49
|
+
|
|
50
|
+
### 1. Correction
|
|
51
|
+
|
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
53
|
+
|
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
55
|
+
|
|
56
|
+
### 2. Warning
|
|
57
|
+
|
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
59
|
+
|
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
61
|
+
|
|
62
|
+
### 3. Temporary Ban
|
|
63
|
+
|
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
65
|
+
|
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
67
|
+
|
|
68
|
+
### 4. Permanent Ban
|
|
69
|
+
|
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
71
|
+
|
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
73
|
+
|
|
74
|
+
## Attribution
|
|
75
|
+
|
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
78
|
+
|
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
|
80
|
+
|
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
|
82
|
+
|
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Guardfile
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# A sample Guardfile
|
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
|
3
|
+
|
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
|
5
|
+
# directories %w(app lib config test spec features) \
|
|
6
|
+
# .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
|
7
|
+
|
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
|
11
|
+
#
|
|
12
|
+
# $ mkdir config
|
|
13
|
+
# $ mv Guardfile config/
|
|
14
|
+
# $ ln -s config/Guardfile .
|
|
15
|
+
#
|
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
|
17
|
+
|
|
18
|
+
guard :minitest do
|
|
19
|
+
# with Minitest::Unit
|
|
20
|
+
watch(%r{^test/(.*)/?test_(.*)\.rb$})
|
|
21
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
|
22
|
+
watch(%r{^test/test_helper\.rb$}) { "test" }
|
|
23
|
+
|
|
24
|
+
# with Minitest::Spec
|
|
25
|
+
# watch(%r{^spec/(.*)_spec\.rb$})
|
|
26
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
|
27
|
+
# watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
|
|
28
|
+
|
|
29
|
+
# Rails 4
|
|
30
|
+
# watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
|
31
|
+
# watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' }
|
|
32
|
+
# watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
|
|
33
|
+
# watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
|
|
34
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
|
|
35
|
+
# watch(%r{^test/.+_test\.rb$})
|
|
36
|
+
# watch(%r{^test/test_helper\.rb$}) { 'test' }
|
|
37
|
+
|
|
38
|
+
# Rails < 4
|
|
39
|
+
# watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
|
|
40
|
+
# watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" }
|
|
41
|
+
# watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
|
|
42
|
+
end
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Fernando Martínez
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Punchy PP
|
|
2
|
+
|
|
3
|
+
_A "whistle key finder" for you *puts*_
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## WAT?
|
|
7
|
+
|
|
8
|
+
* Are you a [puts debuguerer](https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer/)?
|
|
9
|
+
* You tired of playing 'Where's Waldo' with your `puts`?
|
|
10
|
+
* Sick of losing and forgeting where the heck you've _put_ them?
|
|
11
|
+
* Or perhaps diying of boredom while scrolling through and endless river of uninteresting logs?
|
|
12
|
+
|
|
13
|
+
If any of these is a **YES**, then, my dear friend, here I've got some well-deserved **punchy** for your puts'es
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
`bundle add punchy_pp` or `gem install punchy_pp` and then include punchy_pp's printer method `#ppp` in the top-level object, like so:
|
|
18
|
+
|
|
19
|
+
> Note: `#ppp` stands for `Punchy Pretty Print`, or `Power pp` or _something_ pee pee :thinking:
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
require "punchy_pp"
|
|
23
|
+
include PunchyPP::Methods
|
|
24
|
+
|
|
25
|
+
ppp "conspicuous"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
And you'll get something like:
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
## Development, Contributing, License, CoC, etc, etc, etc
|
|
33
|
+
|
|
34
|
+
MIT, Contributor Covenant Code of Conduct, etc, all the standard stuff Bundler happily made for me :grinning: Just reach out with an issue or PR
|
data/Rakefile
ADDED
data/image.png
ADDED
|
Binary file
|
data/lib/punchy_pp.rb
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pp"
|
|
4
|
+
|
|
5
|
+
module PunchyPP
|
|
6
|
+
VERSION = "0.0.0"
|
|
7
|
+
|
|
8
|
+
LINE_CONTINUATIION = "\e[94m···\e[0m "
|
|
9
|
+
PATTERNS = {
|
|
10
|
+
white: "\e[30m\e[107m%s\e[0m",
|
|
11
|
+
green: "\e[30m\e[102m%s\e[0m",
|
|
12
|
+
magenta: "\e[97m\e[105m%s\e[0m",
|
|
13
|
+
yellow: "\e[30m\e[103m%s\e[0m",
|
|
14
|
+
blue: "\e[97m\e[104m%s\e[0m",
|
|
15
|
+
purple: "\e[97m\e[45m%s\e[0m",
|
|
16
|
+
cyan: "\e[30m\e[106m%s\e[0m",
|
|
17
|
+
red: "\e[97m\e[101m%s\e[0m"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
PATTERNS.each do |color, pattern|
|
|
21
|
+
define_method color do |text|
|
|
22
|
+
pattern % text
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
COLOR_CYCLE = PATTERNS.keys.cycle
|
|
27
|
+
|
|
28
|
+
def cycle_color
|
|
29
|
+
@current_color = config[:color] || COLOR_CYCLE.next
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def color
|
|
33
|
+
@current_color || cycle_color
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def config
|
|
37
|
+
@config ||= {out: $stdout}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def config=(options)
|
|
41
|
+
@config = options
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def paint(text)
|
|
45
|
+
send PunchyPP.color, text
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def border(text = nil)
|
|
49
|
+
paint " #{text.to_s.ljust(100)}"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def line(text = nil)
|
|
53
|
+
paint(" ") << " %s" % text.to_s
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def wrap_text(text, width = 80)
|
|
57
|
+
return text if text.size <= width
|
|
58
|
+
|
|
59
|
+
lines = []
|
|
60
|
+
current_line = ""
|
|
61
|
+
|
|
62
|
+
text.split(/\s/).each do |word|
|
|
63
|
+
if (current_line.size + word.size + 1) > width
|
|
64
|
+
lines << current_line
|
|
65
|
+
current_line = word
|
|
66
|
+
else
|
|
67
|
+
current_line += (current_line.empty? ? "" : " ") + word
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
lines << current_line unless current_line.empty?
|
|
71
|
+
|
|
72
|
+
lines[1..-1].each { |it| it.prepend LINE_CONTINUATIION } # standard:disable Style/SlicingWithRange
|
|
73
|
+
lines
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def out(text)
|
|
77
|
+
PunchyPP.config[:out].puts text
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def interesting_caller(callers)
|
|
81
|
+
callers.reject { |it| it.match __FILE__ }
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def puts(*objects)
|
|
85
|
+
PunchyPP.cycle_color
|
|
86
|
+
|
|
87
|
+
title = caller(1..1).first.to_s
|
|
88
|
+
lines = objects
|
|
89
|
+
.map { |it| it.pretty_inspect }
|
|
90
|
+
.flat_map { |it| wrap_text it }
|
|
91
|
+
|
|
92
|
+
out border(title)
|
|
93
|
+
out line
|
|
94
|
+
out lines.map { |it| line it }
|
|
95
|
+
out line
|
|
96
|
+
out border " "
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
extend self
|
|
100
|
+
module Methods
|
|
101
|
+
def ppp(*objects)
|
|
102
|
+
PunchyPP.puts(*objects)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
data/sig/punchy_pp.rbs
ADDED
metadata
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: punchy_pp
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Fernando Martínez
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2024-08-15 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Are you a puts debuguerer too? Tired of playing 'Where's Waldo' with
|
|
14
|
+
your `puts`? Sick of losing and forgeting where the heck you've _put_ them in your
|
|
15
|
+
code? or diying of boredom while scrolling through and endless pit of uneventful
|
|
16
|
+
logs? If any of those is yes, then, my dear friend, I've got you some PunchyPP!
|
|
17
|
+
email:
|
|
18
|
+
- F-3r@users.noreply.github.com
|
|
19
|
+
executables: []
|
|
20
|
+
extensions: []
|
|
21
|
+
extra_rdoc_files: []
|
|
22
|
+
files:
|
|
23
|
+
- ".standard.yml"
|
|
24
|
+
- CHANGELOG.md
|
|
25
|
+
- CODE_OF_CONDUCT.md
|
|
26
|
+
- Guardfile
|
|
27
|
+
- LICENSE.txt
|
|
28
|
+
- README.md
|
|
29
|
+
- Rakefile
|
|
30
|
+
- image.png
|
|
31
|
+
- lib/punchy_pp.rb
|
|
32
|
+
- sig/punchy_pp.rbs
|
|
33
|
+
homepage: https://github.com/sinaptia/punchy_pp
|
|
34
|
+
licenses:
|
|
35
|
+
- MIT
|
|
36
|
+
metadata:
|
|
37
|
+
homepage_uri: https://github.com/sinaptia/punchy_pp
|
|
38
|
+
post_install_message:
|
|
39
|
+
rdoc_options: []
|
|
40
|
+
require_paths:
|
|
41
|
+
- lib
|
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 2.5.0
|
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
|
+
requirements:
|
|
49
|
+
- - ">="
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '0'
|
|
52
|
+
requirements: []
|
|
53
|
+
rubygems_version: 3.5.3
|
|
54
|
+
signing_key:
|
|
55
|
+
specification_version: 4
|
|
56
|
+
summary: The puts debugguerer's indispensable companion
|
|
57
|
+
test_files: []
|