fileutils 1.3.0 → 1.6.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 +10 -5
- data/fileutils.gemspec +15 -14
- data/lib/fileutils.rb +25 -36
- metadata +9 -9
- data/lib/fileutils/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd9bb18e0c2796f76aaa3913228a54edac666e5130c8649a072d2c9f5304f4ce
|
4
|
+
data.tar.gz: e61f982bf90db5263eacb09ba03bd8aa0c2bc91c52b54eb0e8de08388955d28d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb8942b3111aec98133788f8088511a90b9eab067a563676ccf348a567504b4ae2b858c0bebb376bdb6bd5847be1e8cd8171a2a8cd654480686c8065846acff6
|
7
|
+
data.tar.gz: 11e481aff9fd2b505b5b97b6783c4b93fd9509a6f5cac2af20142fea383c92455e36fc7de8de303fd0c49662e27920cea295bd09f6fc029d6c2be3a465cc5a5a
|
data/Rakefile
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
3
|
|
4
|
-
JRuby.objectspace = true if RUBY_PLATFORM == 'java'
|
5
|
-
|
6
4
|
Rake::TestTask.new(:test) do |t|
|
7
|
-
t.libs << "test
|
8
|
-
t.
|
9
|
-
t.test_files = FileList[
|
5
|
+
t.libs << "test/lib"
|
6
|
+
t.ruby_opts << "-rhelper"
|
7
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
8
|
+
end
|
9
|
+
|
10
|
+
task :sync_tool do
|
11
|
+
require 'fileutils'
|
12
|
+
FileUtils.cp "../ruby/tool/lib/core_assertions.rb", "./test/lib"
|
13
|
+
FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib"
|
14
|
+
FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib"
|
10
15
|
end
|
11
16
|
|
12
17
|
task :default => :test
|
data/fileutils.gemspec
CHANGED
@@ -1,30 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
source_version = ["", "lib/"].find do |dir|
|
4
|
+
begin
|
5
|
+
break File.open(File.join(__dir__, "#{dir}fileutils.rb")) {|f|
|
6
|
+
f.gets("\n VERSION = ")
|
7
|
+
f.gets[/\s*"(.+)"/, 1]
|
8
|
+
}
|
9
|
+
rescue Errno::ENOENT
|
10
|
+
end
|
8
11
|
end
|
9
12
|
|
10
13
|
Gem::Specification.new do |s|
|
11
14
|
s.name = "fileutils"
|
12
|
-
s.version =
|
15
|
+
s.version = source_version
|
13
16
|
s.summary = "Several file utility methods for copying, moving, removing, etc."
|
14
17
|
s.description = "Several file utility methods for copying, moving, removing, etc."
|
15
18
|
|
16
19
|
s.require_path = %w{lib}
|
17
|
-
s.files = ["LICENSE.txt", "README.md", "Rakefile", "fileutils.gemspec", "lib/fileutils.rb"
|
18
|
-
s.required_ruby_version = ">= 2.
|
20
|
+
s.files = ["LICENSE.txt", "README.md", "Rakefile", "fileutils.gemspec", "lib/fileutils.rb"]
|
21
|
+
s.required_ruby_version = ">= 2.5.0"
|
19
22
|
|
20
23
|
s.authors = ["Minero Aoki"]
|
21
24
|
s.email = [nil]
|
22
25
|
s.homepage = "https://github.com/ruby/fileutils"
|
23
|
-
s.
|
26
|
+
s.licenses = ["Ruby", "BSD-2-Clause"]
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
29
|
-
end
|
28
|
+
s.metadata = {
|
29
|
+
"source_code_uri" => "https://github.com/ruby/fileutils"
|
30
|
+
}
|
30
31
|
end
|
data/lib/fileutils.rb
CHANGED
@@ -6,8 +6,6 @@ rescue LoadError
|
|
6
6
|
# for make mjit-headers
|
7
7
|
end
|
8
8
|
|
9
|
-
require_relative "fileutils/version"
|
10
|
-
|
11
9
|
#
|
12
10
|
# = fileutils.rb
|
13
11
|
#
|
@@ -104,6 +102,7 @@ require_relative "fileutils/version"
|
|
104
102
|
# <tt>:verbose</tt> flags to methods in FileUtils.
|
105
103
|
#
|
106
104
|
module FileUtils
|
105
|
+
VERSION = "1.6.0"
|
107
106
|
|
108
107
|
def self.private_module_function(name) #:nodoc:
|
109
108
|
module_function name
|
@@ -209,21 +208,14 @@ module FileUtils
|
|
209
208
|
fu_output_message "mkdir -p #{mode ? ('-m %03o ' % mode) : ''}#{list.join ' '}" if verbose
|
210
209
|
return *list if noop
|
211
210
|
|
212
|
-
list.
|
213
|
-
|
214
|
-
begin
|
215
|
-
fu_mkdir path, mode
|
216
|
-
next
|
217
|
-
rescue SystemCallError
|
218
|
-
next if File.directory?(path)
|
219
|
-
end
|
211
|
+
list.each do |item|
|
212
|
+
path = remove_trailing_slash(item)
|
220
213
|
|
221
214
|
stack = []
|
222
|
-
until
|
215
|
+
until File.directory?(path)
|
223
216
|
stack.push path
|
224
217
|
path = File.dirname(path)
|
225
218
|
end
|
226
|
-
stack.pop # root directory should exist
|
227
219
|
stack.reverse_each do |dir|
|
228
220
|
begin
|
229
221
|
fu_mkdir dir, mode
|
@@ -835,13 +827,8 @@ module FileUtils
|
|
835
827
|
def compare_stream(a, b)
|
836
828
|
bsize = fu_stream_blksize(a, b)
|
837
829
|
|
838
|
-
|
839
|
-
|
840
|
-
sb = String.new(capacity: bsize)
|
841
|
-
else
|
842
|
-
sa = String.new
|
843
|
-
sb = String.new
|
844
|
-
end
|
830
|
+
sa = String.new(capacity: bsize)
|
831
|
+
sb = String.new(capacity: bsize)
|
845
832
|
|
846
833
|
begin
|
847
834
|
a.read(bsize, sa)
|
@@ -918,11 +905,8 @@ module FileUtils
|
|
918
905
|
private_module_function :apply_mask
|
919
906
|
|
920
907
|
def symbolic_modes_to_i(mode_sym, path) #:nodoc:
|
921
|
-
|
922
|
-
|
923
|
-
else
|
924
|
-
File.stat(path).mode
|
925
|
-
end
|
908
|
+
path = File.stat(path) unless File::Stat === path
|
909
|
+
mode = path.mode
|
926
910
|
mode_sym.split(/,/).inject(mode & 07777) do |current_mode, clause|
|
927
911
|
target, *actions = clause.split(/([=+-])/)
|
928
912
|
raise ArgumentError, "invalid file mode: #{mode_sym}" if actions.empty?
|
@@ -939,7 +923,7 @@ module FileUtils
|
|
939
923
|
when "x"
|
940
924
|
mask | 0111
|
941
925
|
when "X"
|
942
|
-
if
|
926
|
+
if path.directory?
|
943
927
|
mask | 0111
|
944
928
|
else
|
945
929
|
mask
|
@@ -1291,16 +1275,12 @@ module FileUtils
|
|
1291
1275
|
|
1292
1276
|
def entries
|
1293
1277
|
opts = {}
|
1294
|
-
opts[:encoding] = ::Encoding::UTF_8
|
1278
|
+
opts[:encoding] = fu_windows? ? ::Encoding::UTF_8 : path.encoding
|
1295
1279
|
|
1296
|
-
files =
|
1297
|
-
Dir.children(path, **opts)
|
1298
|
-
else
|
1299
|
-
Dir.entries(path(), **opts)
|
1300
|
-
.reject {|n| n == '.' or n == '..' }
|
1301
|
-
end
|
1280
|
+
files = Dir.children(path, **opts)
|
1302
1281
|
|
1303
|
-
|
1282
|
+
untaint = RUBY_VERSION < '2.7'
|
1283
|
+
files.map {|n| Entry_.new(prefix(), join(rel(), untaint ? n.untaint : n)) }
|
1304
1284
|
end
|
1305
1285
|
|
1306
1286
|
def stat
|
@@ -1345,6 +1325,7 @@ module FileUtils
|
|
1345
1325
|
else
|
1346
1326
|
File.chmod mode, path()
|
1347
1327
|
end
|
1328
|
+
rescue Errno::EOPNOTSUPP
|
1348
1329
|
end
|
1349
1330
|
|
1350
1331
|
def chown(uid, gid)
|
@@ -1439,7 +1420,7 @@ module FileUtils
|
|
1439
1420
|
if st.symlink?
|
1440
1421
|
begin
|
1441
1422
|
File.lchmod mode, path
|
1442
|
-
rescue NotImplementedError
|
1423
|
+
rescue NotImplementedError, Errno::EOPNOTSUPP
|
1443
1424
|
end
|
1444
1425
|
else
|
1445
1426
|
File.chmod mode, path
|
@@ -1559,7 +1540,15 @@ module FileUtils
|
|
1559
1540
|
def join(dir, base)
|
1560
1541
|
return File.path(dir) if not base or base == '.'
|
1561
1542
|
return File.path(base) if not dir or dir == '.'
|
1562
|
-
|
1543
|
+
begin
|
1544
|
+
File.join(dir, base)
|
1545
|
+
rescue EncodingError
|
1546
|
+
if fu_windows?
|
1547
|
+
File.join(dir.encode(::Encoding::UTF_8), base.encode(::Encoding::UTF_8))
|
1548
|
+
else
|
1549
|
+
raise
|
1550
|
+
end
|
1551
|
+
end
|
1563
1552
|
end
|
1564
1553
|
|
1565
1554
|
if File::ALT_SEPARATOR
|
@@ -1614,7 +1603,7 @@ module FileUtils
|
|
1614
1603
|
|
1615
1604
|
def fu_output_message(msg) #:nodoc:
|
1616
1605
|
output = @fileutils_output if defined?(@fileutils_output)
|
1617
|
-
output ||= $
|
1606
|
+
output ||= $stdout
|
1618
1607
|
if defined?(@fileutils_label)
|
1619
1608
|
msg = @fileutils_label + msg
|
1620
1609
|
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.6.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: 2021-10-21 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: []
|
@@ -22,13 +22,13 @@ files:
|
|
22
22
|
- Rakefile
|
23
23
|
- fileutils.gemspec
|
24
24
|
- lib/fileutils.rb
|
25
|
-
- lib/fileutils/version.rb
|
26
25
|
homepage: https://github.com/ruby/fileutils
|
27
26
|
licenses:
|
27
|
+
- Ruby
|
28
28
|
- BSD-2-Clause
|
29
29
|
metadata:
|
30
30
|
source_code_uri: https://github.com/ruby/fileutils
|
31
|
-
post_install_message:
|
31
|
+
post_install_message:
|
32
32
|
rdoc_options: []
|
33
33
|
require_paths:
|
34
34
|
- lib
|
@@ -36,15 +36,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 2.
|
39
|
+
version: 2.5.0
|
40
40
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
|
-
rubygems_version: 3.0.
|
47
|
-
signing_key:
|
46
|
+
rubygems_version: 3.3.0.dev
|
47
|
+
signing_key:
|
48
48
|
specification_version: 4
|
49
49
|
summary: Several file utility methods for copying, moving, removing, etc.
|
50
50
|
test_files: []
|