rbfind 1.11 → 1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbfind.rb +11 -25
- 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: 1a5b34b291fdb3dcfd8ee289b1885bbd0ff848a3f46192f0ffdd174b19d6542f
|
4
|
+
data.tar.gz: 66be0c062a8d7d00d42f5535c3aefa958676ffaacfb6f50e0d3d0f90eb9aeaa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 986974e1493ece3aac8896a8c262412bbf2e14687d6ff0f39647d4b1f7c324fbd7f263598049883b631c6bccc137cee982de52c5d170a9454c143738a7ee4a95
|
7
|
+
data.tar.gz: d477bafd992ed7387d7cc4614a55650576f0414bab2fdcfc77981cbf69ca1b9eb068252fcbe75dda520fc2b6989b040c2face8d9d1c258f1f9a728178156ac1e
|
data/lib/rbfind.rb
CHANGED
@@ -2,23 +2,12 @@
|
|
2
2
|
# rbfind.rb -- Find replacement with many features
|
3
3
|
#
|
4
4
|
|
5
|
-
# :stopdoc:
|
6
|
-
unless String.public_method_defined? :ord then
|
7
|
-
class String ; def ord ; self[0].ord ; end ; end
|
8
|
-
end
|
9
|
-
# :startdoc:
|
10
|
-
|
11
5
|
class Dir
|
12
6
|
|
13
7
|
SPECIAL_DIRS = %w(. ..)
|
14
8
|
CUR_DIR, SUPER_DIR = *SPECIAL_DIRS
|
15
9
|
|
16
|
-
|
17
|
-
# each!() { |e| ... } -> self
|
18
|
-
#
|
19
|
-
# Call block for all entries except "." and "..".
|
20
|
-
#
|
21
|
-
def each!
|
10
|
+
method_defined? :each_child or def each_child
|
22
11
|
s = SPECIAL_DIRS.dup
|
23
12
|
each { |f|
|
24
13
|
next if s.delete f
|
@@ -26,12 +15,7 @@ class Dir
|
|
26
15
|
}
|
27
16
|
end
|
28
17
|
|
29
|
-
|
30
|
-
# entries!() -> ary
|
31
|
-
#
|
32
|
-
# All entries except "." and "..".
|
33
|
-
#
|
34
|
-
method_defined? :entries! or def entries!
|
18
|
+
method_defined? :children or def children
|
35
19
|
entries - SPECIAL_DIRS
|
36
20
|
end
|
37
21
|
|
@@ -39,7 +23,8 @@ end
|
|
39
23
|
|
40
24
|
class File
|
41
25
|
class Stat
|
42
|
-
def
|
26
|
+
def identical? oth
|
27
|
+
oth = self.class.new oth unless self.class === oth
|
43
28
|
dev == oth.dev and ino == oth.ino
|
44
29
|
end
|
45
30
|
end
|
@@ -213,7 +198,7 @@ Ruby raises an ArgumentError if, for example, an ISO8859-1-encoded
|
|
213
198
|
string gets read in as UTF-8-encoded and then is matched against a
|
214
199
|
UTF-8-encoded regular expression. This will happen if you are
|
215
200
|
running RbFind from an environment with something like
|
216
|
-
|
201
|
+
LANG="de_DE.UTF-8" and if you are searching directories containing
|
217
202
|
single-byte encoded file names or files with single-byte or binary
|
218
203
|
content.
|
219
204
|
|
@@ -284,7 +269,7 @@ Sort without case sensitivity and preceding dot:
|
|
284
269
|
|
285
270
|
class RbFind
|
286
271
|
|
287
|
-
VERSION = "1.
|
272
|
+
VERSION = "1.12".freeze
|
288
273
|
|
289
274
|
class <<self
|
290
275
|
private :new
|
@@ -597,7 +582,7 @@ class RbFind
|
|
597
582
|
# +nil+ is returned.
|
598
583
|
#
|
599
584
|
def empty?
|
600
|
-
read_dir.
|
585
|
+
read_dir.each_child { |f| return false }
|
601
586
|
true
|
602
587
|
rescue Errno::ENOTDIR
|
603
588
|
end
|
@@ -619,9 +604,10 @@ class RbFind
|
|
619
604
|
# +nil+ is returned.
|
620
605
|
#
|
621
606
|
def entries
|
622
|
-
read_dir.
|
607
|
+
read_dir.children
|
623
608
|
rescue Errno::ENOTDIR
|
624
609
|
end
|
610
|
+
alias children entries
|
625
611
|
|
626
612
|
# :call-seq:
|
627
613
|
# open() { |h| ... } -> obj
|
@@ -630,7 +616,7 @@ class RbFind
|
|
630
616
|
# nothing will be done.
|
631
617
|
#
|
632
618
|
def open &block
|
633
|
-
if @ostat and
|
619
|
+
if @ostat and @ostat.identical? @path then
|
634
620
|
raise "Refusing to open output file."
|
635
621
|
end
|
636
622
|
handle_error Errno::EACCES do
|
@@ -894,7 +880,7 @@ class RbFind
|
|
894
880
|
true
|
895
881
|
end
|
896
882
|
end
|
897
|
-
dir = (read_dir or return).
|
883
|
+
dir = (read_dir or return).children
|
898
884
|
if @sort.respond_to? :call then
|
899
885
|
dir = dir.sort_by &@sort
|
900
886
|
elsif @sort and @sort.nonzero? then
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbfind
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.12'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bertram Scharpf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
A replacement for the standard UNIX command find.
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
requirements:
|
53
53
|
- just Ruby
|
54
|
-
rubygems_version: 3.0.
|
54
|
+
rubygems_version: 3.0.6
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
57
|
summary: Ruby replacement for the standard Unix find tool
|