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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/{CHANGES → CHANGES.md} +41 -29
  4. data/Gemfile +2 -0
  5. data/{MANIFEST → MANIFEST.md} +6 -5
  6. data/README.md +104 -0
  7. data/Rakefile +227 -222
  8. data/benchmarks/bench_pathname2.rb +127 -0
  9. data/examples/{example_pathname.rb → example_pathname2.rb} +7 -7
  10. data/lib/pathname2.rb +169 -171
  11. data/pathname2.gemspec +15 -13
  12. data/test/{test_pathname.rb → test_pathname2.rb} +67 -63
  13. data/test/test_version.rb +3 -3
  14. data/test/windows/test_append.rb +7 -7
  15. data/test/windows/test_aref.rb +3 -3
  16. data/test/windows/test_ascend.rb +5 -5
  17. data/test/windows/test_children.rb +7 -7
  18. data/test/windows/test_clean.rb +17 -17
  19. data/test/windows/test_clean_bang.rb +17 -17
  20. data/test/windows/test_constructor.rb +12 -12
  21. data/test/windows/test_descend.rb +5 -5
  22. data/test/windows/test_drive_number.rb +13 -13
  23. data/test/windows/test_each.rb +3 -3
  24. data/test/windows/test_facade.rb +6 -6
  25. data/test/windows/test_is_absolute.rb +8 -8
  26. data/test/windows/test_is_relative.rb +7 -7
  27. data/test/windows/test_is_root.rb +8 -8
  28. data/test/windows/test_is_unc.rb +18 -18
  29. data/test/windows/test_join.rb +8 -8
  30. data/test/windows/test_long_path.rb +6 -6
  31. data/test/windows/test_misc.rb +7 -7
  32. data/test/windows/test_parent.rb +9 -9
  33. data/test/windows/test_pstrip.rb +9 -9
  34. data/test/windows/test_pstrip_bang.rb +10 -10
  35. data/test/windows/test_realpath.rb +5 -5
  36. data/test/windows/test_relative_path_from.rb +4 -4
  37. data/test/windows/test_root.rb +14 -14
  38. data/test/windows/test_short_path.rb +6 -6
  39. data/test/windows/test_to_a.rb +12 -12
  40. data/test/windows/test_undecorate.rb +12 -12
  41. data/test/windows/test_undecorate_bang.rb +13 -13
  42. data.tar.gz.sig +0 -0
  43. metadata +62 -57
  44. metadata.gz.sig +0 -0
  45. data/README +0 -97
  46. data/benchmarks/bench_pathname.rb +0 -127
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5ceebdb160d9cff955f151ea0dfc7d4bcdb9712aaa704a8da7c9313049cea9b
4
- data.tar.gz: 9395e28af5ba15511e1438e3aa03de96a1cf60aa85c0444b5d602fd6f73546b8
3
+ metadata.gz: 60bcd738b7fad0467fcfb58b1b388ed6ac4887d70658774c1560b39465eaa143
4
+ data.tar.gz: 3c9f9c5e5642e4a0ea514a8f6d416a987b74e7ef69443b502a4b706298fe5420
5
5
  SHA512:
