Class: Roger::Release::Finalizers::Dir

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

Overview

Finalizes the release into a directory in target_path

The directory name will have the format PREFIX-VERSION

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

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”)



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

def call(release, options = {})
  options = {}.update(@options)
  options.update(options) if options

  name = [(options[:prefix] || "html"), release.scm.version].join("-")
  target_path = release.target_path + name

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

  if File.exist?(target_path)
    release.log(self, "Removing existing target #{target_path}")
    FileUtils.rm_rf(target_path)
  end

  FileUtils.cp_r release.build_path, target_path
end