path 2.0.1 → 2.1.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 +5 -5
- data/README.md +13 -3
- data/lib/path/dir.rb +5 -1
- data/lib/path/fileutils.rb +2 -2
- data/lib/path/implementation.rb +0 -1
- data/lib/path/io.rb +3 -3
- data/lib/path/predicates.rb +5 -0
- data/lib/path/version.rb +1 -1
- data/path.gemspec +1 -0
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: efcdf8c91dddaf7c18d7d833a664da77428c72f354bc73fbc89d9fb1d2fe4eb8
|
4
|
+
data.tar.gz: 9e1dea71086a4eb45b6aac1ad91c417432820985a2cdd222e77f1dc458fee1d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40610513248438fbc3038167c1aaff927d725107d2cfcdaf87d6d38036c9cc2fe432ce4e658fcefdd367cb42e3f467ded88cc81be273f73e53fe8dd2e13336e5
|
7
|
+
data.tar.gz: e09e515fbdf68768d9a39ac4e68d6665095f7216784d5ebbfa5e5b2261b904fd09d6d7eb010a54b398d825d0ccd224066c63aca6bf29919bedc2c2652e840417
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Path - a Path manipulation library
|
2
2
|
|
3
|
-
[](https://ci.appveyor.com/project/eregon/path/branch/master)
|
3
|
+
[](https://rubygems.org/gems/path)
|
4
|
+
[](https://github.com/eregon/path/actions/workflows/ci.yml)
|
6
5
|
|
7
6
|
[Path](http://rubydoc.info/github/eregon/path/master/Path) is a library to manage paths.
|
8
7
|
It is similar to Pathname, but has some extra goodness.
|
@@ -167,6 +166,17 @@ which will show where `+` is used as String concatenation.
|
|
167
166
|
Coming from a path library using `+` as #join, one should just use the default (`Path.configure(:+ => :warning)`),
|
168
167
|
which will show where `+` is used.
|
169
168
|
|
169
|
+
## Migration from path 1.x
|
170
|
+
|
171
|
+
A couple methods changed since 1.x, all mentioned in the [ChangeLog](Changelog.md).
|
172
|
+
|
173
|
+
One of the easiest way is to grep for the changed methods.
|
174
|
+
Here is a list of each with a direct replacement.
|
175
|
+
|
176
|
+
* Path.here => Path.file
|
177
|
+
* Path#base => Path#stem
|
178
|
+
* Path#ext => Path#pure_ext (it now returns a leading dot)
|
179
|
+
|
170
180
|
## Status
|
171
181
|
|
172
182
|
This is still in the early development stage, you should expect many additions and some changes.
|
data/lib/path/dir.rb
CHANGED
@@ -96,7 +96,8 @@ class Path
|
|
96
96
|
end
|
97
97
|
|
98
98
|
# Returns the children of the directory (files and subdirectories, not
|
99
|
-
# recursive) as an array of Path objects.
|
99
|
+
# recursive) as an array of Path objects. The children paths are always
|
100
|
+
# sorted to ensure a deterministic order. By default, the returned
|
100
101
|
# paths will have enough information to access the files. If you set
|
101
102
|
# +with_directory+ to +false+, then the returned paths will contain the
|
102
103
|
# filename only.
|
@@ -123,10 +124,12 @@ class Path
|
|
123
124
|
result << Path.new(e)
|
124
125
|
end
|
125
126
|
}
|
127
|
+
result.sort!
|
126
128
|
result
|
127
129
|
end
|
128
130
|
|
129
131
|
# Iterates over the children of the directory (files and subdirectories, not recursive).
|
132
|
+
# The children paths are always sorted to ensure a deterministic order.
|
130
133
|
# By default, the yielded paths will have enough information to access the files.
|
131
134
|
# If you set +with_directory+ to +false+, then the returned paths will contain the filename only.
|
132
135
|
#
|
@@ -158,6 +161,7 @@ class Path
|
|
158
161
|
# Equivalent of +parent.children - [self]+.
|
159
162
|
# Returns the siblings, the files in the same directory as the current +path+.
|
160
163
|
# Returns only the root if +path+ is the root.
|
164
|
+
# The sibling paths are always sorted to ensure a deterministic order.
|
161
165
|
def siblings(with_directory = true)
|
162
166
|
if root?
|
163
167
|
[self]
|
data/lib/path/fileutils.rb
CHANGED
@@ -80,8 +80,8 @@ class Path
|
|
80
80
|
# Install +file+ into +path+ (the "prefix", which should be a directory).
|
81
81
|
# If +file+ is not same as +path/file+, replaces it.
|
82
82
|
# See +FileUtils.install+ (arguments are swapped).
|
83
|
-
def install(file, options
|
84
|
-
FileUtils.install(file, @path, options)
|
83
|
+
def install(file, **options)
|
84
|
+
FileUtils.install(file, @path, **options)
|
85
85
|
end
|
86
86
|
|
87
87
|
# Recusively changes permissions. See +FileUtils.chmod_R+ and +File.chmod+.
|
data/lib/path/implementation.rb
CHANGED
data/lib/path/io.rb
CHANGED
@@ -64,11 +64,11 @@ class Path
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
if IO.respond_to? :write and
|
67
|
+
if IO.respond_to? :write and RUBY_ENGINE != 'jruby'
|
68
68
|
# Appends +contents+ to +self+. See +IO.write+ or +IO#write+.
|
69
|
-
def append(contents, open_args
|
69
|
+
def append(contents, **open_args)
|
70
70
|
open_args[:mode] = 'a'
|
71
|
-
IO.write(@path, contents, open_args)
|
71
|
+
IO.write(@path, contents, **open_args)
|
72
72
|
end
|
73
73
|
else
|
74
74
|
def append(contents, *open_args)
|
data/lib/path/predicates.rb
CHANGED
data/lib/path/version.rb
CHANGED
data/path.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: path
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- eregon
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Path is a library to easily manage paths and with a lot of extra goodness.
|
14
14
|
email: eregontp@gmail.com
|
@@ -38,7 +38,7 @@ homepage: https://github.com/eregon/path
|
|
38
38
|
licenses:
|
39
39
|
- MIT
|
40
40
|
metadata: {}
|
41
|
-
post_install_message:
|
41
|
+
post_install_message:
|
42
42
|
rdoc_options: []
|
43
43
|
require_paths:
|
44
44
|
- lib
|
@@ -46,16 +46,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 2.6.0
|
50
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
requirements: []
|
56
|
-
|
57
|
-
|
58
|
-
signing_key:
|
56
|
+
rubygems_version: 3.3.26
|
57
|
+
signing_key:
|
59
58
|
specification_version: 4
|
60
59
|
summary: The Path manipulation library
|
61
60
|
test_files: []
|