pathname2 1.8.3 → 2.0.0
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
- checksums.yaml.gz.sig +0 -0
- data/{CHANGES → CHANGES.md} +41 -29
- data/Gemfile +2 -0
- data/{MANIFEST → MANIFEST.md} +6 -5
- data/README.md +104 -0
- data/Rakefile +227 -222
- data/benchmarks/bench_pathname2.rb +127 -0
- data/examples/{example_pathname.rb → example_pathname2.rb} +7 -7
- data/lib/pathname2.rb +169 -171
- data/pathname2.gemspec +15 -13
- data/test/{test_pathname.rb → test_pathname2.rb} +67 -63
- data/test/test_version.rb +3 -3
- data/test/windows/test_append.rb +7 -7
- data/test/windows/test_aref.rb +3 -3
- data/test/windows/test_ascend.rb +5 -5
- data/test/windows/test_children.rb +7 -7
- data/test/windows/test_clean.rb +17 -17
- data/test/windows/test_clean_bang.rb +17 -17
- data/test/windows/test_constructor.rb +12 -12
- data/test/windows/test_descend.rb +5 -5
- data/test/windows/test_drive_number.rb +13 -13
- data/test/windows/test_each.rb +3 -3
- data/test/windows/test_facade.rb +6 -6
- data/test/windows/test_is_absolute.rb +8 -8
- data/test/windows/test_is_relative.rb +7 -7
- data/test/windows/test_is_root.rb +8 -8
- data/test/windows/test_is_unc.rb +18 -18
- data/test/windows/test_join.rb +8 -8
- data/test/windows/test_long_path.rb +6 -6
- data/test/windows/test_misc.rb +7 -7
- data/test/windows/test_parent.rb +9 -9
- data/test/windows/test_pstrip.rb +9 -9
- data/test/windows/test_pstrip_bang.rb +10 -10
- data/test/windows/test_realpath.rb +5 -5
- data/test/windows/test_relative_path_from.rb +4 -4
- data/test/windows/test_root.rb +14 -14
- data/test/windows/test_short_path.rb +6 -6
- data/test/windows/test_to_a.rb +12 -12
- data/test/windows/test_undecorate.rb +12 -12
- data/test/windows/test_undecorate_bang.rb +13 -13
- data.tar.gz.sig +0 -0
- metadata +62 -57
- metadata.gz.sig +0 -0
- data/README +0 -97
- data/benchmarks/bench_pathname.rb +0 -127
data/test/windows/test_root.rb
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
########################################################################
|
|
2
2
|
# test_root.rb
|
|
3
3
|
#
|
|
4
|
-
# Test suite for the
|
|
4
|
+
# Test suite for the Pathname2#root method
|
|
5
5
|
########################################################################
|
|
6
6
|
require 'test-unit'
|
|
7
7
|
require 'pathname2'
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class TC_Pathname2_Root < Test::Unit::TestCase
|
|
10
10
|
def setup
|
|
11
|
-
@abs_path =
|
|
12
|
-
@unc_path =
|
|
13
|
-
@rel_path =
|
|
11
|
+
@abs_path = Pathname2.new("C:\\Program Files")
|
|
12
|
+
@unc_path = Pathname2.new("\\\\foo\\bar\\baz")
|
|
13
|
+
@rel_path = Pathname2.new("foo\\bar\\baz")
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
test "root method returns expected results for absolute paths" do
|
|
@@ -18,13 +18,13 @@ class TC_Pathname_Root < Test::Unit::TestCase
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
test "root method returns expected results for paths with forward slashes" do
|
|
21
|
-
assert_equal("C:\\",
|
|
21
|
+
assert_equal("C:\\", Pathname2.new("C:/Program Files").root)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
test "root method returns expected results for unc paths" do
|
|
25
25
|
assert_equal("\\\\foo\\bar", @unc_path.root)
|
|
26
|
-
assert_equal("\\\\foo",
|
|
27
|
-
assert_equal("\\\\",
|
|
26
|
+
assert_equal("\\\\foo", Pathname2.new("\\\\foo").root)
|
|
27
|
+
assert_equal("\\\\", Pathname2.new("\\\\").root)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
test "root method returns dot for relative paths" do
|
|
@@ -32,22 +32,22 @@ class TC_Pathname_Root < Test::Unit::TestCase
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
test "root method returns expected result for root path" do
|
|
35
|
-
assert_equal("Z:\\",
|
|
36
|
-
assert_equal("\\\\foo\\bar",
|
|
35
|
+
assert_equal("Z:\\", Pathname2.new("Z:\\").root)
|
|
36
|
+
assert_equal("\\\\foo\\bar", Pathname2.new("\\\\foo\\bar").root)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
test "root method returns expected result for empty string" do
|
|
40
|
-
assert_equal(".",
|
|
40
|
+
assert_equal(".", Pathname2.new("").root)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
test "root method returns expected result for dot and dotdot" do
|
|
44
|
-
assert_equal(".",
|
|
45
|
-
assert_equal(".",
|
|
44
|
+
assert_equal(".", Pathname2.new("..").root)
|
|
45
|
+
assert_equal(".", Pathname2.new(".").root)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
test "root method is not destructive" do
|
|
49
49
|
str = 'C:/Program Files'
|
|
50
|
-
assert_nothing_raised{
|
|
50
|
+
assert_nothing_raised{ Pathname2.new(str).root }
|
|
51
51
|
assert_equal('C:/Program Files', str)
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
########################################################################
|
|
2
2
|
# test_short_path.rb
|
|
3
3
|
#
|
|
4
|
-
# Test suite for the
|
|
4
|
+
# Test suite for the Pathname2#short_path method
|
|
5
5
|
########################################################################
|
|
6
6
|
require 'test-unit'
|
|
7
7
|
require 'pathname2'
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class TC_Pathname2_ShortPath < Test::Unit::TestCase
|
|
10
10
|
def setup
|
|
11
|
-
@abs_path =
|
|
11
|
+
@abs_path = Pathname2.new("C:\\Program Files")
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
test "short_path basic functionality" do
|
|
@@ -22,16 +22,16 @@ class TC_Pathname_ShortPath < Test::Unit::TestCase
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
test "short_path returns the same string if it's already short" do
|
|
25
|
-
assert_equal("C:\\",
|
|
25
|
+
assert_equal("C:\\", Pathname2.new("C:/").short_path)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
test "short_path fails if the path does not exist" do
|
|
29
|
-
assert_raise(Errno::ESRCH){
|
|
29
|
+
assert_raise(Errno::ESRCH){ Pathname2.new("C:/Bogus/AlsoBogus").short_path }
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
test "short_path method is not destructive" do
|
|
33
33
|
str = 'C:/Program Files'
|
|
34
|
-
assert_nothing_raised{
|
|
34
|
+
assert_nothing_raised{ Pathname2.new(str).short_path }
|
|
35
35
|
assert_equal('C:/Program Files', str)
|
|
36
36
|
end
|
|
37
37
|
|
data/test/windows/test_to_a.rb
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
########################################################################
|
|
2
2
|
# test_to_a.rb
|
|
3
3
|
#
|
|
4
|
-
# Test suite for the
|
|
4
|
+
# Test suite for the Pathname2#to_a method.
|
|
5
5
|
########################################################################
|
|
6
6
|
require 'test-unit'
|
|
7
7
|
require 'pathname2'
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class TC_Pathname2_ToA < Test::Unit::TestCase
|
|
10
10
|
def setup
|
|
11
|
-
@path =
|
|
11
|
+
@path = Pathname2.new('C:/Program Files/foo')
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
test "to_a basic functionality" do
|
|
@@ -18,21 +18,21 @@ class TC_Pathname_ToA < Test::Unit::TestCase
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
test "to_a returns the expected results for standard paths" do
|
|
21
|
-
assert_equal(['C:'],
|
|
22
|
-
assert_equal(['C:', 'Program Files'],
|
|
23
|
-
assert_equal(['C:', 'Program Files', 'Stuff'],
|
|
24
|
-
assert_equal(['C:', 'Users'],
|
|
21
|
+
assert_equal(['C:'], Pathname2.new('C:/').to_a)
|
|
22
|
+
assert_equal(['C:', 'Program Files'], Pathname2.new('C:/Program Files').to_a)
|
|
23
|
+
assert_equal(['C:', 'Program Files', 'Stuff'], Pathname2.new('C:/Program Files/Stuff').to_a)
|
|
24
|
+
assert_equal(['C:', 'Users'], Pathname2.new("C:\\Users").to_a)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
test "to_a returns the expected results for unc paths" do
|
|
28
|
-
assert_equal(['foo', 'bar', 'baz'],
|
|
29
|
-
assert_equal(['foo', 'bar'],
|
|
30
|
-
assert_equal(['foo'],
|
|
28
|
+
assert_equal(['foo', 'bar', 'baz'], Pathname2.new('//foo/bar/baz').to_a)
|
|
29
|
+
assert_equal(['foo', 'bar'], Pathname2.new('//foo/bar').to_a)
|
|
30
|
+
assert_equal(['foo'], Pathname2.new('//foo').to_a)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
test "to_a returns the expected results for empty strings and empty unc paths" do
|
|
34
|
-
assert_equal([],
|
|
35
|
-
assert_equal([],
|
|
34
|
+
assert_equal([], Pathname2.new('').to_a)
|
|
35
|
+
assert_equal([], Pathname2.new('//').to_a)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
test "to_a does not modify receiver" do
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
########################################################################
|
|
2
2
|
# test_undecorate.rb
|
|
3
3
|
#
|
|
4
|
-
# Test suite for the
|
|
4
|
+
# Test suite for the Pathname2#undecorate method
|
|
5
5
|
########################################################################
|
|
6
6
|
require 'test-unit'
|
|
7
7
|
require 'pathname2'
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class TC_Pathname2_Undecorate < Test::Unit::TestCase
|
|
10
10
|
def setup
|
|
11
|
-
@std =
|
|
11
|
+
@std = Pathname2.new('C:/Path/File.txt')
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
test "undecorate basic functionality" do
|
|
@@ -16,28 +16,28 @@ class TC_Pathname_Undecorate < Test::Unit::TestCase
|
|
|
16
16
|
assert_nothing_raised{ @std.undecorate }
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
test "undecorate returns a
|
|
20
|
-
assert_kind_of(
|
|
19
|
+
test "undecorate returns a Pathname2 object" do
|
|
20
|
+
assert_kind_of(Pathname2, @std.undecorate)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
test "undecorate method returns an already undecorated path unchanged" do
|
|
24
|
-
assert_equal('C:\Path\File.txt',
|
|
25
|
-
assert_equal('\\foo\bar',
|
|
24
|
+
assert_equal('C:\Path\File.txt', Pathname2.new('C:\Path\File.txt').undecorate)
|
|
25
|
+
assert_equal('\\foo\bar', Pathname2.new('\\foo\bar').undecorate)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
test "undecorate returns expected result for standard path" do
|
|
29
|
-
assert_equal('C:\Path\File',
|
|
30
|
-
assert_equal('C:\Path\[3].txt',
|
|
29
|
+
assert_equal('C:\Path\File', Pathname2.new('C:\Path\File[12]').undecorate)
|
|
30
|
+
assert_equal('C:\Path\[3].txt', Pathname2.new('C:\Path\[3].txt').undecorate)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
test "undecorate returns expected result for UNC path" do
|
|
34
|
-
assert_equal('\\foo\bar.txt',
|
|
35
|
-
assert_equal('\\foo\bar',
|
|
34
|
+
assert_equal('\\foo\bar.txt',Pathname2.new('\\foo\bar[5].txt').undecorate)
|
|
35
|
+
assert_equal('\\foo\bar', Pathname2.new('\\foo\bar[5]').undecorate)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
test "undecorate does not modify the original string" do
|
|
39
39
|
str = 'C:/Path/File.txt'
|
|
40
|
-
assert_nothing_raised{
|
|
40
|
+
assert_nothing_raised{ Pathname2.new(str).undecorate }
|
|
41
41
|
assert_equal('C:/Path/File.txt', str)
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
########################################################################
|
|
2
2
|
# test_undecorate_bang.rb
|
|
3
3
|
#
|
|
4
|
-
# Test suite for the
|
|
4
|
+
# Test suite for the Pathname2#undecorate! method
|
|
5
5
|
########################################################################
|
|
6
6
|
require 'test-unit'
|
|
7
7
|
require 'pathname2'
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class TC_Pathname2_UndecorateBang < Test::Unit::TestCase
|
|
10
10
|
def setup
|
|
11
|
-
@std =
|
|
11
|
+
@std = Pathname2.new('C:/Path/File.txt')
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
test "undecorate! basic functionality" do
|
|
@@ -16,33 +16,33 @@ class TC_Pathname_UndecorateBang < Test::Unit::TestCase
|
|
|
16
16
|
assert_nothing_raised{ @std.undecorate! }
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
test "undecorate! returns a
|
|
20
|
-
assert_kind_of(
|
|
19
|
+
test "undecorate! returns a Pathname2 object" do
|
|
20
|
+
assert_kind_of(Pathname2, @std.undecorate!)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
test "undecorate! method returns an already undecorated path unchanged" do
|
|
24
|
-
assert_equal('C:\Path\File.txt',
|
|
25
|
-
assert_equal('\\foo\bar',
|
|
24
|
+
assert_equal('C:\Path\File.txt', Pathname2.new('C:\Path\File.txt').undecorate!)
|
|
25
|
+
assert_equal('\\foo\bar', Pathname2.new('\\foo\bar').undecorate!)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
test "undecorate! returns expected result for standard path" do
|
|
29
|
-
assert_equal('C:\Path\File',
|
|
30
|
-
assert_equal('C:\Path\[3].txt',
|
|
29
|
+
assert_equal('C:\Path\File', Pathname2.new('C:\Path\File[12]').undecorate!)
|
|
30
|
+
assert_equal('C:\Path\[3].txt', Pathname2.new('C:\Path\[3].txt').undecorate!)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
test "undecorate! returns expected result for UNC path" do
|
|
34
|
-
assert_equal('\\foo\bar.txt',
|
|
35
|
-
assert_equal('\\foo\bar',
|
|
34
|
+
assert_equal('\\foo\bar.txt',Pathname2.new('\\foo\bar[5].txt').undecorate!)
|
|
35
|
+
assert_equal('\\foo\bar', Pathname2.new('\\foo\bar[5]').undecorate!)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
test "undecorate! does not modify the original string" do
|
|
39
39
|
str = 'C:/Path/File.txt'
|
|
40
|
-
assert_nothing_raised{
|
|
40
|
+
assert_nothing_raised{ Pathname2.new(str).undecorate }
|
|
41
41
|
assert_equal('C:/Path/File.txt', str)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
test "undecorate does modify the object itself" do
|
|
45
|
-
path =
|
|
45
|
+
path = Pathname2.new('C:\Path\File[12]')
|
|
46
46
|
assert_nothing_raised{ path.undecorate! }
|
|
47
47
|
assert_equal('C:\Path\File', path)
|
|
48
48
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pathname2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel J. Berger
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain:
|
|
11
10
|
- |
|
|
@@ -35,36 +34,50 @@ cert_chain:
|
|
|
35
34
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
|
36
35
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
|
37
36
|
-----END CERTIFICATE-----
|
|
38
|
-
date:
|
|
37
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
39
38
|
dependencies:
|
|
40
39
|
- !ruby/object:Gem::Dependency
|
|
41
40
|
name: facade
|
|
42
41
|
requirement: !ruby/object:Gem::Requirement
|
|
43
42
|
requirements:
|
|
44
|
-
- - "
|
|
43
|
+
- - "~>"
|
|
45
44
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '
|
|
45
|
+
version: '1.2'
|
|
47
46
|
type: :runtime
|
|
48
47
|
prerelease: false
|
|
49
48
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
49
|
requirements:
|
|
51
|
-
- - "
|
|
50
|
+
- - "~>"
|
|
52
51
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
52
|
+
version: '1.2'
|
|
53
|
+
- !ruby/object:Gem::Dependency
|
|
54
|
+
name: addressable
|
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
|
56
|
+
requirements:
|
|
57
|
+
- - "~>"
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: '2.8'
|
|
60
|
+
type: :runtime
|
|
61
|
+
prerelease: false
|
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
64
|
+
- - "~>"
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: '2.8'
|
|
54
67
|
- !ruby/object:Gem::Dependency
|
|
55
68
|
name: test-unit
|
|
56
69
|
requirement: !ruby/object:Gem::Requirement
|
|
57
70
|
requirements:
|
|
58
|
-
- - "
|
|
71
|
+
- - "~>"
|
|
59
72
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '
|
|
73
|
+
version: '3.4'
|
|
61
74
|
type: :development
|
|
62
75
|
prerelease: false
|
|
63
76
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
77
|
requirements:
|
|
65
|
-
- - "
|
|
78
|
+
- - "~>"
|
|
66
79
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '
|
|
80
|
+
version: '3.4'
|
|
68
81
|
- !ruby/object:Gem::Dependency
|
|
69
82
|
name: rake
|
|
70
83
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -90,69 +103,63 @@ description: |2
|
|
|
90
103
|
email: djberg96@gmail.com
|
|
91
104
|
executables: []
|
|
92
105
|
extensions: []
|
|
93
|
-
extra_rdoc_files:
|
|
94
|
-
- README
|
|
95
|
-
- CHANGES
|
|
96
|
-
- MANIFEST
|
|
106
|
+
extra_rdoc_files: []
|
|
97
107
|
files:
|
|
108
|
+
- CHANGES.md
|
|
109
|
+
- Gemfile
|
|
98
110
|
- LICENSE
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
111
|
+
- MANIFEST.md
|
|
112
|
+
- README.md
|
|
113
|
+
- Rakefile
|
|
114
|
+
- benchmarks/bench_pathname2.rb
|
|
115
|
+
- benchmarks/bench_plus.rb
|
|
116
|
+
- certs/djberg96_pub.pem
|
|
117
|
+
- examples/example_pathname2.rb
|
|
118
|
+
- lib/pathname2.rb
|
|
119
|
+
- pathname2.gemspec
|
|
120
|
+
- test/test_pathname2.rb
|
|
121
|
+
- test/test_version.rb
|
|
122
|
+
- test/windows/test_append.rb
|
|
123
|
+
- test/windows/test_aref.rb
|
|
124
|
+
- test/windows/test_ascend.rb
|
|
125
|
+
- test/windows/test_children.rb
|
|
107
126
|
- test/windows/test_clean.rb
|
|
108
127
|
- test/windows/test_clean_bang.rb
|
|
109
|
-
- test/windows/
|
|
128
|
+
- test/windows/test_constructor.rb
|
|
129
|
+
- test/windows/test_descend.rb
|
|
130
|
+
- test/windows/test_drive_number.rb
|
|
131
|
+
- test/windows/test_each.rb
|
|
110
132
|
- test/windows/test_facade.rb
|
|
111
133
|
- test/windows/test_is_absolute.rb
|
|
112
|
-
- test/windows/test_realpath.rb
|
|
113
|
-
- test/windows/test_children.rb
|
|
114
|
-
- test/windows/test_pstrip.rb
|
|
115
|
-
- test/windows/test_relative_path_from.rb
|
|
116
|
-
- test/windows/test_constructor.rb
|
|
117
|
-
- test/windows/test_join.rb
|
|
118
134
|
- test/windows/test_is_relative.rb
|
|
119
135
|
- test/windows/test_is_root.rb
|
|
120
|
-
- test/windows/test_append.rb
|
|
121
136
|
- test/windows/test_is_unc.rb
|
|
122
|
-
- test/windows/
|
|
137
|
+
- test/windows/test_join.rb
|
|
138
|
+
- test/windows/test_long_path.rb
|
|
123
139
|
- test/windows/test_misc.rb
|
|
124
|
-
- test/windows/
|
|
125
|
-
- test/windows/
|
|
126
|
-
- test/windows/
|
|
127
|
-
- test/windows/
|
|
128
|
-
- test/windows/
|
|
140
|
+
- test/windows/test_parent.rb
|
|
141
|
+
- test/windows/test_pstrip.rb
|
|
142
|
+
- test/windows/test_pstrip_bang.rb
|
|
143
|
+
- test/windows/test_realpath.rb
|
|
144
|
+
- test/windows/test_relative_path_from.rb
|
|
145
|
+
- test/windows/test_root.rb
|
|
146
|
+
- test/windows/test_short_path.rb
|
|
129
147
|
- test/windows/test_to_a.rb
|
|
130
|
-
- test/
|
|
131
|
-
-
|
|
132
|
-
- CHANGES
|
|
133
|
-
- MANIFEST
|
|
134
|
-
- README
|
|
135
|
-
- Rakefile
|
|
136
|
-
- certs
|
|
137
|
-
- certs/djberg96_pub.pem
|
|
138
|
-
- examples
|
|
139
|
-
- examples/example_pathname.rb
|
|
140
|
-
- benchmarks
|
|
141
|
-
- benchmarks/bench_pathname.rb
|
|
142
|
-
- benchmarks/bench_plus.rb
|
|
143
|
-
- lib
|
|
144
|
-
- lib/pathname2.rb
|
|
148
|
+
- test/windows/test_undecorate.rb
|
|
149
|
+
- test/windows/test_undecorate_bang.rb
|
|
145
150
|
homepage: https://github.com/djberg96/pathname2
|
|
146
151
|
licenses:
|
|
147
152
|
- Apache-2.0
|
|
148
153
|
metadata:
|
|
149
154
|
homepage_uri: https://github.com/djberg96/pathname2
|
|
150
155
|
bug_tracker_uri: https://github.com/djberg96/pathname2/issues
|
|
151
|
-
changelog_uri: https://github.com/djberg96/pathname2/blob/
|
|
156
|
+
changelog_uri: https://github.com/djberg96/pathname2/blob/main/CHANGES.md
|
|
152
157
|
documentation_uri: https://github.com/djberg96/pathname2/wiki
|
|
153
158
|
source_code_uri: https://github.com/djberg96/pathname2
|
|
154
159
|
wiki_uri: https://github.com/djberg96/pathname2/wiki
|
|
155
|
-
|
|
160
|
+
rubygems_mfa_required: 'true'
|
|
161
|
+
github_repo: https://github.com/djberg96/pathname2
|
|
162
|
+
funding_uri: https://github.com/sponsors/djberg96
|
|
156
163
|
rdoc_options: []
|
|
157
164
|
require_paths:
|
|
158
165
|
- lib
|
|
@@ -167,10 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
167
174
|
- !ruby/object:Gem::Version
|
|
168
175
|
version: '0'
|
|
169
176
|
requirements: []
|
|
170
|
-
rubygems_version: 3.
|
|
171
|
-
signing_key:
|
|
177
|
+
rubygems_version: 3.6.9
|
|
172
178
|
specification_version: 4
|
|
173
179
|
summary: An alternate implementation of the Pathname class
|
|
174
180
|
test_files:
|
|
175
|
-
- test/test_pathname.rb
|
|
176
181
|
- test/test_version.rb
|
metadata.gz.sig
CHANGED
|
Binary file
|
data/README
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
== Description
|
|
2
|
-
A drop-in replacement for the current Pathname class.
|
|
3
|
-
|
|
4
|
-
== Prerequisites
|
|
5
|
-
* facade
|
|
6
|
-
* ffi (Windows only)
|
|
7
|
-
* test-unit (testing only)
|
|
8
|
-
|
|
9
|
-
== Installation
|
|
10
|
-
|
|
11
|
-
gem install pathname2
|
|
12
|
-
|
|
13
|
-
== Synopsis
|
|
14
|
-
require 'pathname2'
|
|
15
|
-
|
|
16
|
-
# Unix
|
|
17
|
-
path1 = Pathname.new("/foo/bar/baz")
|
|
18
|
-
path2 = Pathname.new("../zap")
|
|
19
|
-
|
|
20
|
-
path1 + path2 # "/foo/bar/zap"
|
|
21
|
-
path1 / path2 # "/foo/bar/zap" (same as +)
|
|
22
|
-
path1.exists? # Does this path exist?
|
|
23
|
-
path1.dirname # "/foo/bar"
|
|
24
|
-
path1.to_a # ['foo','bar','baz']
|
|
25
|
-
|
|
26
|
-
# Windows
|
|
27
|
-
path1 = Pathname.new("C:/foo/bar/baz")
|
|
28
|
-
path2 = Pathname.new("../zap")
|
|
29
|
-
|
|
30
|
-
path1 + path2 # "C:\\foo\\bar\\zap"
|
|
31
|
-
path1.root # "C:\\"
|
|
32
|
-
path1.to_a # ['C:','foo','bar','baz']
|
|
33
|
-
|
|
34
|
-
== Windows Notes
|
|
35
|
-
All forward slashes are converted to backslashes for Pathname objects.
|
|
36
|
-
|
|
37
|
-
== Differences between Unix and Windows
|
|
38
|
-
If your pathname consists solely of ".", or "..", the return
|
|
39
|
-
value for Pathname#clean will be different. On Win32, "\\" is returned,
|
|
40
|
-
while on Unix "." is returned. I consider this an extreme edge case and
|
|
41
|
-
will not worry myself with it.
|
|
42
|
-
|
|
43
|
-
== Differences between Pathname in the standard library and this version
|
|
44
|
-
* It is a subclass of String (and thus, mixes in Enumerable).
|
|
45
|
-
* It has sensical to_a and root instance methods.
|
|
46
|
-
* It works on Windows and Unix. The current implementation does not work
|
|
47
|
-
with Windows path names very well, and not at all when it comes to UNC
|
|
48
|
-
paths.
|
|
49
|
-
* The Pathname#cleanpath method works differently - it always returns
|
|
50
|
-
a canonical pathname. In addition, there is no special consideration
|
|
51
|
-
for symlinks (yet), though I'm not sure it warrants it.
|
|
52
|
-
* The Pathname#+ method auto cleans.
|
|
53
|
-
* It uses a facade for all File and Dir methods, as well as most FileUtils
|
|
54
|
-
methods.
|
|
55
|
-
* Pathname#clean works slightly differently. In the stdlib version,
|
|
56
|
-
Pathname#clean("../a") returns "../a". In this version, it returns "a".
|
|
57
|
-
This affects other methods, such as Pathname#relative_path_from.
|
|
58
|
-
* Accepts file urls and converts them to paths automatically, e.g.
|
|
59
|
-
file:///foo%20bar/baz becomes '/foo/bar/baz'.
|
|
60
|
-
* Adds a Kernel level +pn+ method as a shortcut.
|
|
61
|
-
* Allows you to add paths together with the '/' operator.
|
|
62
|
-
|
|
63
|
-
== Method Priority
|
|
64
|
-
Because there is some overlap in method names between File, Dir, and
|
|
65
|
-
FileUtils, the priority is as follows:
|
|
66
|
-
|
|
67
|
-
* File
|
|
68
|
-
* Dir
|
|
69
|
-
* FileUtils
|
|
70
|
-
|
|
71
|
-
In other words, whichever of these defines a given method first is the
|
|
72
|
-
method that is used by the pathname2 library.
|
|
73
|
-
|
|
74
|
-
== Known Issues
|
|
75
|
-
On MS Windows, some methods may not work on pathnames greater than 260
|
|
76
|
-
characters because of internal function limitations.
|
|
77
|
-
|
|
78
|
-
Any issues you find should be reported on the project page at
|
|
79
|
-
https://github.com/djberg96/pathname2
|
|
80
|
-
|
|
81
|
-
== Future Plans
|
|
82
|
-
Suggestions welcome.
|
|
83
|
-
|
|
84
|
-
== License
|
|
85
|
-
Apache-2.0
|
|
86
|
-
|
|
87
|
-
== Copyright
|
|
88
|
-
(C) 2003-2020 Daniel J. Berger
|
|
89
|
-
All rights reserved.
|
|
90
|
-
|
|
91
|
-
== Warranty
|
|
92
|
-
This library is provided "as is" and without any express or
|
|
93
|
-
implied warranties, including, without limitation, the implied
|
|
94
|
-
warranties of merchantability and fitness for a particular purpose.
|
|
95
|
-
|
|
96
|
-
== Author
|
|
97
|
-
Daniel J. Berger
|