Class: Bosh::Cli::ReleaseArchiver
Instance Attribute Summary collapse
-
#filepath ⇒ Object
readonly
Returns the value of attribute filepath.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(filepath, manifest, packages, jobs, license = nil) ⇒ ReleaseArchiver
constructor
A new instance of ReleaseArchiver.
Constructor Details
#initialize(filepath, manifest, packages, jobs, license = nil) ⇒ ReleaseArchiver
Returns a new instance of ReleaseArchiver.
5 6 7 8 9 10 11 12 13 |
# File 'lib/cli/release_archiver.rb', line 5 def initialize(filepath, manifest, packages, jobs, license = nil) @filepath = filepath @manifest = manifest @packages = packages @jobs = jobs @license = license @build_dir = Dir.mktmpdir end |
Instance Attribute Details
#filepath ⇒ Object (readonly)
Returns the value of attribute filepath.
3 4 5 |
# File 'lib/cli/release_archiver.rb', line 3 def filepath @filepath end |
Instance Method Details
#build ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cli/release_archiver.rb', line 15 def build FileUtils.copy(manifest, File.join(build_dir, 'release.MF'), :preserve => true) packages_dir = FileUtils.mkdir_p(File.join(build_dir, 'packages')) header("Copying packages") packages.each do |package| say(package.name.make_green) FileUtils.copy(package.tarball_path, File.join(packages_dir, "#{package.name}.tgz"), :preserve => true) end nl jobs_dir = FileUtils.mkdir_p(File.join(build_dir, 'jobs')) header("Copying jobs") jobs.each do |job| say(job.name.make_green) FileUtils.copy(job.tarball_path, File.join(jobs_dir, "#{job.name}.tgz"), :preserve => true) end nl if license header("Copying license") say("license".make_green) nl `tar -xzf #{license.tarball_path} -C #{build_dir} 2>&1` unless $?.exitstatus == 0 raise InvalidRelease, "Cannot extract license tarball" end end SortedReleaseArchiver.new(build_dir).archive(filepath) say("Generated #{filepath.make_green}") say("Release size: #{pretty_size(filepath).make_green}") end |