Module: Kitchen::Transport::Express::Archiver

Included in:
Kitchen::Transport::ExpressSsh::Connection
Defined in:
lib/kitchen/transport/express/archiver.rb

Instance Method Summary collapse

Instance Method Details

#archive(path) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/kitchen/transport/express/archiver.rb', line 23

def archive(path)
  archive_basename = ::File.basename(path) + ".tgz"
  archive_full_name = ::File.join(::File.dirname(path), archive_basename)

  file_count = ::Dir.glob(::File.join(path, "**/*")).size
  logger.debug("[#{LOG_PREFIX}] #{path} contains #{file_count} files.")
  create_archive(path, archive_full_name)
  archive_full_name
end

#extract(archive_basename, remote) ⇒ Object



33
34
35
36
37
# File 'lib/kitchen/transport/express/archiver.rb', line 33

def extract(archive_basename, remote)
  logger.debug("[#{LOG_PREFIX}] Unpacking archive #{archive_basename} in #{remote}")
  execute("tar -xzf #{::File.join(remote, archive_basename)} -C #{remote}")
  execute("rm -f #{::File.join(remote, archive_basename)}")
end