6
- metadata.gz: 3d6f7a5782967efe3352ed26af74e48b73a321bc13cd01855d413577e9f97d1146e54a2c4562e6928c3dd6f4d6a066118e7f12af1a82f97e15f3cddd9048f5ff
7
- data.tar.gz: 137597451e32bb50a4d13ed9a8e3d5e1fe497968e2bf1c917aa0ba20145c560a211ed64f1b230ea2a552ee79688d86431a02cdcbf933aeb9c051813b6d7b9527
6
+ metadata.gz: 4a1ef3a4b5932b7482fecc28809f8281059d5081c93004da2bc93d1f34666bd6db2b8d4a6a7a237ba878c40143622ddb7388b6fb2e915639a5ff697720d408b6
7
+ data.tar.gz: 6c3472bb068e00671398a1f6be05fa528f30c18de5dd770f7b7d72e3352e1c2e57666abef1d347d7d148d3a2b35112b4e19e18be781037c762e57db786a9d228
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,51 +1,63 @@
1
- == 1.8.3 - 30-Aug-2020
1
+ ## 2.0.0 - 29-Nov-2025
2
+ * Pathname has been renamed Pathname2, so it's no longer competing for the
3
+ same constant name as the stdlib vedrsion. Recent versions of Ruby simply
4
+ weren't allowing it, and this is probably the better way to go anyway.
5
+ * Added addressable as a dependency since the stdlib uri library is a constant
6
+ source of warnings.
7
+
8
+ ## 1.8.4 - 19-Jan-2021
9
+ * Cleaned up the Rubocop warnings.
10
+ * Added a Gemfile.
11
+ * Some minor updates to the gemspec and Rakefile.
12
+
13
+ ## 1.8.3 - 30-Aug-2020
2
14
  * Updated the tests to match the version. Thanks go to Cédric Boutillier for the spot.
3
15
  * Fixed a redefinition warning for the :children method.
4
16
  * Fixed a Fixnum deprecation warning.
5
17
 
6
- == 1.8.2 - 21-Jul-2020
18
+ ## 1.8.2 - 21-Jul-2020
7
19
  * Added a LICENSE file as required by the Apache-2.0 license.
8
20
 
9
- == 1.8.1 - 31-Jan-2019
21
+ ## 1.8.1 - 31-Jan-2019
10
22
  * The VERSION constant is now frozen.
11
23
  * Added metadata to the gemspec.
12
24
  * Fixed missing hyphen in license name.
13
25
  * Updated cert, should be good for about 10 years.
14
26
 
15
- == 1.8.0 - 19-Jun-2016
27
+ ## 1.8.0 - 19-Jun-2016
16
28
  * Changed license to Apache-2.0.
17
29
  * Some cleanup and updates to the Rakefile and benchmarks.
18
30
  * Refactored some realpath tests so they're not touching system files like
19
31
  /dev/stdin any more. Thanks go to Michael R. Crusoe for pointing out the
20
32
  potential pitfalls of doing that.
21
33
 
22
- == 1.7.4 - 7-Sep-2015
34
+ ## 1.7.4 - 7-Sep-2015
23
35
  * This gem is now signed.
24
36
  * Rakefile now assumes Rubygems 2.x for some tasks.
25
37
 
26
- == 1.7.3 - 24-Apr-2014
38
+ ## 1.7.3 - 24-Apr-2014
27
39
  * The basename and dirname methods now return Pathname objects.
28
40
 
29
- == 1.7.2 - 23-Apr-2014
41
+ ## 1.7.2 - 23-Apr-2014
30
42
  * The join and expand_path methods now return Pathname objects.
31
43
 
32
- == 1.7.1 - 28-Mar-2014
44
+ ## 1.7.1 - 28-Mar-2014
33
45
  * Updated gemspec for Windows vs Unix.
34
46
  * Updated README and MANIFEST.
35
47
 
36
- == 1.7.0 - 28-Mar-2014
48
+ ## 1.7.0 - 28-Mar-2014
37
49
  * Windows now uses FFI internally instead of win32-api.
38
50
  * Added a custom pretty_print method for the pp library.
39
51
  * Reorganized the test suite for Windows, and added many
40
52
  more test tasks to the Rakefile.
41
53
 
42
- == 1.6.5 - 19-Sep-2011
54
+ ## 1.6.5 - 19-Sep-2011
43
55
  * Added the String#to_path instance method. This returns a Pathname
44
56
  object.
45
57
  * The architecture for the Windows gem is now "universal", and some
46
58
  gemspec dependencies were simplified.
47
59
 
48
- == 1.6.4 - 20-Jan-2011
60
+ ## 1.6.4 - 20-Jan-2011
49
61
  * Explicitly remove the Pathname const if it is already defined in order
