Class: Roger::Release::Finalizers::Zip

Inherits:
Base show all
Defined in:
lib/roger/release/finalizers/zip.rb

Overview

The zip finalizer

Instance Attribute Summary

Attributes inherited from Processors::Base

#options, #release

Instance Method Summary collapse

Methods inherited from Processors::Base

#call, #name

Instance Method Details

#default_optionsObject

Parameters:

  • options (Hash)

    a customizable set of options



10
11
12
13
14
15
16
# File 'lib/roger/release/finalizers/zip.rb', line 10

def default_options
  {
    zip: "zip",
    prefix: "html",
    target_path: release.target_path
  }
end

#performObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/roger/release/finalizers/zip.rb', line 18

def perform
  target_path = ensure_target_path(@options[:target_path])

  name = [options[:prefix], @release.scm.version].join("-") + ".zip"
  zip_path = target_path + name

  @release.log(self, "Finalizing release to #{zip_path}")

  cleanup_existing_zip(zip_path)

  check_zip_command(@options[:zip])

  ::Dir.chdir(@release.build_path) do
    `#{@options[:zip]} -r -9 "#{zip_path}" ./*`
  end
end