Method: Bundler::FileUtils.mkdir
- Defined in:
- lib/bundler/vendor/fileutils/lib/fileutils.rb
.mkdir(list, mode: nil, noop: nil, verbose: nil) ⇒ Object
Creates directories at the paths in the given list (a single path or an array of paths); returns list if it is an array, [list] otherwise.
Argument list or its elements should be interpretable as paths.
With no keyword arguments, creates a directory at each path in list by calling: Dir.mkdir(path, mode); see Dir.mkdir:
Bundler::FileUtils.mkdir(%w[tmp0 tmp1]) # => ["tmp0", "tmp1"]
Bundler::FileUtils.mkdir('tmp4') # => ["tmp4"]
Keyword arguments:
-
mode: <i>mode</i>- also callsFile.chmod(mode, path); see File.chmod. -
noop: true- does not create directories. -
verbose: true- prints an equivalent command:Bundler::FileUtils.mkdir(%w[tmp0 tmp1], verbose: true) Bundler::FileUtils.mkdir(%w[tmp2 tmp3], mode: 0700, verbose: true)Output:
mkdir tmp0 tmp1 mkdir -m 700 tmp2 tmp3
Raises an exception if any path points to an existing file or directory, or if for any reason a directory cannot be created.
Related: Bundler::FileUtils.mkdir_p.
317 318 319 320 321 322 323 324 325 |
# File 'lib/bundler/vendor/fileutils/lib/fileutils.rb', line 317 def mkdir(list, mode: nil, noop: nil, verbose: nil) list = fu_list(list) "mkdir #{mode ? ('-m %03o ' % mode) : ''}#{list.join ' '}" if verbose return if noop list.each do |dir| fu_mkdir dir, mode end end |