Sha256: f7c6d6df06efa83dd65ad9a7bfa8b6c33b284380e5ce5d45909b83c15d712f79

Contents?: true

Size: 778 Bytes

Versions: 54

Compression:

Stored size: 778 Bytes

Contents

require 'fileutils'
require 'pe_build/idempotent'

# @todo These methods fail in a messy way if something goes wrong. They should
#   be refactored to raise proper errors.
# @api private
module PEBuild::Transfer::File
  extend PEBuild::Idempotent

  # @param src [URI] The local file path path to the file to copy
  # @param dst [String] The path to destination of the copied file
  def self.copy(src, dst)
    idempotent(dst) { FileUtils.cp src.path, dst }
  end

  # @param src [URI] The local file path path to the file to read
  # @return [String] The contents of the file with leading and trailing
  #   whitespace removed.
  #
  # @since 0.9.0
  def self.read(src)
    File.read(src.path).strip
  end

  # TODO: Raise an appropriate exception when files do not exist.
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
vagrant-pe_build-0.11.0 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.10.4 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.10.3 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.10.2 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.10.1 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.10.0 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.9.7 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.9.6 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.9.5 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.9.4 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.9.3 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.9.2 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.9.1 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.9.0 lib/pe_build/transfer/file.rb