Class: Bosh::Cli::SortedReleaseArchiver

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/sorted_release_archiver.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ SortedReleaseArchiver

Returns a new instance of SortedReleaseArchiver


3
4
5
# File 'lib/cli/sorted_release_archiver.rb', line 3

def initialize(dir)
  @dir = dir
end

Instance Method Details

#archive(destination_file) ⇒ Object


7
8
9
10
11
12
13
14
15
# File 'lib/cli/sorted_release_archiver.rb', line 7

def archive(destination_file)
  Dir.chdir(@dir) do
    ordered_release_files = Bosh::Common::Release::ReleaseDirectory.new('.').ordered_release_files
    success = Kernel.system('tar', '-C', @dir, '-pczf', destination_file, *ordered_release_files, out: '/dev/null', err: '/dev/null')
    if !success
      raise InvalidRelease, 'Cannot create release tarball'
    end
  end
end