fileutils 1.1.0 → 1.2.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: e0aee7f293ec6d29fa463553496d041a986ddfb407fe3ea8788da72a5e5be089
4
- data.tar.gz: 2e1a5e8678e34ef6cb8caf57c474035052da6985746212040eeae58d6b06f094
3
+ metadata.gz: 822c63d8edeea0c85052a9c369998a574dee1f10a5a3324c8b65a99ae8b5ebfc
4
+ data.tar.gz: 750967bab0db376f480e6b66cac9d1c8c251df2afb117b493266ffe9f8c4c968
5
5
  SHA512:
6
- metadata.gz: 98dc33148493bef27a911a73f78f825de57929ad8eb3e3e9c47c40dbadb139c74b044011f78129b651155e8c2478266af5713f4e491765a351270e2cdecc8db4
7
- data.tar.gz: 6209a27261211f2f724d51fd9abc0a6729023d0c7354f982c641d1b37670f7550b9a23b675cb8e49ada611cbdc794ceb5f7aa517bf4c9b71ed58ed3dc150d528
6
+ metadata.gz: 8bfae5ac5f001b4841794552a001f694acc7cb872c6ab7534ea02424431f3c7ece68957ccd757a63ff779916b2dc6c930fa77d359793647dcb3f7a2594258d4b
7
+ data.tar.gz: 454a6c561b6df0d2480207533e4724d2e876e9843e9f8079dabd6e5b1b1d41a528a7c86f7a016c762129b34c3f9322dc114dde466f2142f88e77ff50d4178a40
@@ -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 = '1.1.0'
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 = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "fileutils.gemspec", "lib/fileutils.rb"]
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"]
@@ -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, dereference = 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 old
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('/', :verbose => true) # chdir and report it
120
+ # FileUtils.cd('/') # change directory
117
121
  #
118
- # FileUtils.cd('/') do # chdir
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
- def fu_windows?
1152
- /mswin|mingw|bccwin|emx/ =~ RbConfig::CONFIG['host_os']
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
- Dir.entries(path(), opts)\
1278
- .reject {|n| n == '.' or n == '..' }\
1279
- .map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
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
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FileUtils
4
+ VERSION = "1.2.0"
5
+ end
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.1.0
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: 2018-05-15 00:00:00.000000000 Z
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
- rubyforge_project:
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
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
@@ -1,13 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.7
5
- - 2.4.4
6
- - 2.5.1
7
- - ruby-head
8
- script: rake test
9
- matrix:
10
- include:
11
- - rvm: jruby-9.1.17.0
12
- env:
13
- - "JRUBY_OPTS='-J-Xmx1024M -X+O'"
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in fileutils.gemspec
4
- gemspec
@@ -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__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here