rbbt-util 5.37.6 → 5.37.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/resource.rb +5 -1
- data/lib/rbbt/util/migrate.rb +11 -4
- data/lib/rbbt/util/named_array.rb +0 -1
- data/share/color/color_names +0 -1
- data/test/rbbt/test_resource.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5c4e63f52c80871ada12e77c2c2cfe0d2cacb9d4bb3cf13fde88f814d30987b
|
4
|
+
data.tar.gz: e3859c1668e92be90edf4ca5637480e8d74aa26822c0f3181f8d9a1689e6dc0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f15f9954cf3f4ad93859d98155c6b34af5beeba3286367732a71c2e9093d97477ec405d300eded639e93470bf8b8f466014e79eaaddedb621c0df2862ac0e01
|
7
|
+
data.tar.gz: 80f82e5ca9262aad1ce8300de0a486234017c6a3a450ae9579bbbeeca1062dac4ab42d3c31276d5546d882a3efa32520658efec18847099c0ae5f8ee93daab7b
|
data/lib/rbbt/resource.rb
CHANGED
@@ -351,6 +351,7 @@ url='#{url}'
|
|
351
351
|
|
352
352
|
def identify(path)
|
353
353
|
path = File.expand_path(path)
|
354
|
+
path += "/" if File.directory?(path)
|
354
355
|
resource ||= Rbbt
|
355
356
|
locations = (Path::STANDARD_SEARCH + resource.search_order + resource.search_paths.keys)
|
356
357
|
locations -= [:current, "current"]
|
@@ -363,7 +364,10 @@ url='#{url}'
|
|
363
364
|
|
364
365
|
pattern = pattern.sub('{PWD}', Dir.pwd)
|
365
366
|
if String === pattern and pattern.include?('{')
|
366
|
-
regexp = "^" + pattern
|
367
|
+
regexp = "^" + pattern
|
368
|
+
.gsub(/{(TOPLEVEL)}/,'(?<\1>[^/]+)')
|
369
|
+
.gsub(/{([^}]+)}/,'(?<\1>[^/]+)?') +
|
370
|
+
"(?:/(?<REST>.*))?/?$"
|
367
371
|
if m = path.match(regexp)
|
368
372
|
if ! m.named_captures.include?("PKGDIR") || m["PKGDIR"] == resource.pkgdir
|
369
373
|
return self[m["TOPLEVEL"]][m["SUBPATH"]][m["REST"]]
|
data/lib/rbbt/util/migrate.rb
CHANGED
@@ -17,13 +17,20 @@ puts path.glob_all.collect{|p| File.directory?(p) ? p + "/" : p } * "\n"
|
|
17
17
|
|
18
18
|
[path, paths.collect{|p| [source, p] * ":"}, lpath]
|
19
19
|
else
|
20
|
+
original_path = Path.setup(path)
|
20
21
|
if File.exist?(path)
|
21
22
|
path = resource.identify(path)
|
22
23
|
else
|
23
24
|
path = Path.setup(path)
|
24
25
|
end
|
25
26
|
|
26
|
-
|
27
|
+
if original_path.located?
|
28
|
+
paths = [original_path]
|
29
|
+
else
|
30
|
+
paths = (path.directory? ? path.glob_all : path.find_all)
|
31
|
+
end
|
32
|
+
|
33
|
+
[path, paths, path]
|
27
34
|
end
|
28
35
|
end
|
29
36
|
|
@@ -54,9 +61,9 @@ puts resource[path].find(search_path)
|
|
54
61
|
|
55
62
|
real_paths.each do |source_path|
|
56
63
|
Log.medium "Migrating #{source_path} #{options[:files].length} files to #{target} - #{Misc.fingerprint(options[:files])}}" if options[:files]
|
57
|
-
if File.directory?(source_path) || source_path
|
58
|
-
source_path += "/" unless source_path
|
59
|
-
target += "/" unless target
|
64
|
+
if File.directory?(source_path) || source_path.ends_with?("/")
|
65
|
+
source_path += "/" unless source_path.end_with? '/'
|
66
|
+
target += "/" unless target.end_with? '/'
|
60
67
|
end
|
61
68
|
|
62
69
|
next if source_path == target
|
data/share/color/color_names
CHANGED
data/test/rbbt/test_resource.rb
CHANGED
@@ -94,8 +94,12 @@ class TestTSV < Test::Unit::TestCase
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def test_identify
|
97
|
+
assert_equal 'etc/', Rbbt.identify(File.join(ENV["HOME"], '.rbbt/etc/'))
|
98
|
+
assert_equal 'share/databases/', Rbbt.identify('/usr/local/share/rbbt/databases/')
|
99
|
+
assert_equal 'share/databases/DATABASE', Rbbt.identify('/usr/local/share/rbbt/databases/DATABASE')
|
97
100
|
assert_equal 'share/databases/DATABASE/FILE', Rbbt.identify('/usr/local/share/rbbt/databases/DATABASE/FILE')
|
98
101
|
assert_equal 'share/databases/DATABASE/FILE', Rbbt.identify(File.join(ENV["HOME"], '.rbbt/share/databases/DATABASE/FILE'))
|
102
|
+
assert_equal 'share/databases/DATABASE/FILE', Rbbt.identify('/usr/local/share/rbbt/databases/DATABASE/FILE')
|
99
103
|
end
|
100
104
|
|
101
105
|
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.8
|
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-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|