grepfruit 4.0.1 → 4.0.2
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 +6 -0
- data/exe/grepfruit +2 -0
- data/lib/grepfruit/cli_search.rb +4 -1
- data/lib/grepfruit/search.rb +11 -9
- data/lib/grepfruit/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a1e692e9c73cb5e153c74e9f9dad30665f77eae2c1d12335b9cda68eb19cc27e
|
|
4
|
+
data.tar.gz: be22dc571889bcd9e59378e8896949dfd792d966e2bb01d65ad3c4fec70329a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb52ee14db47e883bedbfe53ab17aea9b032b87f6749910a6af441cda3fe9b413ba9e11d5baa8d6ff8b3f8271b76da61d45f4ea9db6aa67a4714124bea9c96dd
|
|
7
|
+
data.tar.gz: 64052138a5df15c7e3ad5f9f6e2227d60016e9cfa6539e2a7b09c5166af8924d07eb03943af522fb2daa63baafb3fe5120aad0f315161c07ba7f93e0b02e63d1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## v4.0.2
|
|
2
|
+
|
|
3
|
+
- Fixed searches silently checking no files when the search path itself was hidden or matched an exclusion
|
|
4
|
+
- Fixed a crash backtrace being printed after the error message when the search path does not exist
|
|
5
|
+
- Fixed the whole search crashing when a file is deleted or becomes unreadable mid-search
|
|
6
|
+
|
|
1
7
|
## v4.0.1
|
|
2
8
|
|
|
3
9
|
- Restored accidentally removed CLI progress indicator
|
data/exe/grepfruit
CHANGED
data/lib/grepfruit/cli_search.rb
CHANGED
|
@@ -5,7 +5,10 @@ module Grepfruit
|
|
|
5
5
|
include Grepfruit::CliDecorator
|
|
6
6
|
|
|
7
7
|
def execute
|
|
8
|
-
|
|
8
|
+
unless File.exist?(path)
|
|
9
|
+
puts "Error: Path '#{path}' does not exist."
|
|
10
|
+
exit 1
|
|
11
|
+
end
|
|
9
12
|
|
|
10
13
|
unless json
|
|
11
14
|
puts "Searching for #{regex.inspect} in #{path.inspect}..."
|
data/lib/grepfruit/search.rb
CHANGED
|
@@ -2,8 +2,6 @@ require "find"
|
|
|
2
2
|
require "etc"
|
|
3
3
|
require_relative "ractor_compat"
|
|
4
4
|
|
|
5
|
-
Warning[:experimental] = false
|
|
6
|
-
|
|
7
5
|
module Grepfruit
|
|
8
6
|
class Search
|
|
9
7
|
attr_reader :path, :regex, :exclusions, :inclusions, :excluded_paths, :excluded_lines, :truncate, :search_hidden, :jobs, :json, :count
|
|
@@ -98,14 +96,18 @@ module Grepfruit
|
|
|
98
96
|
file_path, pattern, exc_lines, count = work
|
|
99
97
|
file_results, has_matches, match_count = [], false, 0
|
|
100
98
|
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
begin
|
|
100
|
+
File.foreach(file_path).with_index do |line, line_num|
|
|
101
|
+
next unless line.valid_encoding? && line.match?(pattern)
|
|
103
102
|
|
|
104
|
-
|
|
103
|
+
next if exc_lines.any? { "#{file_path}:#{line_num + 1}".end_with?(_1) }
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
file_results << [file_path, line_num + 1, line] unless count
|
|
106
|
+
has_matches = true
|
|
107
|
+
match_count += 1
|
|
108
|
+
end
|
|
109
|
+
rescue Errno::ENOENT, Errno::EACCES, Errno::EISDIR
|
|
110
|
+
file_results, has_matches, match_count = [], false, 0
|
|
109
111
|
end
|
|
110
112
|
|
|
111
113
|
RactorCompat.yield_result(port, [file_results, has_matches, match_count])
|
|
@@ -137,7 +139,7 @@ module Grepfruit
|
|
|
137
139
|
Find.find(path) do |file_path|
|
|
138
140
|
is_file = File.file?(file_path)
|
|
139
141
|
|
|
140
|
-
Find.prune if excluded_path?(is_file, file_path, file_path.delete_prefix("#{path}/"))
|
|
142
|
+
Find.prune if file_path != path && excluded_path?(is_file, file_path, file_path.delete_prefix("#{path}/"))
|
|
141
143
|
|
|
142
144
|
next unless is_file && File.readable?(file_path)
|
|
143
145
|
|
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.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- enjaku4
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-07-
|
|
10
|
+
date: 2026-07-19 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: dry-cli
|
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
75
|
version: '0'
|
|
76
76
|
requirements: []
|
|
77
|
-
rubygems_version: 4.0.
|
|
77
|
+
rubygems_version: 4.0.3
|
|
78
78
|
specification_version: 4
|
|
79
79
|
summary: Tool for searching regex patterns in files
|
|
80
80
|
test_files: []
|