lib/texico/template/file.rb
# Copy
#
# Copy the file with its relative path intact to the dest_base_path root.
#
# Returns a FileStatus object.
Copy
Copy the file with its relative path intact to the dest_base_path root.

Returns a FileStatus object.
Copy Copy the file with its relative path intact to the dest_base_path root . Returns a FileStatus object .
def copy(params, dest_base_path = '.', opts = {})
        dest_dir  = ::File.expand_path dirname, dest_base_path
        dest_path = ::File.expand_path basename, dest_dir
        force     = false
        if ::File.exist? dest_path
          return FileStatus.new(self, :target_exist) unless opts[:force]
          force = true
        else
          FileUtils.mkdir_p dest_dir unless opts[:dry_run]
        end
        if template?
          err = copy_template src_path, dest_path, params,
                              noop: opts[:dry_run], verbose: opts[:verbose]
          return err if err
        else
          FileUtils.cp src_path, dest_path,
                       noop: opts[:dry_run], verbose: opts[:verbose]
        end
        FileStatus.new(self, force ? :replaced_target : :successful)
      end
def copy ( params , dest_base_path = '.' , opts = { } ) dest_dir = :: File . expand_path dirname , dest_base_path dest_path = :: File . expand_path basename , dest_dir force = false if :: File . exist? dest_path return FileStatus . new ( self , :target_exist ) unless opts [ :force ] force = true else FileUtils . mkdir_p dest_dir unless opts [ :dry_run ] end if template? err = copy_template src_path , dest_path , params , noop : opts [ :dry_run ] , verbose : opts [ :verbose ] return err if err else FileUtils . cp src_path , dest_path , noop : opts [ :dry_run ] , verbose : opts [ :verbose ] end FileStatus . new ( self , force ? :replaced_target : :successful ) end
Copy
Copy the file with its relative path intact to the dest_base_path root.
Copy Copy the file with its relative path intact to the dest_base_path root .
params
<not_specific>
dest_base_path
<not_specific>
opts
<not_specific>