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, options = {}) ⇒ Object

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :prefix (Object)

    Prefix to put before the version (default = “html”)

  • :zip (Object)

    The zip command



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

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

  options.update(options) if options

  name = [options[:prefix], release.scm.version].join("-") + ".zip"
  zip_path = release.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