pleasant_path 2.0.0 → 3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf7518ec3e9771e1feeea6211f4aa6e60804166a861d83d481d1a6eb9275874f
4
- data.tar.gz: d227b85723683286ee43921625b68e08cfeb656443d4e7ee90d2ff3538f7f817
3
+ metadata.gz: 5e772187275bf4dea8ba22a68a973e127586a5b9c212cd47bfcf38269c8c5f66
4
+ data.tar.gz: 59e4a89da059811da874ed435c8b060e4fab05ce22765a7bf3c3a122063e7edd
5
5
  SHA512:
6
- metadata.gz: 12c3fff1b2a1cd134c10176cca26b3d7cf0c8722fa1e3925fa7805bbc652a8886b98bd5d15df96d23609016090339a8088f31f0b66a7444c3af2d1d37b808e1d
7
- data.tar.gz: e6d990d3271a9b89e3ae68b31e06c7a520f75b12d0a0baf2a528985551bed69f6700d012d395f91c0577ed769e736ac853373b0088c0097f4c033e58aa1770fe
6
+ metadata.gz: 0f23bc5959b08ea5bd2a803ccf42379ce9229d6ab6624c8b2c2f7d287d18861e9b868c5e232fd703fc8a759381a4a1b69851efc2341293ec90fee7c61ab2818a
7
+ data.tar.gz: 6a98f6d9ba1f9b2cba59623b3124deb7b978eb63e0fe9e37b45930541feae2cba04113e1cae4cfcbc102dbecc5212736be218de396ddf4f79805b3c61971f8f6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 3.0.0
2
+
3
+ * [BREAKING] Drop support for Ruby < 3.4
4
+ * [BREAKING] Require `json` >= 2.11
5
+
6
+
1
7
  ## 2.0.0
2
8
 
3
9
  * [BREAKING] Drop support for Ruby < 2.6
data/Gemfile CHANGED
@@ -3,5 +3,6 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in pleasant_path.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 12.0"
7
- gem "minitest", "~> 5.0"
6
+ gem "rake", "~> 13.0"
7
+ gem "minitest", "~> 6.0"
8
+ gem "ostruct"
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # pleasant_path [![Build Status](https://travis-ci.org/jonathanhefner/pleasant_path.svg?branch=master)](https://travis-ci.org/jonathanhefner/pleasant_path)
1
+ # pleasant_path
2
2
 
3
- A [fluent API] for pleasant file IO, written as extensions to core Ruby
4
- objects. See API listing below, or browse the [full documentation].
3
+ A [fluent API][] for pleasant file IO, written as extensions to core
4
+ Ruby objects. See API listing below, or browse the [full documentation][].
5
5
 
6
6
  [fluent API]: https://en.wikipedia.org/wiki/Fluent_interface
7
7
  [full documentation]: https://www.rubydoc.info/gems/pleasant_path/
@@ -22,68 +22,68 @@ objects. See API listing below, or browse the [full documentation].
22
22
 
23
23
  The following methods are available:
24
24
 
