dry-files 1.0.2 → 1.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 +4 -4
- data/CHANGELOG.md +12 -1
- data/lib/dry/files/file_system.rb +19 -0
- data/lib/dry/files/version.rb +1 -1
- data/lib/dry/files.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73391c6f7e4e115941911686c45307707e68fa4ba0f4be5a7cebba14d7eeb042
|
4
|
+
data.tar.gz: dcd71ad5b06891df556f0146f2520e4b981024afa06291016e56b194a4f1fb2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 392bfc69636d993cd92e8462079079ad000ef6ebe60467eee72d30f9e2726fc04705f05ada482cfe0147320abab56afd91b6b782b25e9f3a042c563590d589fd
|
7
|
+
data.tar.gz: 7c3a4723b89339db36f532f7579f6574c593864e6a79cecfc5cc382280d421338fdd2700c1edffb6fb83b5d917102a2c5be63306f2833c555d5250f0a8d9c1da
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,22 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
+
## 1.1.0 2023-10-18
|
4
|
+
|
5
|
+
|
6
|
+
### Added
|
7
|
+
|
8
|
+
- Add `Dry::Files#chmod(path, mode)` to modify file permissions. Provide the mode as an integer
|
9
|
+
to match UNIX octal permissions, such as `0o755`. (@timriley in #18)
|
10
|
+
|
11
|
+
|
12
|
+
[Compare v1.0.2...v1.1.0](https://github.com/dry-rb/dry-files/compare/v1.0.2...v1.1.0)
|
13
|
+
|
3
14
|
## 1.0.2 2023-10-03
|
4
15
|
|
5
16
|
|
6
17
|
### Fixed
|
7
18
|
|
8
|
-
- Ensure Dry::Files#inject_line_at_block_bottom to not match false positive closing blocks (@jodosha in #17)
|
19
|
+
- Ensure `Dry::Files#inject_line_at_block_bottom` to not match false positive closing blocks (@jodosha in #17)
|
9
20
|
|
10
21
|
|
11
22
|
[Compare v1.0.1...v1.0.2](https://github.com/dry-rb/dry-files/compare/v1.0.1...v1.0.2)
|
@@ -131,6 +131,25 @@ module Dry
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
+
# Sets UNIX permissions of the file at the given path.
|
135
|
+
#
|
136
|
+
# Accepts permissions in numeric mode only, best provided as octal numbers matching the
|
137
|
+
# standard UNIX octal permission modes, such as `0o544` for a file writeable by its owner and
|
138
|
+
# readable by others, or `0o755` for a file writeable by its owner and executable by everyone.
|
139
|
+
#
|
140
|
+
# @param path [String,Pathname] the path to the file
|
141
|
+
# @param mode [Integer] the UNIX permissions mode
|
142
|
+
#
|
143
|
+
# @raise [Dry::Files::IOError] in case of I/O error
|
144
|
+
#
|
145
|
+
# @since 1.1.0
|
146
|
+
# @api private
|
147
|
+
def chmod(path, mode)
|
148
|
+
with_error_handling do
|
149
|
+
file_utils.chmod(mode, path)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
134
153
|
# Returns a new string formed by joining the strings using Operating
|
135
154
|
# System path separator
|
136
155
|
#
|
data/lib/dry/files/version.rb
CHANGED
data/lib/dry/files.rb
CHANGED
@@ -82,6 +82,25 @@ module Dry
|
|
82
82
|
adapter.write(path, *content)
|
83
83
|
end
|
84
84
|
|
85
|
+
# Sets UNIX permissions of the file at the given path.
|
86
|
+
#
|
87
|
+
# Accepts permissions in numeric mode only, best provided as octal numbers matching the
|
88
|
+
# standard UNIX octal permission modes, such as `0o544` for a file writeable by its owner and
|
89
|
+
# readable by others, or `0o755` for a file writeable by its owner and executable by everyone.
|
90
|
+
#
|
91
|
+
# @param path [String,Pathname] the path to the file
|
92
|
+
# @param mode [Integer] the UNIX permissions mode
|
93
|
+
#
|
94
|
+
# @raise [Dry::Files::IOError] in case of I/O error
|
95
|
+
#
|
96
|
+
# @since 1.1.0
|
97
|
+
# @api public
|
98
|
+
def chmod(path, mode)
|
99
|
+
raise Dry::Files::Error, "mode should be an integer (e.g. 0o755)" unless mode.is_a?(Integer)
|
100
|
+
|
101
|
+
adapter.chmod(path, mode)
|
102
|
+
end
|
103
|
+
|
85
104
|
# Returns a new string formed by joining the strings using Operating
|
86
105
|
# System path separator
|
87
106
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|