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.17.0 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.16.0 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.15.6 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.15.5 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.15.4 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.15.3 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.15.1 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.15.0 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.14.2 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.14.1 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.14.0 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.13.7 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.13.6 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.13.5 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.13.4 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.13.3 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.13.2 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.13.1 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.13.0 lib/pe_build/transfer/file.rb
vagrant-pe_build-0.12.0 lib/pe_build/transfer/file.rb