50
62
  to avoid a superclass mismatch error. This library assumes that if you
51
63
  require pathname2, you want my version of the Pathname class.
@@ -54,13 +66,13 @@
54
66
  * Some Rakefile and gemspec tweaks.
55
67
  * Some updates to the test suite, including some specifically for Windows 7.
56
68
 
57
- == 1.6.3 - 2-Oct-2009
69
+ ## 1.6.3 - 2-Oct-2009
58
70
  * Updated Windows platform handling code to include mingw and cygwin.
59
71
  * Added the :gem rake task.
60
72
  * Minor gemspec updates.
61
73
  * Some minor test suite updates.
62
74
 
63
- == 1.6.2 - 4-Aug-2009
75
+ ## 1.6.2 - 4-Aug-2009
64
76
  * Now compatible with Ruby 1.9.x.
65
77
  * License changed to Artistic 2.0.
66
78
  * Added the Pathname.pwd method as a synonym for Pathname.new(Dir.pwd).
@@ -70,14 +82,14 @@
70
82
  * Now compatible with Ruby 1.9.x.
71
83
  * Bumped required version of the facade library to 1.0.4.
72
84
 
73
- == 1.6.1 - 8-Nov-2008
85
+ ## 1.6.1 - 8-Nov-2008
74
86
  * Added the Pathname#[] method, which accepts an index, an index plus a
75
87
  length, or a range, and returns appropriate the path element(s).
76
88
  * Refactoring the platform checking in the test suite to use rbconfig instead
77
89
  of RUBY_PLATFORM.
78
90
  * More inline documentation examples.
79
91
 
80
- == 1.6.0 - 13-July-2008
92
+ ## 1.6.0 - 13-July-2008
81
93
  * The facade for ftools (and ftools itself) has been removed. The ftools
82
94
  library is deprecated in favor of FileUtils.
83
95
  * PathnameError is now Pathname::Error.
@@ -90,7 +102,7 @@
90
102
  * Changed platform checking to use rbconfig instead of RUBY_PLATFORM to avoid
91
103
  potential issues with other Ruby implementation.
92
104
 
93
- == 1.5.2 - 9-Mar-2007
105
+ ## 1.5.2 - 9-Mar-2007
94
106
  * Bug fix for the Pathname#realpath method where it was not handling recursive
95
107
  symlinks. The C version was also fixed, but it only affected platforms that
96
108
  don't have the realpath() function.
@@ -102,7 +114,7 @@
102
114
  * Added a Rakefile. You can now build, clean, and test and install (both the
103
115
  pure Ruby and C versions).
104
116
 
105
- == 1.5.1 - 28-Aug-2006
117
+ ## 1.5.1 - 28-Aug-2006
106
118
  * Added the Kernel#pn method as a shortcut for Pathname.new.
107
119
  * The Pathname#readlink now properly handles symbolic links. The 'fix'
108
120
  from 1.4.4 did not work.
@@ -111,33 +123,33 @@
111
123
  * Added the '/' alias for '+'. So, p1 / p2 is the same as p1 + p2.
112
124
  * The windows-pr package is now required on MS Windows.
113
125
 
114
- == 1.5.0 - 17-Apr-2006
126
+ ## 1.5.0 - 17-Apr-2006
115
127
  * Better subclass handling, in that some methods that previously returned
116
128
  hardcoded Pathname.new now return self.class.new.
117
129
  * File URL's are now handled on Unix as well (using the 'uri' package).
118
130
  * Some comment changes/clarifications.
119
131
  * Added the PathnameError class to the pure Ruby version.
120
132
 
121
- == 1.4.4 - 23-Mar-2006
133
+ ## 1.4.4 - 23-Mar-2006
122
134
  * If the path is a symbolic link the Pathname#realpath method
123
135
  now returns the absolute path of that link, i.e. the result
124
136
  of File.readlink (as a Pathname object).
125
137
 
