rbbt-util 5.32.24 → 5.32.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rbbt_find.rb +74 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4709cccef1b9d9d46e4b8888f336b65e6059b41f2289a891bcc58795e949d155
|
4
|
+
data.tar.gz: 373e0ec6458f1d6cfdbfbe6aadb9e585ee1c347f2395480ba950beca3b3ad38f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 276e9b6ab9988cb3e53ed44ee166e81f72da3f9eb119ed8269ea47bbe9cddc3bbebff5faa44b16d2d67c8f3ae575217e081c9aa8e740579c27ab4c6cfae2644d
|
7
|
+
data.tar.gz: e3c977b86918ed7c8efdf75d6aa6468cd078bbaf4d3acbb18202a6b2325bca8de4b901973c27a111558d83de7bfab7a0bfaa8f919b26301bb3532ba76636b6aa
|
data/bin/rbbt_find.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbbt-util'
|
4
|
+
require 'rbbt/util/simpleopt'
|
5
|
+
|
6
|
+
$0 = "rbbt #{$previous_commands*" "} #{ File.basename(__FILE__) }" if $previous_commands
|
7
|
+
|
8
|
+
options = SOPT.setup <<EOF
|
9
|
+
|
10
|
+
Find a path
|
11
|
+
|
12
|
+
$ #{$0} [options] [<subpath>] <path>
|
13
|
+
|
14
|
+
Use - to read from STDIN
|
15
|
+
|
16
|
+
-h--help Print this help
|
17
|
+
-w--workflows Workflow to load
|
18
|
+
-s--search_path* Workflow to load
|
19
|
+
-l--list List contents of resolved directories
|
20
|
+
-n--nocolor Don't color output
|
21
|
+
EOF
|
22
|
+
if options[:help]
|
23
|
+
if defined? rbbt_usage
|
24
|
+
rbbt_usage
|
25
|
+
else
|
26
|
+
puts SOPT.doc
|
27
|
+
end
|
28
|
+
exit 0
|
29
|
+
end
|
30
|
+
|
31
|
+
subpath, path = ARGV
|
32
|
+
path, subpath = subpath, nil if path.nil?
|
33
|
+
|
34
|
+
begin
|
35
|
+
require 'rbbt/workflow'
|
36
|
+
workflow = Workflow.require_workflow subpath
|
37
|
+
subpath = workflow.libdir
|
38
|
+
rescue
|
39
|
+
Log.exception $!
|
40
|
+
end if subpath && subpath =~ /^[A-Z][a-zA-Z]+$/
|
41
|
+
|
42
|
+
path = subpath ? Path.setup(subpath)[path] : Path.setup(path)
|
43
|
+
|
44
|
+
search_path = options[:search_path].to_sym if options.include? :search_path
|
45
|
+
nocolor = options[:nocolor]
|
46
|
+
|
47
|
+
found = if search_path
|
48
|
+
[path.find(search_path)]
|
49
|
+
else
|
50
|
+
path.find_all
|
51
|
+
end
|
52
|
+
|
53
|
+
found.each do |path|
|
54
|
+
if options[:list] && File.directory?(path)
|
55
|
+
puts Log.color :blue, path
|
56
|
+
path.glob("*").each do |subpath|
|
57
|
+
if nocolor
|
58
|
+
puts subpath
|
59
|
+
else
|
60
|
+
color = File.directory?(subpath) ? :blue : nil
|
61
|
+
puts " " << Log.color(color, subpath)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
else
|
65
|
+
if nocolor
|
66
|
+
puts path
|
67
|
+
else
|
68
|
+
color = File.exists?(path) ? (File.directory?(path) ? :blue : nil) : :red
|
69
|
+
puts Log.color color, path
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.32.
|
4
|
+
version: 5.32.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
@@ -172,6 +172,7 @@ executables:
|
|
172
172
|
- rbbt_Rutil.rb
|
173
173
|
- rbbt
|
174
174
|
- rbbt_dangling_locks.rb
|
175
|
+
- rbbt_find.rb
|
175
176
|
extensions: []
|
176
177
|
extra_rdoc_files:
|
177
178
|
- LICENSE
|
@@ -183,6 +184,7 @@ files:
|
|
183
184
|
- bin/rbbt_Rutil.rb
|
184
185
|
- bin/rbbt_dangling_locks.rb
|
185
186
|
- bin/rbbt_exec.rb
|
187
|
+
- bin/rbbt_find.rb
|
186
188
|
- bin/rbbt_query.rb
|
187
189
|
- etc/app.d/base.rb
|
188
190
|
- etc/app.d/entities.rb
|