grepfruit 4.0.0 → 4.0.1
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +10 -8
- data/lib/grepfruit/cli_decorator.rb +8 -1
- data/lib/grepfruit/cli_search.rb +12 -1
- data/lib/grepfruit/search.rb +5 -1
- data/lib/grepfruit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d27a11eff0190c85e32b6081219b6db2b3f79e92170f85443e7e422df011bd5e
|
|
4
|
+
data.tar.gz: 7d1ab993aa73df36b9cfd1653721757d0e6f0473413562900231da351f9dbc89
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a8f66005b0f1ddc8a75747fa4c24b16e6401332fad5061b57220f766eba2a64691a46f9686c349dce4f7b7b42b308e5e7141da58177b338a5104386573f5322e
|
|
7
|
+
data.tar.gz: 8ed7dc08c649a3becacc813a9e6f7bfbb0722c14a5b63cf3749e9a00cf2333fa75b8990ac2656d82c47dea5422bcb06e48ebc00eb413aca362fdb6d6e91b754a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -219,24 +219,26 @@ Grepfruit returns meaningful exit codes for CI/CD integration:
|
|
|
219
219
|
## Getting Help and Contributing
|
|
220
220
|
|
|
221
221
|
### Getting Help
|
|
222
|
+
|
|
222
223
|
Have a question or need assistance? Open a discussion in the [discussions section](https://github.com/enjaku4/grepfruit/discussions) for:
|
|
224
|
+
|
|
223
225
|
- Usage questions
|
|
224
226
|
- Implementation guidance
|
|
225
|
-
-
|
|
227
|
+
- Open-ended ideas or suggestions
|
|
228
|
+
|
|
229
|
+
### Issues
|
|
230
|
+
|
|
231
|
+
[Issues](https://github.com/enjaku4/grepfruit/issues) track bugs, planned features, and other work. When reporting a bug, please include:
|
|
226
232
|
|
|
227
|
-
### Reporting Issues
|
|
228
|
-
Found a bug? Please [create an issue](https://github.com/enjaku4/grepfruit/issues) with:
|
|
229
233
|
- A clear description of the problem
|
|
230
234
|
- Steps to reproduce the issue
|
|
231
235
|
- Your environment details (Ruby version, OS, etc.)
|
|
232
236
|
|
|
233
237
|
### Contributing Code
|
|
234
|
-
Ready to contribute? You can:
|
|
235
|
-
- Fix bugs by submitting pull requests
|
|
236
|
-
- Improve documentation
|
|
237
|
-
- Add new features (please discuss first in the [discussions section](https://github.com/enjaku4/grepfruit/discussions))
|
|
238
238
|
|
|
239
|
-
|
|
239
|
+
Any open issue is free to pick up or discuss. Check the [project board](https://github.com/users/enjaku4/projects/12) or [issues tab](https://github.com/enjaku4/grepfruit/issues).
|
|
240
|
+
|
|
241
|
+
Before contributing, please read the [contributing guidelines](https://github.com/enjaku4/grepfruit/blob/master/CONTRIBUTING.md).
|
|
240
242
|
|
|
241
243
|
## License
|
|
242
244
|
|
|
@@ -11,11 +11,18 @@ module Grepfruit
|
|
|
11
11
|
def red(text) = colorize(text, :red)
|
|
12
12
|
def cyan(text) = colorize(text, :cyan)
|
|
13
13
|
|
|
14
|
+
def print_file_progress_dot(has_matches)
|
|
15
|
+
print(has_matches ? red(".") : green("."))
|
|
16
|
+
end
|
|
17
|
+
|
|
14
18
|
def number_of_files(num) = "#{num} file#{'s' if num != 1}"
|
|
15
19
|
def number_of_matches(num) = "#{num} match#{'es' if num != 1}"
|
|
16
20
|
|
|
17
21
|
def display_results(results)
|
|
18
|
-
|
|
22
|
+
if results.total_files.positive?
|
|
23
|
+
puts
|
|
24
|
+
puts
|
|
25
|
+
end
|
|
19
26
|
|
|
20
27
|
if results.match_count.zero?
|
|
21
28
|
puts "#{number_of_files(results.total_files)} checked, #{green('no matches found')}"
|
data/lib/grepfruit/cli_search.rb
CHANGED
|
@@ -7,7 +7,10 @@ module Grepfruit
|
|
|
7
7
|
def execute
|
|
8
8
|
puts "Error: Path '#{path}' does not exist." and exit 1 unless File.exist?(path)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
unless json
|
|
11
|
+
puts "Searching for #{regex.inspect} in #{path.inspect}..."
|
|
12
|
+
puts
|
|
13
|
+
end
|
|
11
14
|
|
|
12
15
|
results = execute_search
|
|
13
16
|
|
|
@@ -19,5 +22,13 @@ module Grepfruit
|
|
|
19
22
|
|
|
20
23
|
exit(results.match_count.positive? ? 1 : 0)
|
|
21
24
|
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def emit_file_progress(has_matches)
|
|
29
|
+
return if json
|
|
30
|
+
|
|
31
|
+
print_file_progress_dot(has_matches)
|
|
32
|
+
end
|
|
22
33
|
end
|
|
23
34
|
end
|
data/lib/grepfruit/search.rb
CHANGED
|
@@ -65,7 +65,9 @@ module Grepfruit
|
|
|
65
65
|
ready_worker, worker_result = RactorCompat.select_ready(active_workers)
|
|
66
66
|
port = active_workers.delete(ready_worker)
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
has_matches = process_worker_result(worker_result, results)
|
|
69
|
+
results.increment_files_with_matches if has_matches
|
|
70
|
+
emit_file_progress(has_matches)
|
|
69
71
|
assign_file_to_worker(ready_worker, port, file_enumerator, active_workers, results)
|
|
70
72
|
end
|
|
71
73
|
|
|
@@ -85,6 +87,8 @@ module Grepfruit
|
|
|
85
87
|
true
|
|
86
88
|
end
|
|
87
89
|
|
|
90
|
+
def emit_file_progress(_has_matches); end
|
|
91
|
+
|
|
88
92
|
def create_persistent_worker
|
|
89
93
|
RactorCompat.create_worker do |port|
|
|
90
94
|
loop do
|
data/lib/grepfruit/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: grepfruit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0.
|
|
4
|
+
version: 4.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- enjaku4
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-07-05 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: dry-cli
|