Module: Blimpy::Livery

Defined in:
lib/blimpy/livery.rb,
lib/blimpy/livery/cwd.rb,
lib/blimpy/livery/base.rb,
lib/blimpy/livery/puppet.rb

Defined Under Namespace

Classes: Base, CWD, Puppet

Class Method Summary collapse

Class Method Details

.tarball_directory(directory) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/blimpy/livery.rb', line 10

def self.tarball_directory(directory)
  if directory.nil? || !(File.directory? directory)
    raise ArgumentError, "The argument '#{directory}' doesn't appear to be a directory"
  end

  directory = File.expand_path(directory)
  short_name = File.basename(directory)

  tarball = nil
  Dir.chdir(File.expand_path(directory  + '/../')) do
    tarball = self.gzip_for_directory(short_name, '/tmp') do |tgz|
      Archive::Tar::Minitar.pack(short_name, tgz)
    end
  end
  tarball
end