rbfind 1.8 → 1.11
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 +5 -5
- data/LICENSE +1 -1
- data/bin/rbfind +9 -1
- data/lib/rbfind.rb +27 -7
- metadata +4 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4b687941a0ed418599c3f32451afdf5bcaba86f7df68286396409f48446ca740
|
|
4
|
+
data.tar.gz: e513a7092e68bae9f88fa83c8be96dcd58b52ef7baf425a7fa49814858e1888a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1eafac28ac55651614b926b83fa129087891ca43a14ec1c3217f522799d0e722a8b7381257a04355f1dd497cb62f63823f577fe3a01d878848cd0c834e751a03
|
|
7
|
+
data.tar.gz: 0a87bc6a2be21912f2015e5b7f540c6b941df33224ac30f9be33783f2d6108092b862137403b360c4f9816d11e2086b03ae757528871029d3a50221cb45f1e7c
|
data/LICENSE
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|_| \_\_.__/|_| |_|_| |_|\__,_|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
Copyright (c) 2008-
|
|
8
|
+
Copyright (c) 2008-2019, Bertram Scharpf <software@bertram-scharpf.de>.
|
|
9
9
|
All rights reserved.
|
|
10
10
|
|
|
11
11
|
Redistribution and use in source and binary forms, with or without
|
data/bin/rbfind
CHANGED
|
@@ -47,6 +47,7 @@ OPTIONS = [
|
|
|
47
47
|
[ %w(--demand -D), :lst, "skip all filenames but these"],
|
|
48
48
|
[ %w(--ext -e), :lst, "skip all filename extensions but these"],
|
|
49
49
|
[ %w(--visible -I), nil, "skip all hidden (starting with .dot)"],
|
|
50
|
+
[ %w(--nodirs -N), nil, "skip directories"],
|
|
50
51
|
[ %w(--begin -B), :blk, "eval block before begin"],
|
|
51
52
|
[ %w(--end -E), :blk, "eval block after end"],
|
|
52
53
|
[ %w(--file -f), :blk, "read block expression from file"],
|
|
@@ -264,6 +265,10 @@ class RbFindApp < RbFind
|
|
|
264
265
|
end
|
|
265
266
|
end
|
|
266
267
|
|
|
268
|
+
def hide_instance_eval
|
|
269
|
+
instance_eval yield
|
|
270
|
+
end
|
|
271
|
+
|
|
267
272
|
end
|
|
268
273
|
|
|
269
274
|
|
|
@@ -309,6 +314,7 @@ begin
|
|
|
309
314
|
when '--demand' then @demand = arg
|
|
310
315
|
when '--ext' then @ext = arg
|
|
311
316
|
when '--visible' then @visible = true
|
|
317
|
+
when '--nodirs' then @nodirs = true
|
|
312
318
|
when '--begin' then @blkbegin = arg
|
|
313
319
|
when '--end' then @blkend = arg
|
|
314
320
|
when '--file' then @block = File.read arg
|
|
@@ -433,6 +439,8 @@ error_handle do
|
|
|
433
439
|
|
|
434
440
|
@visible and @block.insert 0, "visible? or prune ; "
|
|
435
441
|
|
|
442
|
+
@nodirs and @block.insert 0, "next if dir? ; "
|
|
443
|
+
|
|
436
444
|
@vcs and @block.insert 0, "no_vcs ; "
|
|
437
445
|
@vim and @block.insert 0, "vimswap? and next ; "
|
|
438
446
|
|
|
@@ -484,7 +492,7 @@ end
|
|
|
484
492
|
EOT
|
|
485
493
|
|
|
486
494
|
eval @blkbegin if @blkbegin
|
|
487
|
-
RbFindApp.open args, @params do |f| f.
|
|
495
|
+
RbFindApp.open args, @params do |f| f.hide_instance_eval { @block } end
|
|
488
496
|
eval @blkend if @blkend
|
|
489
497
|
end
|
|
490
498
|
|
data/lib/rbfind.rb
CHANGED
|
@@ -37,6 +37,13 @@ class Dir
|
|
|
37
37
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
class File
|
|
41
|
+
class Stat
|
|
42
|
+
def same? oth
|
|
43
|
+
dev == oth.dev and ino == oth.ino
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
40
47
|
|
|
41
48
|
|
|
42
49
|
=begin rdoc
|
|
@@ -210,7 +217,7 @@ LC_ALL="de_DE.UTF-8" and if you are searching directories containing
|
|
|
210
217
|
single-byte encoded file names or files with single-byte or binary
|
|
211
218
|
content.
|
|
212
219
|
|
|
213
|
-
The #grep facility will
|
|
220
|
+
The #grep facility will condone encoding mismatches by calling
|
|
214
221
|
the String#scrub! method. But neither the #lines and #read function
|
|
215
222
|
will do any transformation nor will the file names and the path
|
|
216
223
|
specifications be changed.
|
|
@@ -277,7 +284,7 @@ Sort without case sensitivity and preceding dot:
|
|
|
277
284
|
|
|
278
285
|
class RbFind
|
|
279
286
|
|
|
280
|
-
VERSION = "1.
|
|
287
|
+
VERSION = "1.11".freeze
|
|
281
288
|
|
|
282
289
|
class <<self
|
|
283
290
|
private :new
|
|
@@ -320,6 +327,9 @@ class RbFind
|
|
|
320
327
|
end
|
|
321
328
|
@do_level = method dl||:do_level
|
|
322
329
|
|
|
330
|
+
@ostat = $stdout.stat
|
|
331
|
+
@ostat = nil unless @ostat.file?
|
|
332
|
+
|
|
323
333
|
@start, @count = Time.now, count
|
|
324
334
|
@wd = Dir.getwd
|
|
325
335
|
if path then
|
|
@@ -620,6 +630,9 @@ class RbFind
|
|
|
620
630
|
# nothing will be done.
|
|
621
631
|
#
|
|
622
632
|
def open &block
|
|
633
|
+
if @ostat and (s = File.stat @path).same? @ostat then
|
|
634
|
+
raise "Refusing to open output file."
|
|
635
|
+
end
|
|
623
636
|
handle_error Errno::EACCES do
|
|
624
637
|
File.open @path, &block if file?
|
|
625
638
|
end
|
|
@@ -636,8 +649,12 @@ class RbFind
|
|
|
636
649
|
def read n = nil
|
|
637
650
|
open { |o|
|
|
638
651
|
if block_given? then
|
|
639
|
-
|
|
640
|
-
|
|
652
|
+
if n then
|
|
653
|
+
while (r = o.read n) do
|
|
654
|
+
yield r
|
|
655
|
+
end
|
|
656
|
+
else
|
|
657
|
+
yield o.read
|
|
641
658
|
end
|
|
642
659
|
else
|
|
643
660
|
o.read n
|
|
@@ -652,15 +669,16 @@ class RbFind
|
|
|
652
669
|
#
|
|
653
670
|
def lines
|
|
654
671
|
block_given? or return lines do end
|
|
672
|
+
r = false
|
|
655
673
|
open { |file|
|
|
656
674
|
n = 0
|
|
657
675
|
file.each_line { |l|
|
|
658
676
|
l.chomp!
|
|
659
677
|
n += 1
|
|
660
678
|
set_predefs l, n
|
|
661
|
-
yield l, n
|
|
679
|
+
r ||= true if yield l, n
|
|
662
680
|
}
|
|
663
|
-
|
|
681
|
+
r
|
|
664
682
|
}
|
|
665
683
|
end
|
|
666
684
|
|
|
@@ -677,6 +695,7 @@ class RbFind
|
|
|
677
695
|
l = "#$`\e[#{color}m#$&\e[m#$'"
|
|
678
696
|
end
|
|
679
697
|
colsep @path, i, l
|
|
698
|
+
true
|
|
680
699
|
}
|
|
681
700
|
end
|
|
682
701
|
|
|
@@ -757,6 +776,7 @@ class RbFind
|
|
|
757
776
|
alias spc_sep spcsep
|
|
758
777
|
alias space_sep spc_sep
|
|
759
778
|
alias spacesep spcsep
|
|
779
|
+
alias p spcsep
|
|
760
780
|
|
|
761
781
|
def csv sep, *args
|
|
762
782
|
e = args.join sep
|
|
@@ -921,7 +941,7 @@ class RbFind
|
|
|
921
941
|
when 010 then
|
|
922
942
|
col_type or \
|
|
923
943
|
if (m & 0111).nonzero? then
|
|
924
|
-
if
|
|
944
|
+
if (m & 04000).nonzero? then 9
|
|
925
945
|
elsif (m & 02000).nonzero? then 10
|
|
926
946
|
else 6
|
|
927
947
|
end
|
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.11'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bertram Scharpf
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-06-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
A replacement for the standard UNIX command find.
|
|
@@ -29,7 +29,7 @@ files:
|
|
|
29
29
|
- lib/rbfind.rb
|
|
30
30
|
homepage: http://www.bertram-scharpf.de/software/rbfind
|
|
31
31
|
licenses:
|
|
32
|
-
- BSD
|
|
32
|
+
- BSD-2-Clause
|
|
33
33
|
metadata: {}
|
|
34
34
|
post_install_message:
|
|
35
35
|
rdoc_options:
|
|
@@ -51,8 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
51
51
|
version: '0'
|
|
52
52
|
requirements:
|
|
53
53
|
- just Ruby
|
|
54
|
-
|
|
55
|
-
rubygems_version: 2.6.4
|
|
54
|
+
rubygems_version: 3.0.3
|
|
56
55
|
signing_key:
|
|
57
56
|
specification_version: 4
|
|
58
57
|
summary: Ruby replacement for the standard Unix find tool
|