25
- - [Pathname](https://www.rubydoc.info/gems/pleasant_path/Pathname)
26
- - [::NULL](https://www.rubydoc.info/gems/pleasant_path/Pathname#NULL-constant)
27
- - [#^](https://www.rubydoc.info/gems/pleasant_path/Pathname:%5E)
28
- - [#append_file](https://www.rubydoc.info/gems/pleasant_path/Pathname:append_file)
29
- - [#append_lines](https://www.rubydoc.info/gems/pleasant_path/Pathname:append_lines)
30
- - [#append_text](https://www.rubydoc.info/gems/pleasant_path/Pathname:append_text)
31
- - [#available_name](https://www.rubydoc.info/gems/pleasant_path/Pathname:available_name)
32
- - [#chdir](https://www.rubydoc.info/gems/pleasant_path/Pathname:chdir)
33
- - [#common_path](https://www.rubydoc.info/gems/pleasant_path/Pathname:common_path)
34
- - [#copy](https://www.rubydoc.info/gems/pleasant_path/Pathname:copy)
35
- - [#copy_as](https://www.rubydoc.info/gems/pleasant_path/Pathname:copy_as)
36
- - [#copy_into](https://www.rubydoc.info/gems/pleasant_path/Pathname:copy_into)
37
- - [#delete!](https://www.rubydoc.info/gems/pleasant_path/Pathname:delete%21)
38
- - [#dir?](https://www.rubydoc.info/gems/pleasant_path/Pathname:dir%3F)
39
- - [#dirs](https://www.rubydoc.info/gems/pleasant_path/Pathname:dirs)
40
- - [#dirs_r](https://www.rubydoc.info/gems/pleasant_path/Pathname:dirs_r)
41
- - [#edit_lines](https://www.rubydoc.info/gems/pleasant_path/Pathname:edit_lines)
42
- - [#edit_text](https://www.rubydoc.info/gems/pleasant_path/Pathname:edit_text)
43
- - [#existence](https://www.rubydoc.info/gems/pleasant_path/Pathname:existence)
44
- - [#files](https://www.rubydoc.info/gems/pleasant_path/Pathname:files)
45
- - [#files_r](https://www.rubydoc.info/gems/pleasant_path/Pathname:files_r)
46
- - [#find_dirs](https://www.rubydoc.info/gems/pleasant_path/Pathname:find_dirs)
47
- - [#find_files](https://www.rubydoc.info/gems/pleasant_path/Pathname:find_files)
48
- - [#make_dir](https://www.rubydoc.info/gems/pleasant_path/Pathname:make_dir)
49
- - [#make_dirname](https://www.rubydoc.info/gems/pleasant_path/Pathname:make_dirname)
50
- - [#make_file](https://www.rubydoc.info/gems/pleasant_path/Pathname:make_file)
51
- - [#move](https://www.rubydoc.info/gems/pleasant_path/Pathname:move)
52
- - [#move_as](https://www.rubydoc.info/gems/pleasant_path/Pathname:move_as)
53
- - [#move_into](https://www.rubydoc.info/gems/pleasant_path/Pathname:move_into)
54
- - [#parentname](https://www.rubydoc.info/gems/pleasant_path/Pathname:parentname)
55
- - [#read_lines](https://www.rubydoc.info/gems/pleasant_path/Pathname:read_lines)
56
- - [#rename_basename](https://www.rubydoc.info/gems/pleasant_path/Pathname:rename_basename)
57
- - [#rename_extname](https://www.rubydoc.info/gems/pleasant_path/Pathname:rename_extname)
58
- - [#to_pathname](https://www.rubydoc.info/gems/pleasant_path/Pathname:to_pathname)
59
- - [#write_lines](https://www.rubydoc.info/gems/pleasant_path/Pathname:write_lines)
60
- - [#write_text](https://www.rubydoc.info/gems/pleasant_path/Pathname:write_text)
61
- - [String](https://www.rubydoc.info/gems/pleasant_path/String)
62
- - [#/](https://www.rubydoc.info/gems/pleasant_path/String:%2F)
63
- - [#append_to_file](https://www.rubydoc.info/gems/pleasant_path/String:append_to_file)
64
- - [#path](https://www.rubydoc.info/gems/pleasant_path/String:path)
65
- - [#to_pathname](https://www.rubydoc.info/gems/pleasant_path/String:to_pathname)
66
- - [#write_to_file](https://www.rubydoc.info/gems/pleasant_path/String:write_to_file)
67
- - [Enumerable](https://www.rubydoc.info/gems/pleasant_path/Enumerable)
68
- - [#append_to_file](https://www.rubydoc.info/gems/pleasant_path/Enumerable:append_to_file)
69
- - [#write_to_file](https://www.rubydoc.info/gems/pleasant_path/Enumerable:write_to_file)
70
- - [File](https://www.rubydoc.info/gems/pleasant_path/File)
71
- - [.common_path](https://www.rubydoc.info/gems/pleasant_path/File.common_path)
72
- - [.edit_lines](https://www.rubydoc.info/gems/pleasant_path/File.edit_lines)
73
- - [.edit_text](https://www.rubydoc.info/gems/pleasant_path/File.edit_text)
74
- - [IO](https://www.rubydoc.info/gems/pleasant_path/IO)
75
- - [#read_lines](https://www.rubydoc.info/gems/pleasant_path/IO:read_lines)
76
- - [#write_lines](https://www.rubydoc.info/gems/pleasant_path/IO:write_lines)
25
+ - [`Pathname`](https://www.rubydoc.info/gems/pleasant_path/Pathname)
26
+ - [`::NULL`](https://www.rubydoc.info/gems/pleasant_path/Pathname#NULL-constant)
27
+ - [`#^`](https://www.rubydoc.info/gems/pleasant_path/Pathname:%5E)
28
+ - [`#append_file`](https://www.rubydoc.info/gems/pleasant_path/Pathname:append_file)
29
+ - [`#append_lines`](https://www.rubydoc.info/gems/pleasant_path/Pathname:append_lines)
30
+ - [`#append_text`](https://www.rubydoc.info/gems/pleasant_path/Pathname:append_text)
31
+ - [`#available_name`](https://www.rubydoc.info/gems/pleasant_path/Pathname:available_name)
32
+ - [`#chdir`](https://www.rubydoc.info/gems/pleasant_path/Pathname:chdir)
33
+ - [`#common_path`](https://www.rubydoc.info/gems/pleasant_path/Pathname:common_path)
34
+ - [`#copy`](https://www.rubydoc.info/gems/pleasant_path/Pathname:copy)
35
+ - [`#copy_as`](https://www.rubydoc.info/gems/pleasant_path/Pathname:copy_as)
36
+ - [`#copy_into`](https://www.rubydoc.info/gems/pleasant_path/Pathname:copy_into)
37
+ - [`#delete!`](https://www.rubydoc.info/gems/pleasant_path/Pathname:delete%21)
38
+ - [`#dir?`](https://www.rubydoc.info/gems/pleasant_path/Pathname:dir%3F)
39
+ - [`#dirs`](https://www.rubydoc.info/gems/pleasant_path/Pathname:dirs)
40
+ - [`#dirs_r`](https://www.rubydoc.info/gems/pleasant_path/Pathname:dirs_r)
41
+ - [`#edit_lines`](https://www.rubydoc.info/gems/pleasant_path/Pathname:edit_lines)
42
+ - [`#edit_text`](https://www.rubydoc.info/gems/pleasant_path/Pathname:edit_text)
43
+ - [`#existence`](https://www.rubydoc.info/gems/pleasant_path/Pathname:existence)
44
+ - [`#files`](https://www.rubydoc.info/gems/pleasant_path/Pathname:files)
45
+ - [`#files_r`](https://www.rubydoc.info/gems/pleasant_path/Pathname:files_r)
46
+ - [`#find_dirs`](https://www.rubydoc.info/gems/pleasant_path/Pathname:find_dirs)
47
+ - [`#find_files`](https://www.rubydoc.info/gems/pleasant_path/Pathname:find_files)
48
+ - [`#make_dir`](https://www.rubydoc.info/gems/pleasant_path/Pathname:make_dir)
49
+ - [`#make_dirname`](https://www.rubydoc.info/gems/pleasant_path/Pathname:make_dirname)
50
+ - [`#make_file`](https://www.rubydoc.info/gems/pleasant_path/Pathname:make_file)
51
+ - [`#move`](https://www.rubydoc.info/gems/pleasant_path/Pathname:move)
52
+ - [`#move_as`](https://www.rubydoc.info/gems/pleasant_path/Pathname:move_as)
53
+ - [`#move_into`](https://www.rubydoc.info/gems/pleasant_path/Pathname:move_into)
54
+ - [`#parentname`](https://www.rubydoc.info/gems/pleasant_path/Pathname:parentname)
55
+ - [`#read_lines`](https://www.rubydoc.info/gems/pleasant_path/Pathname:read_lines)
56
+ - [`#rename_basename`](https://www.rubydoc.info/gems/pleasant_path/Pathname:rename_basename)
57
+ - [`#rename_extname`](https://www.rubydoc.info/gems/pleasant_path/Pathname:rename_extname)
58
+ - [`#to_pathname`](https://www.rubydoc.info/gems/pleasant_path/Pathname:to_pathname)
59
+ - [`#write_lines`](https://www.rubydoc.info/gems/pleasant_path/Pathname:write_lines)
60
+ - [`#write_text`](https://www.rubydoc.info/gems/pleasant_path/Pathname:write_text)
61
+ - [`String`](https://www.rubydoc.info/gems/pleasant_path/String)
62
+ - [`#/`](https://www.rubydoc.info/gems/pleasant_path/String:%2F)
63
+ - [`#append_to_file`](https://www.rubydoc.info/gems/pleasant_path/String:append_to_file)
64
+ - [`#path`](https://www.rubydoc.info/gems/pleasant_path/String:path)
65
+ - [`#to_pathname`](https://www.rubydoc.info/gems/pleasant_path/String:to_pathname)
66
+ - [`#write_to_file`](https://www.rubydoc.info/gems/pleasant_path/String:write_to_file)
67
+ - [`Enumerable`](https://www.rubydoc.info/gems/pleasant_path/Enumerable)
68
+ - [`#append_to_file`](https://www.rubydoc.info/gems/pleasant_path/Enumerable:append_to_file)
69
+ - [`#write_to_file`](https://www.rubydoc.info/gems/pleasant_path/Enumerable:write_to_file)
70
+ - [`File`](https://www.rubydoc.info/gems/pleasant_path/File)
71
+ - [`.common_path`](https://www.rubydoc.info/gems/pleasant_path/File.common_path)
72
+ - [`.edit_lines`](https://www.rubydoc.info/gems/pleasant_path/File.edit_lines)
73
+ - [`.edit_text`](https://www.rubydoc.info/gems/pleasant_path/File.edit_text)
74
+ - [`IO`](https://www.rubydoc.info/gems/pleasant_path/IO)
75
+ - [`#read_lines`](https://www.rubydoc.info/gems/pleasant_path/IO:read_lines)
76
+ - [`#write_lines`](https://www.rubydoc.info/gems/pleasant_path/IO:write_lines)
77
77
 
78
78
 
79
79
  ## JSON-related and YAML-related API
80
80
 
81
- *pleasant_path* also includes methods for interacting with JSON and YAML
82
- files, using the [JSON module] and [YAML module] that are part of Ruby's
83
- standard library. Because Ruby does not load these modules by default,
84
- *pleasant_path* does not load its JSON-related and YAML-related API by
85
- default either. To load these *pleasant_path* APIs **and** the relevant
86
- standard library modules, use:
81
+ `pleasant_path` also includes methods for interacting with JSON and YAML
82
+ files, using the [JSON module][] and [YAML module][] that are part of
83
+ Ruby's standard library. Because Ruby does not load these modules by
84
+ default, `pleasant_path` does not load its JSON-related and YAML-related
85
+ API by default either. To load these `pleasant_path` APIs **and** the
86
+ relevant standard library modules, use:
87
87
 
88
88
  ```ruby
89
89
  require "pleasant_path/json"
@@ -95,29 +95,19 @@ require "pleasant_path/yaml"
95
95
 
96
96
  The following methods are available:
97
97
 
98
- - Object
99
- - [write_to_json](https://www.rubydoc.info/gems/pleasant_path/Object:write_to_json)
100
- - [write_to_yaml](https://www.rubydoc.info/gems/pleasant_path/Object:write_to_yaml)
101
- - Pathname
102
- - [load_json](https://www.rubydoc.info/gems/pleasant_path/Pathname:load_json)
103
- - [load_yaml](https://www.rubydoc.info/gems/pleasant_path/Pathname:load_yaml)
104
- - [read_json](https://www.rubydoc.info/gems/pleasant_path/Pathname:read_json)
105
- - [read_yaml](https://www.rubydoc.info/gems/pleasant_path/Pathname:read_yaml)
98
+ - `Object`
99
+ - [`write_to_json`](https://www.rubydoc.info/gems/pleasant_path/Object:write_to_json)
100
+ - [`write_to_yaml`](https://www.rubydoc.info/gems/pleasant_path/Object:write_to_yaml)
101
+ - `Pathname`
102
+ - [`load_json`](https://www.rubydoc.info/gems/pleasant_path/Pathname:load_json)
103
+ - [`load_yaml`](https://www.rubydoc.info/gems/pleasant_path/Pathname:load_yaml)
104
+ - [`read_json`](https://www.rubydoc.info/gems/pleasant_path/Pathname:read_json)
105
+ - [`read_yaml`](https://www.rubydoc.info/gems/pleasant_path/Pathname:read_yaml)
106
106
 
107
107
 
108
108
  ## Installation
109
109
 
110
- Install the [gem](https://rubygems.org/gems/pleasant_path):
111
-
112
- ```bash
113
- $ gem install pleasant_path
114
- ```
115
-
116
- Then require in your Ruby code:
117
-
118
- ```ruby
119
- require "pleasant_path"
120
- ```
110
+ Install the [`pleasant_path` gem](https://rubygems.org/gems/pleasant_path).
121
111
 
122
112
 
123
113
  ## Contributing
@@ -127,4 +117,4 @@ Run `rake test` to run the tests.
127
117
 
128
118
  ## License
129
119
 
130
- [MIT License](https://opensource.org/licenses/MIT)
120
+ [MIT License](LICENSE.txt)
@@ -7,9 +7,9 @@ class Object
7
7
  #
8
8
  # For information about +options+ see
9
9
  # {https://docs.ruby-lang.org/en/master/JSON.html#method-i-generate
10
- # +JSON.generate+}. By default, this method uses
11
- # {https://docs.ruby-lang.org/en/master/JSON.html#attribute-c-dump_default_options
12
- # +JSON.dump_default_options+}.
10
+ # +JSON.generate+}. By default, this method uses the default options
11
+ # for {https://docs.ruby-lang.org/en/master/JSON.html#method-i-dump
12
+ # +JSON.dump+}.
13
13
  #
14
14
  # @example
15
15
  # { "key" => "value" }.write_to_json("file.json") # == { "key" => "value" }
@@ -19,8 +19,7 @@ class Object
19
19
  # @param options [Hash{Symbol => Object}]
20
20
  # @return [self]
21
21
  def write_to_json(file, options = {})
22
- options = JSON.dump_default_options.merge(options)
23
- file.to_pathname.write_text(self.to_json(options))
22
+ file.to_pathname.write_text(JSON.dump(self, nil, nil, options))
24
23
  self
25
24
  end
26
25
 
@@ -50,7 +50,7 @@ class Pathname
50
50
  # @param options [Hash{Symbol => Object}]
51
51
  # @return [Object]
52
52
  def load_json(options = {})
53
- JSON.load(self, nil, options)
53
+ JSON.load(self, nil, { create_additions: true, **options })
54
54
  end
55
55
 
56
56
  end
@@ -1,3 +1,3 @@
1
1
  module PleasantPath
2
- VERSION = "2.0.0"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -14,7 +14,7 @@ class Pathname
14
14
  #
15
15
  # @return [nil, true, false, Numeric, String, Array, Hash]
16
16
  def read_yaml
17
- self.open("r"){|f| YAML.safe_load(f, filename: self) }
17
+ YAML.safe_load_file(self)
18
18
  end
19
19
 
20
20
  # Reads the file indicated by the Pathname, and parses the contents as
@@ -31,7 +31,7 @@ class Pathname
31
31
  #
32
32
  # @return [Object]
33
33
  def load_yaml
34
- YAML.load_file(self)
34
+ YAML.unsafe_load_file(self)
35
35
  end
36
36
 
37
37
  end
@@ -6,21 +6,22 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["Jonathan Hefner"]
7
7
  spec.email = ["jonathan@hefner.pro"]
8
8
 
9
- spec.summary = %q{A fluent API for pleasant file IO.}
9
+ spec.summary = %q{Fluent API for pleasant file IO}
10
10
  spec.homepage = "https://github.com/jonathanhefner/pleasant_path"
11
11
  spec.license = "MIT"
12
- spec.required_ruby_version = ">= 2.6"
12
+ spec.required_ruby_version = ">= 3.4"
13
13
 
14
- spec.metadata["homepage_uri"] = spec.homepage
15
14
  spec.metadata["source_code_uri"] = spec.homepage
16
15
  spec.metadata["changelog_uri"] = spec.metadata["source_code_uri"] + "/blob/master/CHANGELOG.md"
17
16
 
18
17
  # Specify which files should be added to the gem when it is released.
19
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
19
  spec.files = Dir.chdir(__dir__) do
21
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ `git ls-files -z`.split("\x0").reject { |f| f.start_with?("test/", ".git") }
22
21
  end
23
22
  spec.bindir = "exe"
24
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
24
  spec.require_paths = ["lib"]
25
+
26
+ spec.add_dependency "json", ">= 2.11"
26
27
  end
metadata CHANGED
@@ -1,24 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pleasant_path
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hefner
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2020-02-02 00:00:00.000000000 Z
12
- dependencies: []
13
- description:
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: json
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '2.11'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '2.11'
14
26
  email:
15
27
  - jonathan@hefner.pro
16
28
  executables: []
17
29
  extensions: []
18
30
  extra_rdoc_files: []
19
31
  files:
20
- - ".gitignore"
21
- - ".travis.yml"
22
32
  - CHANGELOG.md
23
33
  - Gemfile
24
34
  - LICENSE.txt
@@ -42,10 +52,8 @@ homepage: https://github.com/jonathanhefner/pleasant_path
42
52
  licenses:
43
53
  - MIT
44
54
  metadata:
45
- homepage_uri: https://github.com/jonathanhefner/pleasant_path
46
55
  source_code_uri: https://github.com/jonathanhefner/pleasant_path
47
56
  changelog_uri: https://github.com/jonathanhefner/pleasant_path/blob/master/CHANGELOG.md
48
- post_install_message:
49
57
  rdoc_options: []
50
58
  require_paths:
51
59
  - lib
@@ -53,15 +61,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
61
  requirements:
54
62
  - - ">="
55
63
  - !ruby/object:Gem::Version
56
- version: '2.6'
64
+ version: '3.4'
57
65
  required_rubygems_version: !ruby/object:Gem::Requirement
58
66
  requirements:
59
67
  - - ">="
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  requirements: []
63
- rubygems_version: 3.1.2
64
- signing_key:
71
+ rubygems_version: 4.0.10
65
72
  specification_version: 4
66
- summary: A fluent API for pleasant file IO.
73
+ summary: Fluent API for pleasant file IO
67
74
  test_files: []
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.6
5
- - 2.7