fileutils 1.4.1 → 1.5.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/Rakefile +7 -0
- data/fileutils.gemspec +1 -1
- data/lib/fileutils.rb +22 -13
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67fa33577498dff5705331ce6453a3c11ff34d209343310f647d4cb404158617
|
4
|
+
data.tar.gz: 4608e153f0c69749fbf7e4d456388c44fdba1a3a99f5b328c71c283ccd7ca5a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db0b5ce907f782c5ba306ca0a8811c825ec1f97a47731ccc08b2ddc7e13160d7d40986afd1b744cef7b941b2bef2f1c1c4017eb8fc616e8695b506d5ce8cc8ae
|
7
|
+
data.tar.gz: ccbb52c0a277e03e29dfff22e5bb26b3dc30e7ede6db803f130047bb039cb12161d7f3ecafac5f0956959fde6276b16c68085f30be7c8edae019e7d313301b53
|
data/Rakefile
CHANGED
@@ -9,4 +9,11 @@ Rake::TestTask.new(:test) do |t|
|
|
9
9
|
t.test_files = FileList["test/**/test_*.rb"]
|
10
10
|
end
|
11
11
|
|
12
|
+
task :sync_tool do
|
13
|
+
require 'fileutils'
|
14
|
+
FileUtils.cp "../ruby/tool/lib/test/unit/core_assertions.rb", "./test/lib"
|
15
|
+
FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib"
|
16
|
+
FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib"
|
17
|
+
end
|
18
|
+
|
12
19
|
task :default => :test
|
data/fileutils.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.authors = ["Minero Aoki"]
|
24
24
|
s.email = [nil]
|
25
25
|
s.homepage = "https://github.com/ruby/fileutils"
|
26
|
-
s.
|
26
|
+
s.licenses = ["Ruby", "BSD-2-Clause"]
|
27
27
|
|
28
28
|
s.metadata = {
|
29
29
|
"source_code_uri" => "https://github.com/ruby/fileutils"
|
data/lib/fileutils.rb
CHANGED
@@ -102,7 +102,7 @@ end
|
|
102
102
|
# <tt>:verbose</tt> flags to methods in FileUtils.
|
103
103
|
#
|
104
104
|
module FileUtils
|
105
|
-
VERSION = "1.
|
105
|
+
VERSION = "1.5.0"
|
106
106
|
|
107
107
|
def self.private_module_function(name) #:nodoc:
|
108
108
|
module_function name
|
@@ -208,7 +208,9 @@ module FileUtils
|
|
208
208
|
fu_output_message "mkdir -p #{mode ? ('-m %03o ' % mode) : ''}#{list.join ' '}" if verbose
|
209
209
|
return *list if noop
|
210
210
|
|
211
|
-
list.
|
211
|
+
list.each do |item|
|
212
|
+
path = remove_trailing_slash(item)
|
213
|
+
|
212
214
|
# optimize for the most common case
|
213
215
|
begin
|
214
216
|
fu_mkdir path, mode
|
@@ -221,8 +223,9 @@ module FileUtils
|
|
221
223
|
until path == stack.last # dirname("/")=="/", dirname("C:/")=="C:/"
|
222
224
|
stack.push path
|
223
225
|
path = File.dirname(path)
|
226
|
+
break if File.directory?(path)
|
224
227
|
end
|
225
|
-
stack.pop
|
228
|
+
stack.pop if path == stack.last # root directory should exist
|
226
229
|
stack.reverse_each do |dir|
|
227
230
|
begin
|
228
231
|
fu_mkdir dir, mode
|
@@ -917,11 +920,8 @@ module FileUtils
|
|
917
920
|
private_module_function :apply_mask
|
918
921
|
|
919
922
|
def symbolic_modes_to_i(mode_sym, path) #:nodoc:
|
920
|
-
|
921
|
-
|
922
|
-
else
|
923
|
-
File.stat(path).mode
|
924
|
-
end
|
923
|
+
path = File.stat(path) unless File::Stat === path
|
924
|
+
mode = path.mode
|
925
925
|
mode_sym.split(/,/).inject(mode & 07777) do |current_mode, clause|
|
926
926
|
target, *actions = clause.split(/([=+-])/)
|
927
927
|
raise ArgumentError, "invalid file mode: #{mode_sym}" if actions.empty?
|
@@ -938,7 +938,7 @@ module FileUtils
|
|
938
938
|
when "x"
|
939
939
|
mask | 0111
|
940
940
|
when "X"
|
941
|
-
if
|
941
|
+
if path.directory?
|
942
942
|
mask | 0111
|
943
943
|
else
|
944
944
|
mask
|
@@ -1290,7 +1290,7 @@ module FileUtils
|
|
1290
1290
|
|
1291
1291
|
def entries
|
1292
1292
|
opts = {}
|
1293
|
-
opts[:encoding] = ::Encoding::UTF_8
|
1293
|
+
opts[:encoding] = fu_windows? ? ::Encoding::UTF_8 : path.encoding
|
1294
1294
|
|
1295
1295
|
files = if Dir.respond_to?(:children)
|
1296
1296
|
Dir.children(path, **opts)
|
@@ -1345,6 +1345,7 @@ module FileUtils
|
|
1345
1345
|
else
|
1346
1346
|
File.chmod mode, path()
|
1347
1347
|
end
|
1348
|
+
rescue Errno::EOPNOTSUPP
|
1348
1349
|
end
|
1349
1350
|
|
1350
1351
|
def chown(uid, gid)
|
@@ -1439,7 +1440,7 @@ module FileUtils
|
|
1439
1440
|
if st.symlink?
|
1440
1441
|
begin
|
1441
1442
|
File.lchmod mode, path
|
1442
|
-
rescue NotImplementedError
|
1443
|
+
rescue NotImplementedError, Errno::EOPNOTSUPP
|
1443
1444
|
end
|
1444
1445
|
else
|
1445
1446
|
File.chmod mode, path
|
@@ -1559,7 +1560,15 @@ module FileUtils
|
|
1559
1560
|
def join(dir, base)
|
1560
1561
|
return File.path(dir) if not base or base == '.'
|
1561
1562
|
return File.path(base) if not dir or dir == '.'
|
1562
|
-
|
1563
|
+
begin
|
1564
|
+
File.join(dir, base)
|
1565
|
+
rescue EncodingError
|
1566
|
+
if fu_windows?
|
1567
|
+
File.join(dir.encode(::Encoding::UTF_8), base.encode(::Encoding::UTF_8))
|
1568
|
+
else
|
1569
|
+
raise
|
1570
|
+
end
|
1571
|
+
end
|
1563
1572
|
end
|
1564
1573
|
|
1565
1574
|
if File::ALT_SEPARATOR
|
@@ -1614,7 +1623,7 @@ module FileUtils
|
|
1614
1623
|
|
1615
1624
|
def fu_output_message(msg) #:nodoc:
|
1616
1625
|
output = @fileutils_output if defined?(@fileutils_output)
|
1617
|
-
output ||= $
|
1626
|
+
output ||= $stdout
|
1618
1627
|
if defined?(@fileutils_label)
|
1619
1628
|
msg = @fileutils_label + msg
|
1620
1629
|
end
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fileutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minero Aoki
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Several file utility methods for copying, moving, removing, etc.
|
14
14
|
email:
|
15
|
-
-
|
15
|
+
-
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
@@ -24,10 +24,11 @@ files:
|
|
24
24
|
- lib/fileutils.rb
|
25
25
|
homepage: https://github.com/ruby/fileutils
|
26
26
|
licenses:
|
27
|
+
- Ruby
|
27
28
|
- BSD-2-Clause
|
28
29
|
metadata:
|
29
30
|
source_code_uri: https://github.com/ruby/fileutils
|
30
|
-
post_install_message:
|
31
|
+
post_install_message:
|
31
32
|
rdoc_options: []
|
32
33
|
require_paths:
|
33
34
|
- lib
|
@@ -42,8 +43,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
43
|
- !ruby/object:Gem::Version
|
43
44
|
version: '0'
|
44
45
|
requirements: []
|
45
|
-
rubygems_version: 3.
|
46
|
-
signing_key:
|
46
|
+
rubygems_version: 3.2.2
|
47
|
+
signing_key:
|
47
48
|
specification_version: 4
|
48
49
|
summary: Several file utility methods for copying, moving, removing, etc.
|
49
50
|
test_files: []
|