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

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

Overview

The zip finalizer The zip finalizer will

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Roger::Release::Finalizers::Base

Instance Attribute Details

#releaseObject (readonly)

Returns the value of attribute release.



5
6
7
# File 'lib/roger/release/finalizers/zip.rb', line 5

def release
  @release
end

Instance Method Details

#call(release, call_options = {}) ⇒ Object

Parameters:

  • options (Hash)

    a customizable set of options



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/roger/release/finalizers/zip.rb', line 10

def call(release, call_options = {})
  options = {
    zip: "zip",
    prefix: "html",
    target_path: release.target_path
  }.update(@options)

  options.update(call_options) if call_options

  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(release, zip_path)

  check_zip_command(options[:zip])

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