build-files 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 227e24df878d95517873d1f07ecc789cff1320ad76090f1da90b3273f46c901e
4
- data.tar.gz: f086ae85dcabc453cb5ee6155af0d6357db47d828eb0b7733461ecd2065b97d0
3
+ metadata.gz: c5298ff2018cafcc8c18f9319af1027d92c5f5a1b2c11cb683f916d65e0ba5ba
4
+ data.tar.gz: ab00474b4117ae16729255445285d9b835fe1d92a6de7b5c7a10207bb684c4e1
5
5
  SHA512:
6
- metadata.gz: ce4cf1a75166c6cfa4acf0703b05e727c3ec2422ee1f29abfc11c3046f9ede6d6460a314ea449b9346bff2f352c137c2bb0d1f061b34ef71ecfda448020ee79e
7
- data.tar.gz: 7bcc9d126cf37ae30527b908c0f0f4f799f85eb0ea83ff4dd588393c745ea587e334a6141ceadef393e2b7ca5edcb0aa0343d5f5dda8a3c70b5e38a3eb38a101
6
+ metadata.gz: fd0603af29ac1189dd43b9b8beee290e091709cb218389a47dce5489bfed64aa716d9534c6848d2a735341cf7ed34149fb815d46605020f2c1806743ed7e7a44
7
+ data.tar.gz: b47e003284e29761c501d27e82032011e9350e816627d16223f24657c5f8ffdb155e69753c179ffc08b7c7bd95e633bc6aa851b55c1feab64be834cbce6e5529
@@ -55,7 +55,13 @@ module Build
55
55
  # The difference between the root path and the required path, taking into account the common prefix:
56
56
  up = root_components.size - i
57
57
 
58
- return File.join([".."] * up + path_components[i..-1])
58
+ components = [".."] * up + path_components[i..-1]
59
+
60
+ if components.empty?
61
+ return "."
62
+ else
63
+ return File.join(components)
64
+ end
59
65
  end
60
66
 
61
67
  def self.relative_path(root, full_path)
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Build
22
22
  module Files
23
- VERSION = "1.4.2"
23
+ VERSION = "1.4.3"
24
24
  end
25
25
  end
@@ -28,6 +28,12 @@ RSpec.describe Build::Files::Path do
28
28
  expect(Build::Files::Path.expand("foo", "/bar")).to be == "/bar/foo"
29
29
  end
30
30
 
31
+ it "should give current path" do
32
+ path = Build::Files::Path.new("/a/b/c/file.cpp")
33
+
34
+ expect(path.shortest_path(path)).to be == "."
35
+ end
36
+
31
37
  it "should give the shortest path for outer paths" do
32
38
  input = Build::Files::Path.new("/a/b/c/file.cpp")
33
39
  output = Build::Files::Path.new("/a/b/c/d/e/")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-files
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams