Last Modified
  2019-03-17 02:59:19 +0000
Requires
  - etc

## Description

frozen_string_literal: true

# fileutils.rb

Copyright © 2000-2007 Minero Aoki

This program is free software. You can distribute/modify this program under the same terms of ruby.

## module Bundler::FileUtils

Namespace for several file utility methods for copying, moving, removing, etc.

### Module Functions

    require 'bundler/vendor/fileutils/lib/fileutils'

    Bundler::FileUtils.cd(dir, options)
    Bundler::FileUtils.cd(dir, options) {|dir| block }
    Bundler::FileUtils.pwd()
    Bundler::FileUtils.mkdir(dir, options)
    Bundler::FileUtils.mkdir(list, options)
    Bundler::FileUtils.mkdir_p(dir, options)
    Bundler::FileUtils.mkdir_p(list, options)
    Bundler::FileUtils.rmdir(dir, options)
    Bundler::FileUtils.rmdir(list, options)
    Bundler::FileUtils.ln(target, link, options)
    Bundler::FileUtils.ln(targets, dir, options)
    Bundler::FileUtils.ln_s(target, link, options)
    Bundler::FileUtils.ln_s(targets, dir, options)
    Bundler::FileUtils.ln_sf(target, link, options)
    Bundler::FileUtils.cp(src, dest, options)
    Bundler::FileUtils.cp(list, dir, options)
    Bundler::FileUtils.cp_r(src, dest, options)
    Bundler::FileUtils.cp_r(list, dir, options)
    Bundler::FileUtils.mv(src, dest, options)
    Bundler::FileUtils.mv(list, dir, options)
    Bundler::FileUtils.rm(list, options)
    Bundler::FileUtils.rm_r(list, options)
    Bundler::FileUtils.rm_rf(list, options)
    Bundler::FileUtils.install(src, dest, options)
    Bundler::FileUtils.chmod(mode, list, options)
    Bundler::FileUtils.chmod_R(mode, list, options)
    Bundler::FileUtils.chown(user, group, list, options)
    Bundler::FileUtils.chown_R(user, group, list, options)
    Bundler::FileUtils.touch(list, options)

The `options` parameter is a hash of options, taken from the list `:force`, `:noop`, `:preserve`, and `:verbose`. `:noop` means that no changes are made. The other three are obvious. Each method documents the options that it honours.

All methods that have the concept of a “source” file or directory can take either one file or a list of files in that argument. See the method documentation for examples.

There are some `low level’ methods, which do not accept any option:

    Bundler::FileUtils.copy_entry(src, dest, preserve = false, dereference = false)
    Bundler::FileUtils.copy_file(src, dest, preserve = false, dereference = true)
    Bundler::FileUtils.copy_stream(srcstream, deststream)
    Bundler::FileUtils.remove_entry(path, force = false)
    Bundler::FileUtils.remove_entry_secure(path, force = false)
    Bundler::FileUtils.remove_file(path, force = false)
    Bundler::FileUtils.compare_file(path_a, path_b)
    Bundler::FileUtils.compare_stream(stream_a, stream_b)
    Bundler::FileUtils.uptodate?(file, cmp_list)

## module Bundler::FileUtils::Verbose

This module has all methods of Bundler::FileUtils module, but it outputs messages before acting. This equates to passing the `:verbose` flag to methods in Bundler::FileUtils.

## module Bundler::FileUtils::NoWrite

This module has all methods of Bundler::FileUtils module, but never changes files/directories. This equates to passing the `:noop` flag to methods in Bundler::FileUtils.

## module Bundler::FileUtils::DryRun

This module has all methods of Bundler::FileUtils module, but never changes files/directories. This equates to passing the `:noop` and `:verbose` flags to methods in Bundler::FileUtils.