126
- == 1.4.3 - 3-Mar-2006
138
+ ## 1.4.3 - 3-Mar-2006
127
139
  * Added the Pathname#realpath method.
128
140
 
129
- == 1.4.2 - 22-Feb-2006
141
+ ## 1.4.2 - 22-Feb-2006
130
142
  * Fixed the Pathname#relative_path_from method for Windows. This really only
131
143
  affected edge cases that you probably never saw anyway.
132
144
  * Added corresponding tests for Windows.
133
145
 
134
- == 1.4.1 - 18-Feb-2006
146
+ ## 1.4.1 - 18-Feb-2006
135
147
  * Added the Pathname#parent method.
136
148
  * Added the Pathname#relative_path_from method.
137
149
  * Bug fix for Pathname#pstrip on *nix.
138
150
  * Corresponding test suite additions.
139
151
 
140
- == 1.4.0 - 19-Dec-2005
152
+ ## 1.4.0 - 19-Dec-2005
141
153
  * Added destructive and non-destructive methods for some methods - pstrip,
142
154
  pstrip!, undecorate, undecorate!, clean and clean!.
143
155
  * Added a C extension version of this package. You can use the C version
@@ -151,26 +163,26 @@
151
163
  * Added the bench_pathname.rb script to let you benchmark all Pathname
152
164
  methods.
153
165
 
154
- == 1.3.1 - 21-Nov-2005
166
+ ## 1.3.1 - 21-Nov-2005
155
167
  * Added the Pathname#children method.
156
168
  * Added tests for the Pathname#children method.
157
169
 
158
- == 1.3.0 - 28-Oct-2005
170
+ ## 1.3.0 - 28-Oct-2005
159
171
  * Added the short_path and long_path methods for MS Windows.
160
172
  * Optimization for the '+' method on Unix.
161
173
  * Added some examples under the 'examples' directory.
162
174
  * More tests added and some minor changes to the test suite in general.
163
175
 
164
- == 1.2.1 - 1-Sep-2005
176
+ ## 1.2.1 - 1-Sep-2005
165
177
  * Bug fix for the ascend and descend methods wrt Windows and UNC paths.
166
178
  * More tests added for ascend and descend methods.
167
179
 
168
- == 1.2.0 - 29-Aug-2005
180
+ ## 1.2.0 - 29-Aug-2005
169
181
  * Added the 'ascend' and 'descend' methods.
170
182
  * Added corresponding test suite additions.
171
183
 
172
- == 1.1.0 - 13-Jul-2005
184
+ ## 1.1.0 - 13-Jul-2005
173
185
  * Added the 'find' facade.
174
186
 
175
- == 1.0.0 - 11-Jun-2005
187
+ ## 1.0.0 - 11-Jun-2005
176
188
  * Initial release
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -1,15 +1,16 @@
1
- * CHANGES
1
+ * CHANGES.md
2
+ * Gemfile
2
3
  * LICENSE
3
- * MANIFEST
4
+ * MANIFEST.md
4
5
  * Rakefile
5
- * README
6
+ * README.md
6
7
  * pathname2.gempsec
7
8
  * benchmarks/bench_all.rb
8
9
  * benchmarks/bench_plus.rb
9
10
  * certs/djberg96_pub.pem
10
- * examples/example_pathname.rb
11
+ * examples/example_pathname2.rb
11
12
  * lib/pathname2.rb
12
- * test/test_pathname.rb
13
+ * test/test_pathname2.rb
13
14
  * test/test_version.rb
14
15
  * test/windows/test_append.rb
15
16
  * test/windows/test_aref.rb
