rbfind 1.3.2 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README +45 -0
- data/bin/rbfind +16 -10
- data/lib/rbfind.rb +15 -5
- metadata +17 -20
- checksums.yaml +0 -15
- data/Rakefile +0 -18
data/LICENSE
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|_| \_\_.__/|_| |_|_| |_|\__,_|
|
6
6
|
|
7
7
|
|
8
|
-
Copyright (c) 2008-
|
8
|
+
Copyright (c) 2008-2014, 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/README
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
= RbFind
|
2
|
+
|
3
|
+
A substitute for the Unix find tool using Ruby expressions
|
4
|
+
|
5
|
+
== Description
|
6
|
+
|
7
|
+
RbFind does the same as the standard Unix find tool but has a
|
8
|
+
different calling syntax. You may specify your search reqest as a
|
9
|
+
Ruby expression.
|
10
|
+
|
11
|
+
== Features
|
12
|
+
|
13
|
+
* ls long format style output
|
14
|
+
* Built-in grep
|
15
|
+
* Colored ls and grep output
|
16
|
+
* Automatically exclude version control system or Vim swap files
|
17
|
+
* No dependecies
|
18
|
+
|
19
|
+
== Example
|
20
|
+
|
21
|
+
Find files that were modified in the last five minutes.
|
22
|
+
|
23
|
+
$ rbfind -p 'file and age < 5.m'
|
24
|
+
|
25
|
+
Grep whole directory but skip ".git/" or ".svn/", and
|
26
|
+
".filename.swp".
|
27
|
+
|
28
|
+
$ rbfind -CWg require
|
29
|
+
|
30
|
+
Save time and do not grep large files.
|
31
|
+
|
32
|
+
$ rbfind 'filesize < 100.kB and grep /require/'
|
33
|
+
|
34
|
+
Output ls long format.
|
35
|
+
|
36
|
+
$ rbfind -P
|
37
|
+
|
38
|
+
Print MD5 digest and size for each file.
|
39
|
+
|
40
|
+
$ rbfind 'spacesep digest_md5, size.w8, path'
|
41
|
+
|
42
|
+
== Copyright
|
43
|
+
|
44
|
+
(C) 2008-2014, Bertram Scharpf <software@bertram-scharpf.de>
|
45
|
+
|
data/bin/rbfind
CHANGED
@@ -108,17 +108,17 @@ Examples:
|
|
108
108
|
$ rbfind /etc 'readable? or raise "Access denied: #{path}" ;
|
109
109
|
> lines { |l,| l["192.168."] and (puts path ; break) }'
|
110
110
|
|
111
|
-
$ rbfind 'col_sep stype+modes, size
|
112
|
-
$ rbfind 'tab_sep stype+modes, size
|
111
|
+
$ rbfind 'col_sep stype+modes, size.w10, path'
|
112
|
+
$ rbfind 'tab_sep stype+modes, size.w10, path'
|
113
113
|
$ rbfind 'spc_sep stype+modes, size.to_h, user, group, mtime.lsish, path'
|
114
114
|
$ rbfind 'spacesep stype+modes, size.to_h, user, group, mtime.lsish, path'
|
115
115
|
$ rbfind 'spacesep stype+modes, size.to_h, user, group, mtime!, path'
|
116
116
|
$ rbfind 'spacesep stype+modes, size.to_h, user, group, mtime.i, path'
|
117
117
|
$ rbfind 'spacesep mtime.u, path'
|
118
|
-
$ rbfind 'spacesep modes, user
|
118
|
+
$ rbfind 'spacesep modes, user.w8, group.w8, size.w8, cpath + carrow.to_s'
|
119
119
|
|
120
|
-
$ rbfind 'spacesep digest_md5, size
|
121
|
-
$ rbfind 'spacesep digest_sha256, size
|
120
|
+
$ rbfind 'spacesep digest_md5, size.w8, path'
|
121
|
+
$ rbfind 'spacesep digest_sha256, size.w8, path'
|
122
122
|
|
123
123
|
$ rbfind 'rename name.downcase'
|
124
124
|
$ rbfind 'ext == ".tgz" and rename without_ext+".tar.gz"'
|
@@ -191,8 +191,12 @@ class NilClass
|
|
191
191
|
def >= oth ; false ; end
|
192
192
|
def between? min, max ; false ; end
|
193
193
|
|
194
|
-
def
|
195
|
-
|
194
|
+
def method_missing sym, *args
|
195
|
+
case sym.to_s # .to_s for Ruby 1.8
|
196
|
+
when /\Aw_?(\d+)/ then " "*$1.to_i
|
197
|
+
else super
|
198
|
+
end
|
199
|
+
end
|
196
200
|
end
|
197
201
|
|
198
202
|
|
@@ -242,14 +246,16 @@ class RbFindX < RbFind
|
|
242
246
|
case sym.to_s
|
243
247
|
when /\Adigest_(.*)/, /\A([a-z]+[0-9]+)\z/ then
|
244
248
|
m = $1
|
245
|
-
|
246
|
-
|
247
|
-
(Digest.const_get c).hexdigest read
|
249
|
+
d = begin
|
250
|
+
Digest.const_get m.upcase
|
248
251
|
rescue NameError
|
249
252
|
if m =~ /sha\d\d\d/ then m = "sha2" end
|
250
253
|
require "digest/#{m}" and retry
|
251
254
|
raise
|
252
255
|
end
|
256
|
+
e = d.new
|
257
|
+
read 0x1000_0000 do |b| e.update b end
|
258
|
+
e.hexdigest
|
253
259
|
when /\A([amc]time)!\z/ then
|
254
260
|
(send $1).strftime "%Y-%m-%d %H:%M:%S %z"
|
255
261
|
else
|
data/lib/rbfind.rb
CHANGED
@@ -249,7 +249,7 @@ Sort without case sensitivity and preceding dot:
|
|
249
249
|
|
250
250
|
class RbFind
|
251
251
|
|
252
|
-
VERSION = "1.
|
252
|
+
VERSION = "1.4".freeze
|
253
253
|
|
254
254
|
class <<self
|
255
255
|
private :new
|
@@ -588,13 +588,23 @@ class RbFind
|
|
588
588
|
end
|
589
589
|
|
590
590
|
# :call-seq:
|
591
|
-
# read( n = nil)
|
591
|
+
# read( n = nil) -> str or nil
|
592
|
+
# read( n = nil) { |b| ... } -> nil
|
592
593
|
#
|
593
|
-
# Read the first
|
594
|
-
#
|
594
|
+
# Read the first +n+ bytes or return +nil+ for others than regular
|
595
|
+
# files. +nil+ reads to end of file. If a block is given, chonks of
|
596
|
+
# +n+ bytes (or all) will be yielded.
|
595
597
|
#
|
596
598
|
def read n = nil
|
597
|
-
open { |o|
|
599
|
+
open { |o|
|
600
|
+
if block_given? then
|
601
|
+
while (r = o.read n) do
|
602
|
+
yield r
|
603
|
+
end
|
604
|
+
else
|
605
|
+
o.read n
|
606
|
+
end
|
607
|
+
}
|
598
608
|
end
|
599
609
|
|
600
610
|
# :call-seq:
|
metadata
CHANGED
@@ -1,64 +1,61 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbfind
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.4'
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Bertram Scharpf
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
12
13
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
14
|
+
description: |
|
15
|
+
A replacement for the standard UNIX command find.
|
15
16
|
Files may be examined using Ruby expressions.
|
16
|
-
|
17
17
|
Full ls-style output support including color.
|
18
|
-
|
19
18
|
Full grep-style output support.
|
20
|
-
|
21
|
-
'
|
22
|
-
email: <software@bertram-scharpf.de>
|
19
|
+
email: "<software@bertram-scharpf.de>"
|
23
20
|
executables:
|
24
21
|
- rbfind
|
25
|
-
extensions:
|
26
|
-
- Rakefile
|
22
|
+
extensions: []
|
27
23
|
extra_rdoc_files:
|
28
24
|
- LICENSE
|
29
25
|
files:
|
26
|
+
- README
|
30
27
|
- lib/rbfind.rb
|
31
28
|
- lib/humansiz.rb
|
32
29
|
- LICENSE
|
33
30
|
- bin/rbfind
|
34
|
-
- Rakefile
|
35
31
|
homepage: http://www.bertram-scharpf.de/software/rbfind
|
36
32
|
licenses:
|
37
33
|
- BSD
|
38
|
-
metadata: {}
|
39
34
|
post_install_message:
|
40
35
|
rdoc_options:
|
41
|
-
- --charset
|
36
|
+
- "--charset"
|
42
37
|
- utf-8
|
43
|
-
- --main
|
38
|
+
- "--main"
|
44
39
|
- README
|
45
40
|
require_paths:
|
46
41
|
- lib
|
47
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
48
44
|
requirements:
|
49
|
-
- -
|
45
|
+
- - ">="
|
50
46
|
- !ruby/object:Gem::Version
|
51
47
|
version: '0'
|
52
48
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
53
50
|
requirements:
|
54
|
-
- -
|
51
|
+
- - ">="
|
55
52
|
- !ruby/object:Gem::Version
|
56
53
|
version: '0'
|
57
54
|
requirements:
|
58
55
|
- just Ruby
|
59
|
-
rubyforge_project:
|
60
|
-
rubygems_version:
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.8.29
|
61
58
|
signing_key:
|
62
|
-
specification_version:
|
59
|
+
specification_version: 3
|
63
60
|
summary: Ruby replacement for the standard Unix find tool
|
64
61
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
YzgxMDEyZjc3MGY1YTdkZmRmOTMyMmMzMTQwMDIzOWE1MGUwZDEyYg==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZjMyODgzN2U0NGVjNDZiYWRkOTkwZTRlODZjYTcwMjhjYWI5MjNjYw==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MDUxNjE4Y2Y5NThhZmE0ODUwOTYxMDMyYjEwYTM2NGY1NDJjZDdjYzQ4MjY5
|
10
|
-
MDdmNmNkMGY0MDU4MDAwODUyZTAyODlmNGZjMWFhNGQ3ZTQzYTRiYTQ5NmZi
|
11
|
-
Y2I3NzU4MGYyZTYwOWJjMTcyZGFlM2Y1NTdkYzIwMzc2NTc3ODI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
Yzk4YWQyMGVjMTg3YTdhOWI0ODhmZmU2YWYyYjAxNDA2YjEyOGQ2MTZlODg5
|
14
|
-
MGU4Nzk1OGQ0ZmIyM2JjMDI4NGUwZTA1M2E0YWFiNzg0ODAwZjE5ZTc2N2Yx
|
15
|
-
NGUwYThlNzg0MTgwYWIzYWFmNTM1ZDRlNmViY2UzODRiYzliZGQ=
|
data/Rakefile
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Rakefile -- build RbFind project
|
3
|
-
#
|
4
|
-
|
5
|
-
task "README" do |t|
|
6
|
-
File.open t.name, "w" do |readme|
|
7
|
-
readme.puts `ruby -I lib bin/rbfind --version`
|
8
|
-
readme.puts
|
9
|
-
readme.puts `ruby -I lib bin/rbfind --examples`
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
task :default => "README"
|
14
|
-
|
15
|
-
task :clean do |t|
|
16
|
-
sh "rm", "-fv", "README"
|
17
|
-
end
|
18
|
-
|