fileutils 1.8.0 → 1.8.1
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/lib/fileutils.rb +54 -29
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 119ccdad9a61fd3b8d32a10a9737c25a71aa74c89af88793ddcd8f9dc08c7bd3
|
|
4
|
+
data.tar.gz: c84c86999eb6506a4d9b2115b1829d2820766ebbecf604aa07b8071320803e2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f33cafc4d2e0b7ec187909b6ee8f6396a08cbc7216cc135062e7d8d43f72195186e97cb8b085b107f31997f36542894ab52b86f634be881b4ad3f807521b246b
|
|
7
|
+
data.tar.gz: be31fb0185c76372fed0fdb585f37e67a875dafa63497c2095f40ae791228e8c0e5cc96bf6e44870c32652a9ccfc1f3d7bacdc4244084bdfdeb93675e8264077
|
data/lib/fileutils.rb
CHANGED
|
@@ -181,7 +181,7 @@ end
|
|
|
181
181
|
#
|
|
182
182
|
module FileUtils
|
|
183
183
|
# The version number.
|
|
184
|
-
VERSION = "1.8.
|
|
184
|
+
VERSION = "1.8.1"
|
|
185
185
|
|
|
186
186
|
def self.private_module_function(name) #:nodoc:
|
|
187
187
|
module_function name
|
|
@@ -279,38 +279,67 @@ module FileUtils
|
|
|
279
279
|
end
|
|
280
280
|
private_module_function :remove_trailing_slash
|
|
281
281
|
|
|
282
|
+
# :markup: markdown
|
|
282
283
|
#
|
|
283
|
-
#
|
|
284
|
-
#
|
|
285
|
-
# returns +list+ if it is an array, <tt>[list]</tt> otherwise.
|
|
284
|
+
# call-seq:
|
|
285
|
+
# FileUtils.mkdir(*paths, mode: 0775, noop: nil, verbose: nil) -> array_of_paths or nil
|
|
286
286
|
#
|
|
287
|
-
# Argument
|
|
288
|
-
#
|
|
287
|
+
# Argument `paths` may be one path or an array of paths;
|
|
288
|
+
# each must be {interpretable as a path}[rdoc-ref:FileUtils@Path+Arguments].
|
|
289
289
|
#
|
|
290
|
-
#
|
|
291
|
-
#
|
|
292
|
-
#
|
|
290
|
+
# By default, creates a directory entry at each of the given `paths`;
|
|
291
|
+
# each directory has permissions `0775`;
|
|
292
|
+
# returns an array of the paths:
|
|
293
293
|
#
|
|
294
|
-
#
|
|
295
|
-
#
|
|
294
|
+
# ```ruby
|
|
295
|
+
# FileUtils.mkdir('foo') # => ["foo"]
|
|
296
|
+
# FileUtils.mkdir(%w[bar baz]) # => ["bar", "baz"]
|
|
297
|
+
# File.stat(Dir.new('foo')).mode.to_s(8) # => "40775"
|
|
298
|
+
# File.stat(Dir.new('bar')).mode.to_s(8) # => "40775"
|
|
299
|
+
# File.stat(Dir.new('baz')).mode.to_s(8) # => "40775"
|
|
300
|
+
# FileUtils.rmdir(%w[foo bar baz]) # => ["foo", "bar", "baz"]
|
|
301
|
+
# ```
|
|
296
302
|
#
|
|
297
|
-
#
|
|
303
|
+
# Raises an exception if for any reason a directory cannot be created;
|
|
304
|
+
# a common reason is that the directory already exists.
|
|
298
305
|
#
|
|
299
|
-
#
|
|
300
|
-
#
|
|
301
|
-
# - <tt>noop: true</tt> - does not create directories.
|
|
302
|
-
# - <tt>verbose: true</tt> - prints an equivalent command:
|
|
306
|
+
# With keyword argument `mode` given,
|
|
307
|
+
# creates directories with the given permissions:
|
|
303
308
|
#
|
|
304
|
-
#
|
|
305
|
-
#
|
|
309
|
+
# ```ruby
|
|
310
|
+
# FileUtils.mkdir('bar', mode: 0664)
|
|
311
|
+
# File.stat(Dir.new('bar')).mode.to_s(8) # => "40664"
|
|
312
|
+
# FileUtils.rmdir('bar')
|
|
313
|
+
# ```
|
|
306
314
|
#
|
|
307
|
-
#
|
|
315
|
+
# With keyword argument `noop` given as `true`,
|
|
316
|
+
# does not create directories;
|
|
317
|
+
# returns `nil`
|
|
318
|
+
#
|
|
319
|
+
# ```ruby
|
|
320
|
+
# FileUtils.mkdir('foo', noop: true) # => nil
|
|
321
|
+
# Dir.exist?('foo') # => false
|
|
322
|
+
# ```
|
|
323
|
+
#
|
|
324
|
+
# With keyword argument `verbose` given as `true`,
|
|
325
|
+
# prints a shell command:
|
|
308
326
|
#
|
|
309
|
-
#
|
|
310
|
-
#
|
|
327
|
+
# ```ruby
|
|
328
|
+
# FileUtils.mkdir('foo', verbose: true)
|
|
329
|
+
# FileUtils.mkdir(%w[bar baz], mode: 0644, verbose: true)
|
|
330
|
+
# FileUtils.mkdir(%w[bar baz], mode: 0644, verbose: true, noop: true)
|
|
331
|
+
# ```
|
|
311
332
|
#
|
|
312
|
-
#
|
|
313
|
-
#
|
|
333
|
+
# Output:
|
|
334
|
+
#
|
|
335
|
+
# ```text
|
|
336
|
+
# mkdir foo
|
|
337
|
+
# mkdir -m 644 bar baz
|
|
338
|
+
# mkdir -m 644 bar baz
|
|
339
|
+
# ```
|
|
340
|
+
#
|
|
341
|
+
# Note that in the last call above (containing `noop: true`)
|
|
342
|
+
# the existence of the directory is not checked.
|
|
314
343
|
#
|
|
315
344
|
# Related: FileUtils.mkdir_p.
|
|
316
345
|
#
|
|
@@ -686,7 +715,7 @@ module FileUtils
|
|
|
686
715
|
# Keyword arguments:
|
|
687
716
|
#
|
|
688
717
|
# - <tt>force: true</tt> - overwrites +dest+ if it exists.
|
|
689
|
-
# - <tt>relative:
|
|
718
|
+
# - <tt>relative: true</tt> - create links relative to +dest+.
|
|
690
719
|
# - <tt>noop: true</tt> - does not create links.
|
|
691
720
|
# - <tt>verbose: true</tt> - prints an equivalent command:
|
|
692
721
|
#
|
|
@@ -754,7 +783,7 @@ module FileUtils
|
|
|
754
783
|
n = real_ddirs.size - i
|
|
755
784
|
n -= 1 unless target_directory
|
|
756
785
|
link2 = fu_clean_components(*Array.new([n, 0].max, '..'), *real_sdirs[i..-1])
|
|
757
|
-
link1 = link2 if link1.size > link2.size
|
|
786
|
+
link1 = link2 if !link2.empty? and link1.size > link2.size
|
|
758
787
|
end
|
|
759
788
|
s = File.join(link1)
|
|
760
789
|
fu_output_message [cmd, s, d].flatten.join(' ') if verbose
|
|
@@ -2037,10 +2066,6 @@ module FileUtils
|
|
|
2037
2066
|
def fu_windows?; false end #:nodoc:
|
|
2038
2067
|
end
|
|
2039
2068
|
|
|
2040
|
-
def fu_copy_stream0(src, dest, blksize = nil) #:nodoc:
|
|
2041
|
-
IO.copy_stream(src, dest)
|
|
2042
|
-
end
|
|
2043
|
-
|
|
2044
2069
|
def fu_stream_blksize(*streams) #:nodoc:
|
|
2045
2070
|
streams.each do |s|
|
|
2046
2071
|
next unless s.respond_to?(:stat)
|