rbbt-util 5.26.149 → 5.26.150

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbbt/util/misc/system.rb +13 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9288b508316c4ba26d477e254e59adf2c30b3ccaa1ff21bd66517c5a5a4bbc18
4
- data.tar.gz: ee3cd1659a7541fc506a818080d39a08d49c5bc08691bc00d6a118138a7d0bee
3
+ metadata.gz: ad40e6919c3e8e77360dbfae0ea25c736c6144989517232d958f1438c8f80097
4
+ data.tar.gz: 825d7c86c2ae9acf7d47341cc9871a9e999e9591cdcdbfc6270e197be156ebae
5
5
  SHA512:
6
- metadata.gz: 7148561f867bd9f3bec6e35d1c23ab0060896dd6166a272fdc450b9bdfc2e0a3961f8f088da3669bf101001ef500325e1b9b2c18c4064b5721596cdadcb0cc97
7
- data.tar.gz: 443d66df9200fe9c68ba267a7fcea48652b3127c50c4183e75ce71797087fc7ef179ce0384637ed4ac48aeee4a90bc0447832dd8c57927d7d22e5fb1e8582b72
6
+ metadata.gz: 34951a010cac42122a179959356a0e8f164489de0de3f04888754826563c156a384af687d7c8119b4ea228a0429db5d7cc1757f60c8ee81117b5ad161d0fc01d
7
+ data.tar.gz: 7a5ca9c1f0bf6cc2684aecd6a44eb2fe4f777b6c16de2069a01eed8196525e5ec40a521ad9a6b026dba9fd5c44bb63ffc789051eab14d88bd78bc32046565ccf
@@ -85,6 +85,19 @@ end
85
85
  return false
86
86
  end
87
87
 
88
+
89
+ def self.relative_link(source, target_dir)
90
+ path = "."
91
+ current = target_dir
92
+ while ! Misc.common_path current, source
93
+ current = File.dirname(current)
94
+ path = File.join(path, '..')
95
+ return nil if current == "/"
96
+ end
97
+
98
+ File.join(path, Misc.path_relative_to(current, source))
99
+ end
100
+
88
101
  # WARN: probably not thread safe...
89
102
  def self.in_dir(dir)
90
103
  old_pwd = FileUtils.pwd
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.26.149
4
+ version: 5.26.150
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-13 00:00:00.000000000 Z
11
+ date: 2020-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake