fileutils 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fileutils.gemspec +9 -2
- data/lib/fileutils.rb +35 -29
- data/lib/fileutils/version.rb +5 -0
- metadata +4 -9
- data/.gitignore +0 -9
- data/.travis.yml +0 -13
- data/Gemfile +0 -4
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 822c63d8edeea0c85052a9c369998a574dee1f10a5a3324c8b65a99ae8b5ebfc
|
4
|
+
data.tar.gz: 750967bab0db376f480e6b66cac9d1c8c251df2afb117b493266ffe9f8c4c968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bfae5ac5f001b4841794552a001f694acc7cb872c6ab7534ea02424431f3c7ece68957ccd757a63ff779916b2dc6c930fa77d359793647dcb3f7a2594258d4b
|
7
|
+
data.tar.gz: 454a6c561b6df0d2480207533e4724d2e876e9843e9f8079dabd6e5b1b1d41a528a7c86f7a016c762129b34c3f9322dc114dde466f2142f88e77ff50d4178a40
|
data/fileutils.gemspec
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
begin
|
4
|
+
require_relative "lib/fileutils/version"
|
5
|
+
rescue LoadError
|
6
|
+
# for Ruby core repository
|
7
|
+
require_relative "version"
|
8
|
+
end
|
9
|
+
|
3
10
|
Gem::Specification.new do |s|
|
4
11
|
s.name = "fileutils"
|
5
|
-
s.version =
|
12
|
+
s.version = FileUtils::VERSION
|
6
13
|
s.summary = "Several file utility methods for copying, moving, removing, etc."
|
7
14
|
s.description = "Several file utility methods for copying, moving, removing, etc."
|
8
15
|
|
9
16
|
s.require_path = %w{lib}
|
10
|
-
s.files = ["
|
17
|
+
s.files = ["LICENSE.txt", "README.md", "Rakefile", "fileutils.gemspec", "lib/fileutils.rb", "lib/fileutils/version.rb"]
|
11
18
|
s.required_ruby_version = ">= 2.3.0"
|
12
19
|
|
13
20
|
s.authors = ["Minero Aoki"]
|
data/lib/fileutils.rb
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rbconfig'
|
5
|
+
rescue LoadError
|
6
|
+
# for make mjit-headers
|
7
|
+
end
|
8
|
+
|
9
|
+
require "fileutils/version"
|
10
|
+
|
2
11
|
#
|
3
12
|
# = fileutils.rb
|
4
13
|
#
|
@@ -56,7 +65,7 @@
|
|
56
65
|
#
|
57
66
|
# There are some `low level' methods, which do not accept any option:
|
58
67
|
#
|
59
|
-
# FileUtils.copy_entry(src, dest, preserve = false,
|
68
|
+
# FileUtils.copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
|
60
69
|
# FileUtils.copy_file(src, dest, preserve = false, dereference = true)
|
61
70
|
# FileUtils.copy_stream(srcstream, deststream)
|
62
71
|
# FileUtils.remove_entry(path, force = false)
|
@@ -84,13 +93,8 @@
|
|
84
93
|
# files/directories. This equates to passing the <tt>:noop</tt> and
|
85
94
|
# <tt>:verbose</tt> flags to methods in FileUtils.
|
86
95
|
#
|
87
|
-
|
88
|
-
require 'rbconfig'
|
89
|
-
|
90
96
|
module FileUtils
|
91
97
|
|
92
|
-
VERSION = "1.1.0"
|
93
|
-
|
94
98
|
def self.private_module_function(name) #:nodoc:
|
95
99
|
module_function name
|
96
100
|
private_class_method name
|
@@ -110,12 +114,14 @@ module FileUtils
|
|
110
114
|
#
|
111
115
|
# Changes the current directory to the directory +dir+.
|
112
116
|
#
|
113
|
-
# If this method is called with block, resumes to the
|
114
|
-
# working directory after the block execution finished.
|
117
|
+
# If this method is called with block, resumes to the previous
|
118
|
+
# working directory after the block execution has finished.
|
115
119
|
#
|
116
|
-
# FileUtils.cd('/'
|
120
|
+
# FileUtils.cd('/') # change directory
|
117
121
|
#
|
118
|
-
# FileUtils.cd('/')
|
122
|
+
# FileUtils.cd('/', :verbose => true) # change directory and report it
|
123
|
+
#
|
124
|
+
# FileUtils.cd('/') do # change directory
|
119
125
|
# # ... # do something
|
120
126
|
# end # return to original directory
|
121
127
|
#
|
@@ -519,13 +525,12 @@ module FileUtils
|
|
519
525
|
if destent.exist?
|
520
526
|
if destent.directory?
|
521
527
|
raise Errno::EEXIST, d
|
522
|
-
else
|
523
|
-
destent.remove_file if rename_cannot_overwrite_file?
|
524
528
|
end
|
525
529
|
end
|
526
530
|
begin
|
527
531
|
File.rename s, d
|
528
|
-
rescue Errno::EXDEV
|
532
|
+
rescue Errno::EXDEV,
|
533
|
+
Errno::EPERM # move from unencrypted to encrypted dir (ext4)
|
529
534
|
copy_entry s, d, true
|
530
535
|
if secure
|
531
536
|
remove_entry_secure s, force
|
@@ -543,11 +548,6 @@ module FileUtils
|
|
543
548
|
alias move mv
|
544
549
|
module_function :move
|
545
550
|
|
546
|
-
def rename_cannot_overwrite_file? #:nodoc:
|
547
|
-
/emx/ =~ RbConfig::CONFIG['host_os']
|
548
|
-
end
|
549
|
-
private_module_function :rename_cannot_overwrite_file?
|
550
|
-
|
551
551
|
#
|
552
552
|
# Remove file(s) specified in +list+. This method cannot remove directories.
|
553
553
|
# All StandardErrors are ignored when the :force option is set.
|
@@ -698,7 +698,7 @@ module FileUtils
|
|
698
698
|
f.chown euid, -1
|
699
699
|
f.chmod 0700
|
700
700
|
}
|
701
|
-
rescue EISDIR # JRuby in non-native mode can't open files as dirs
|
701
|
+
rescue Errno::EISDIR # JRuby in non-native mode can't open files as dirs
|
702
702
|
File.lstat(dot_file).tap {|fstat|
|
703
703
|
unless fu_stat_identical_entry?(st, fstat)
|
704
704
|
# symlink (TOC-to-TOU attack?)
|
@@ -1082,11 +1082,6 @@ module FileUtils
|
|
1082
1082
|
end
|
1083
1083
|
module_function :chown_R
|
1084
1084
|
|
1085
|
-
begin
|
1086
|
-
require 'etc'
|
1087
|
-
rescue LoadError # rescue LoadError for miniruby
|
1088
|
-
end
|
1089
|
-
|
1090
1085
|
def fu_get_uid(user) #:nodoc:
|
1091
1086
|
return nil unless user
|
1092
1087
|
case user
|
@@ -1095,6 +1090,7 @@ module FileUtils
|
|
1095
1090
|
when /\A\d+\z/
|
1096
1091
|
user.to_i
|
1097
1092
|
else
|
1093
|
+
require 'etc'
|
1098
1094
|
Etc.getpwnam(user) ? Etc.getpwnam(user).uid : nil
|
1099
1095
|
end
|
1100
1096
|
end
|
@@ -1108,6 +1104,7 @@ module FileUtils
|
|
1108
1104
|
when /\A\d+\z/
|
1109
1105
|
group.to_i
|
1110
1106
|
else
|
1107
|
+
require 'etc'
|
1111
1108
|
Etc.getgrnam(group) ? Etc.getgrnam(group).gid : nil
|
1112
1109
|
end
|
1113
1110
|
end
|
@@ -1148,8 +1145,11 @@ module FileUtils
|
|
1148
1145
|
module StreamUtils_
|
1149
1146
|
private
|
1150
1147
|
|
1151
|
-
|
1152
|
-
|
1148
|
+
case (defined?(::RbConfig) ? ::RbConfig::CONFIG['host_os'] : ::RUBY_PLATFORM)
|
1149
|
+
when /mswin|mingw/
|
1150
|
+
def fu_windows?; true end
|
1151
|
+
else
|
1152
|
+
def fu_windows?; false end
|
1153
1153
|
end
|
1154
1154
|
|
1155
1155
|
def fu_copy_stream0(src, dest, blksize = nil) #:nodoc:
|
@@ -1274,9 +1274,15 @@ module FileUtils
|
|
1274
1274
|
def entries
|
1275
1275
|
opts = {}
|
1276
1276
|
opts[:encoding] = ::Encoding::UTF_8 if fu_windows?
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1277
|
+
|
1278
|
+
files = if Dir.respond_to?(:children)
|
1279
|
+
Dir.children(path, opts)
|
1280
|
+
else
|
1281
|
+
Dir.entries(path(), opts)
|
1282
|
+
.reject {|n| n == '.' or n == '..' }
|
1283
|
+
end
|
1284
|
+
|
1285
|
+
files.map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
|
1280
1286
|
end
|
1281
1287
|
|
1282
1288
|
def stat
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fileutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minero Aoki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -31,16 +31,12 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
- ".gitignore"
|
35
|
-
- ".travis.yml"
|
36
|
-
- Gemfile
|
37
34
|
- LICENSE.txt
|
38
35
|
- README.md
|
39
36
|
- Rakefile
|
40
|
-
- bin/console
|
41
|
-
- bin/setup
|
42
37
|
- fileutils.gemspec
|
43
38
|
- lib/fileutils.rb
|
39
|
+
- lib/fileutils/version.rb
|
44
40
|
homepage: https://github.com/ruby/fileutils
|
45
41
|
licenses:
|
46
42
|
- BSD-2-Clause
|
@@ -61,8 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
57
|
- !ruby/object:Gem::Version
|
62
58
|
version: '0'
|
63
59
|
requirements: []
|
64
|
-
|
65
|
-
rubygems_version: 2.7.6
|
60
|
+
rubygems_version: 3.0.3
|
66
61
|
signing_key:
|
67
62
|
specification_version: 4
|
68
63
|
summary: Several file utility methods for copying, moving, removing, etc.
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "fileutils"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|