rbbt-util 5.37.15 → 5.37.16
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/lib/rbbt/resource/path.rb +5 -1
- data/lib/rbbt/util/simpleopt/setup.rb +5 -0
- data/lib/rbbt/util/ssh.rb +25 -0
- data/lib/rbbt/workflow/step/accessor.rb +10 -1
- data/lib/rbbt/workflow/usage.rb +2 -2
- data/share/rbbt_commands/resource/find +43 -12
- data/share/rbbt_commands/resource/glob +90 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 565fc431e80f7167a95a8ad2c3499207c1422dacfe7ce1cd4cd2c1a4f0bad5c4
|
4
|
+
data.tar.gz: 34b393012cd4d58bcb9917cb2c45f8e0f23cefca73139647454b6affcb80cf57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 854c7a84a92a654a987f5d1274dabd6d7564108d8a200eeb377321aa02361264d979f42f8e91350be2ed0074bd0f153b6dd66d7ea5f4597edca5b68edf2d8c0a
|
7
|
+
data.tar.gz: 34c765a22fed51dfaf873a0abcd0338f2a9ab15ed09bca0ac445075261ea040002e042312e62951c951bfc48d08162175cf697f9890e5b1a0c3ac58f2b0a03d0
|
data/lib/rbbt/resource/path.rb
CHANGED
@@ -71,7 +71,7 @@ module Path
|
|
71
71
|
|
72
72
|
def glob(pattern = '*')
|
73
73
|
if self.include? "*"
|
74
|
-
self.glob_all
|
74
|
+
self.glob_all pattern
|
75
75
|
else
|
76
76
|
return [] unless self.exists?
|
77
77
|
found = self.find
|
@@ -165,6 +165,10 @@ module Path
|
|
165
165
|
return self
|
166
166
|
end
|
167
167
|
|
168
|
+
if where == :all || where == 'all'
|
169
|
+
return find_all(caller_lib, paths)
|
170
|
+
end
|
171
|
+
|
168
172
|
@path ||= {}
|
169
173
|
rsearch_paths = (resource and resource.respond_to?(:search_paths)) ? resource.search_paths : nil
|
170
174
|
key = [where, caller_lib, rsearch_paths, paths].inspect
|
@@ -3,6 +3,10 @@ require 'rbbt/util/simpleopt/get'
|
|
3
3
|
require 'rbbt/util/simpleopt/doc'
|
4
4
|
module SOPT
|
5
5
|
|
6
|
+
class << self
|
7
|
+
attr_accessor :original_argv
|
8
|
+
end
|
9
|
+
|
6
10
|
def self.setup(str)
|
7
11
|
parts = str.split(/\n\n+/)
|
8
12
|
|
@@ -24,6 +28,7 @@ module SOPT
|
|
24
28
|
SOPT.description = description.strip if description
|
25
29
|
SOPT.parse options if options
|
26
30
|
|
31
|
+
SOPT.original_argv = ARGV.dup
|
27
32
|
SOPT.consume
|
28
33
|
end
|
29
34
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module RbbtSSH
|
2
|
+
|
3
|
+
def self.ssh(server, argv = nil, options = {})
|
4
|
+
server = server.sub(%r(^ssh:(//)?), '')
|
5
|
+
|
6
|
+
argv = [] if argv.nil?
|
7
|
+
argv = [argv] unless Array === argv
|
8
|
+
|
9
|
+
options = Misc.add_defaults options, :add_option_dashes => true
|
10
|
+
|
11
|
+
cmd_sections = [server]
|
12
|
+
cmd_sections << argv * " "
|
13
|
+
cmd_sections << CMD.process_cmd_options(options)
|
14
|
+
|
15
|
+
cmd = cmd_sections.compact * " "
|
16
|
+
|
17
|
+
CMD.cmd(:ssh, cmd, :pipe => true)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.command(server, command, argv = [], options = nil)
|
21
|
+
ssh(server, [command] + argv, options)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
@@ -56,7 +56,16 @@ class Step
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def self.info_file(path)
|
59
|
-
|
59
|
+
return nil if path.nil?
|
60
|
+
info_file = path + '.info'
|
61
|
+
return info_file if Open.exist?(info_file)
|
62
|
+
|
63
|
+
if path.end_with?('.gz')
|
64
|
+
info_file_nogz = path.sub(/\.gz$/,'') + '.info'
|
65
|
+
return info_file_nogz if Open.exists?(info_file_nogz)
|
66
|
+
end
|
67
|
+
|
68
|
+
info_file
|
60
69
|
end
|
61
70
|
|
62
71
|
def self.tmp_path(path)
|
data/lib/rbbt/workflow/usage.rb
CHANGED
@@ -201,7 +201,7 @@ module Workflow
|
|
201
201
|
description = description.split("\n\n").first
|
202
202
|
|
203
203
|
next if abridge && ! final.include?(name)
|
204
|
-
puts Misc.format_definition_list_item(name.to_s, description, Log.
|
204
|
+
puts Misc.format_definition_list_item(name.to_s, description, Log.tty_size || 80, 20, :yellow)
|
205
205
|
|
206
206
|
prov_string = prov_string(dep_tree(name))
|
207
207
|
puts Misc.format_paragraph Log.color(:blue, "-> " + prov_string) if prov_string && ! prov_string.empty?
|
@@ -253,7 +253,7 @@ module Workflow
|
|
253
253
|
puts Misc.format_definition_list_item(input, head, 1000, -1, :blue).gsub(/\n\s*\n/,"\n")
|
254
254
|
puts '...' if lines.length > 6
|
255
255
|
else
|
256
|
-
puts Misc.format_definition_list_item(input, file.read, Log.
|
256
|
+
puts Misc.format_definition_list_item(input, file.read, Log.tty_size, 20, :blue)
|
257
257
|
end
|
258
258
|
end
|
259
259
|
puts
|
@@ -1,20 +1,39 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rbbt-util'
|
4
|
+
require 'rbbt/util/simpleopt'
|
4
5
|
require 'rbbt/resource'
|
5
6
|
require 'rbbt/workflow'
|
7
|
+
require 'rbbt/util/ssh'
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
$0 = "rbbt #{$previous_commands*" "} #{ File.basename(__FILE__) }" if $previous_commands
|
10
|
+
|
11
|
+
options = SOPT.setup <<EOF
|
12
|
+
|
13
|
+
Find files
|
14
|
+
|
15
|
+
$ #{$0} [<options>] (<resource> <path>|<path>)
|
12
16
|
|
17
|
+
-h--help Print this help
|
18
|
+
-r--requires* Files to require; 'all' for all in Rbbt.etc.requires
|
19
|
+
-lw--load_workflow* Files to require; 'all' for all in Rbbt.etc.requires
|
20
|
+
-w--where* Where to look for the path
|
21
|
+
|
22
|
+
EOF
|
13
23
|
if options[:help]
|
14
|
-
|
15
|
-
|
24
|
+
if defined? rbbt_usage
|
25
|
+
rbbt_usage
|
26
|
+
else
|
27
|
+
puts SOPT.doc
|
28
|
+
end
|
29
|
+
exit 0
|
16
30
|
end
|
17
31
|
|
32
|
+
resource, path = ARGV
|
33
|
+
path, resource = resource, nil
|
34
|
+
|
35
|
+
raise MissingParameterException.new(:path) if path.nil?
|
36
|
+
|
18
37
|
case options[:workflows]
|
19
38
|
when nil, false, "false", "none"
|
20
39
|
when "all"
|
@@ -39,18 +58,30 @@ else
|
|
39
58
|
end
|
40
59
|
end
|
41
60
|
|
42
|
-
|
61
|
+
location = nil
|
62
|
+
where = options[:where]
|
63
|
+
all = options[:all]
|
43
64
|
|
44
65
|
begin
|
45
|
-
resource =
|
66
|
+
resource = Workflow.require_workflow resource
|
46
67
|
rescue
|
47
68
|
begin
|
48
|
-
resource =
|
69
|
+
resource = Kernel.const_get(resource)
|
49
70
|
rescue
|
50
71
|
raise "Resource not found: #{ resource }"
|
51
72
|
end
|
52
|
-
end
|
73
|
+
end if resource
|
53
74
|
|
75
|
+
path = (resource || Rbbt)[path]
|
54
76
|
|
55
|
-
|
77
|
+
if where.nil? || where == 'all' || path.search_paths.include?(where.to_sym)
|
78
|
+
location = path.find(where)
|
56
79
|
|
80
|
+
if Array === location
|
81
|
+
puts location * "\n"
|
82
|
+
else
|
83
|
+
puts location
|
84
|
+
end
|
85
|
+
else
|
86
|
+
puts RbbtSSH.command(where, $0, ARGV, options.merge("where" => :all)).read
|
87
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbbt-util'
|
4
|
+
require 'rbbt/util/simpleopt'
|
5
|
+
require 'rbbt/resource'
|
6
|
+
require 'rbbt/workflow'
|
7
|
+
require 'rbbt/util/ssh'
|
8
|
+
|
9
|
+
$0 = "rbbt #{$previous_commands*" "} #{ File.basename(__FILE__) }" if $previous_commands
|
10
|
+
|
11
|
+
options = SOPT.setup <<EOF
|
12
|
+
|
13
|
+
Find files in directories
|
14
|
+
|
15
|
+
$ #{$0} [<options>] (<resource> <path>|<path>)
|
16
|
+
|
17
|
+
-h--help Print this help
|
18
|
+
-r--requires* Files to require; 'all' for all in Rbbt.etc.requires
|
19
|
+
-lw--load_workflow* Files to require; 'all' for all in Rbbt.etc.requires
|
20
|
+
-w--where* Where to look for the path
|
21
|
+
|
22
|
+
EOF
|
23
|
+
if options[:help]
|
24
|
+
if defined? rbbt_usage
|
25
|
+
rbbt_usage
|
26
|
+
else
|
27
|
+
puts SOPT.doc
|
28
|
+
end
|
29
|
+
exit 0
|
30
|
+
end
|
31
|
+
|
32
|
+
resource, path = ARGV
|
33
|
+
path, resource = resource, nil
|
34
|
+
|
35
|
+
raise MissingParameterException.new(:path) if path.nil?
|
36
|
+
|
37
|
+
case options[:workflows]
|
38
|
+
when nil, false, "false", "none"
|
39
|
+
when "all"
|
40
|
+
Rbbt.etc.workflows.list.each do |workflow|
|
41
|
+
Workflow.require_workflow file
|
42
|
+
end if Rbbt.etc.workflows.exists?
|
43
|
+
else
|
44
|
+
options[:workflows].split(/[ ,;|]/).each do |workflow|
|
45
|
+
Workflow.require_workflow workflow
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
case options[:requires]
|
50
|
+
when nil, false, "false", "none"
|
51
|
+
when "all"
|
52
|
+
Rbbt.etc.requires.list.each do |file|
|
53
|
+
require file
|
54
|
+
end if Rbbt.etc.requires.exists?
|
55
|
+
else
|
56
|
+
options[:requires].split(/[ ,;|]/).each do |file|
|
57
|
+
require file
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
location = nil
|
62
|
+
where = options[:where]
|
63
|
+
all = options[:all]
|
64
|
+
|
65
|
+
begin
|
66
|
+
resource = Workflow.require_workflow resource
|
67
|
+
rescue
|
68
|
+
begin
|
69
|
+
resource = Kernel.const_get(resource)
|
70
|
+
rescue
|
71
|
+
raise "Resource not found: #{ resource }"
|
72
|
+
end
|
73
|
+
end if resource
|
74
|
+
|
75
|
+
path = (resource || Rbbt)[path]
|
76
|
+
|
77
|
+
if where.nil? || where == 'all' || path.search_paths.include?(where.to_sym)
|
78
|
+
location = case where
|
79
|
+
when 'all'
|
80
|
+
path.glob_all("*")
|
81
|
+
when nil
|
82
|
+
path.glob_all
|
83
|
+
else
|
84
|
+
path.glob(where)
|
85
|
+
end
|
86
|
+
|
87
|
+
puts location * "\n"
|
88
|
+
else
|
89
|
+
puts RbbtSSH.command(where, $0, ARGV, options.merge("where" => :all)).read
|
90
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.37.
|
4
|
+
version: 5.37.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -310,6 +310,7 @@ files:
|
|
310
310
|
- lib/rbbt/util/simpleopt/get.rb
|
311
311
|
- lib/rbbt/util/simpleopt/parse.rb
|
312
312
|
- lib/rbbt/util/simpleopt/setup.rb
|
313
|
+
- lib/rbbt/util/ssh.rb
|
313
314
|
- lib/rbbt/util/tar.rb
|
314
315
|
- lib/rbbt/util/task/job.rb
|
315
316
|
- lib/rbbt/util/tc_cache.rb
|
@@ -392,6 +393,7 @@ files:
|
|
392
393
|
- share/rbbt_commands/resource/exists
|
393
394
|
- share/rbbt_commands/resource/find
|
394
395
|
- share/rbbt_commands/resource/get
|
396
|
+
- share/rbbt_commands/resource/glob
|
395
397
|
- share/rbbt_commands/resource/produce
|
396
398
|
- share/rbbt_commands/resource/read
|
397
399
|
- share/rbbt_commands/rsync
|