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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 60cfd69ac4a3518dcbcf8784282be2f8af06e695
4
- data.tar.gz: 799af180a02aad1474adfc4d16cd97882f105aee
2
+ SHA256:
3
+ metadata.gz: efcdf8c91dddaf7c18d7d833a664da77428c72f354bc73fbc89d9fb1d2fe4eb8
4
+ data.tar.gz: 9e1dea71086a4eb45b6aac1ad91c417432820985a2cdd222e77f1dc458fee1d7
5
5
  SHA512:
6
- metadata.gz: f341205f30d2c2871f81dc5b1b4d295839df5eb2276a6351325c95ff31dbd91b38fd04d24d6a250d4ea6d1fb79231b288b3ff80924ab8900b0fddae0c46ae3bd
7
- data.tar.gz: 4aa31494bde760d396677e0ffb55fd9846ce844672d0f643f7b962ad50e25d5f103fb862b25a42b1786633cb1e2c18d54585ad1c0da39be047b9430251c5bca9
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
- [![Gem Version](https://badge.fury.io/rb/path.png)](https://rubygems.org/gems/path)
4
- [![Build Status](https://travis-ci.org/eregon/path.svg?branch=master)](https://travis-ci.org/eregon/path)
5
- [![Build Status](https://ci.appveyor.com/api/projects/status/jg6fx1692mw8mu58/branch/master?svg=true)](https://ci.appveyor.com/project/eregon/path/branch/master)
3
+ [![Gem Version](https://badge.fury.io/rb/path.svg)](https://rubygems.org/gems/path)
4
+ [![CI](https://github.com/eregon/path/actions/workflows/ci.yml/badge.svg)](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. By default, the returned
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]
@@ -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+.
@@ -133,7 +133,6 @@ class Path
133
133
  def init
134
134
  @path = validate(@path)
135
135
 
136
- taint if @path.tainted?
137
136
  @path.freeze
138
137
  freeze
139
138
  end
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 !RUBY_DESCRIPTION.start_with?('jruby')
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)
@@ -30,4 +30,9 @@ class Path
30
30
  false
31
31
  end
32
32
  end
33
+
34
+ # Whether this is a hidden path, i.e. starting with a dot.
35
+ def hidden?
36
+ basename.to_s.start_with?('.')
37
+ end
33
38
  end
data/lib/path/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Path
2
2
  # The version of the gem.
3
3
  # Set here to avoid duplication and allow introspection.
4
- VERSION = '2.0.1'
4
+ VERSION = '2.1.0'
5
5
  end
data/path.gemspec CHANGED
@@ -10,4 +10,5 @@ Gem::Specification.new do |s|
10
10
  s.files = Dir['lib/**/*.rb'] + %w[README.md LICENSE path.gemspec]
11
11
  s.licenses = ['MIT']
12
12
  s.version = Path::VERSION
13
+ s.required_ruby_version = '>= 2.6.0'
13
14
  end
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.1
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: 2016-11-13 00:00:00.000000000 Z
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: '0'
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
- rubyforge_project:
57
- rubygems_version: 2.4.5
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: []