data/README.md ADDED
@@ -0,0 +1,104 @@
1
+ [![Ruby](https://github.com/djberg96/pathname2/actions/workflows/ruby.yml/badge.svg)](https://github.com/djberg96/pathname2/actions/workflows/ruby.yml)
2
+
3
+ ## Description
4
+ A drop-in replacement for the current Pathname class.
5
+
6
+ ## Prerequisites
7
+ * facade
8
+ * ffi (Windows only)
9
+ * test-unit (testing only)
10
+
11
+ ## Installation
12
+ `gem install pathname2`
13
+
14
+ ## Adding the Trusted Cert
15
+
16
+ `gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/pathname2/main/certs/djberg96_pub.pem)`
17
+
18
+ ## Synopsis
19
+ ```ruby
20
+ require 'pathname2'
21
+
22
+ # Unix
23
+ path1 = Pathname.new("/foo/bar/baz")
24
+ path2 = Pathname.new("../zap")
25
+
26
+ path1 + path2 # "/foo/bar/zap"
27
+ path1 / path2 # "/foo/bar/zap" (same as +)
28
+ path1.exists? # Does this path exist?
29
+ path1.dirname # "/foo/bar"
30
+ path1.to_a # ['foo','bar','baz']
31
+
32
+ # Windows
33
+ path1 = Pathname.new("C:/foo/bar/baz")
34
+ path2 = Pathname.new("../zap")
35
+
36
+ path1 + path2 # "C:\\foo\\bar\\zap"
37
+ path1.root # "C:\\"
38
+ path1.to_a # ['C:','foo','bar','baz']
39
+ ```
40
+
41
+ ## Windows Notes
42
+ All forward slashes are converted to backslashes for Pathname objects.
43
+
44
+ ## Differences between Unix and Windows
45
+ If your pathname consists solely of ".", or "..", the return
46
+ value for Pathname#clean will be different. On Win32, "\\" is returned,
47
+ while on Unix "." is returned. I consider this an extreme edge case and
48
+ will not worry myself with it.
49
+
50
+ ## Differences between Pathname in the standard library and this version
51
+ * It is a subclass of String (and thus, mixes in Enumerable).
52
+ * It has sensical `to_a` and `root` instance methods.
53
+ * It works on Windows and Unix. The current implementation does not work
54
+ with Windows path names very well, and not at all when it comes to UNC
55
+ paths.
56
+ * The `Pathname#cleanpath` method works differently - it always returns
57
+ a canonical pathname. In addition, there is no special consideration
58
+ for symlinks (yet), though I'm not sure it warrants it.
59
+ * The `Pathname#+` method auto cleans.
60
+ * It uses a facade for all File and Dir methods, as well as most FileUtils
61
+ methods.
62
+ * `Pathname#clean` works slightly differently. In the stdlib version,
63
+ `Pathname#clean("../a")` returns "../a". In this version, it returns "a".
64
+ This affects other methods, such as `Pathname#relative_path_from`.
65
+ * Accepts file urls and converts them to paths automatically, e.g.
66
+ file:///foo%20bar/baz becomes '/foo/bar/baz'.
67
+ * Adds a Kernel level `pn` method as a shortcut.
68
+ * Allows you to add paths together with the '/' operator.
69
+
70
+ ## Method Priority
71
+ Because there is some overlap in method names between File, Dir, and
72
+ FileUtils, the priority is as follows:
73
+
74
+ * File
75
+ * Dir
76
+ * FileUtils
77
+
78
+ In other words, whichever of these defines a given method first is the
79
+ method that is used by the pathname2 library.
80
+
81
+ ## Known Issues
82
+ On MS Windows, some methods may not work on pathnames greater than 260
83
+ characters because of internal function limitations.
84
+
85
+ Any issues you find should be reported on the project page at
86
+ https://github.com/djberg96/pathname2
87
+
88
+ ## Future Plans
89
+ None at this time. Suggestions welcome.
90
+
91
+ ## License
92
+ Apache-2.0
93
+
94
+ ## Copyright
95
+ (C) 2003-2021 Daniel J. Berger
96
+ All rights reserved.
97
+
98
+ ## Warranty
99
+ This library is provided "as is" and without any express or
100
+ implied warranties, including, without limitation, the implied
101
+ warranties of merchantability and fitness for a particular purpose.
102
+
103
+ ## Author
104
+ Daniel J. Berger