Class: HtmlMockup::Release::Finalizers::Dir

Inherits:
Base
  • Object
show all
Defined in:
lib/html_mockup/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 HtmlMockup::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”)



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

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

  name = [(options[:prefix] || "html"), release.scm.version].join("-")      
  release.log(self, "Finalizing release to #{release.target_path + name}")
  
  if File.exist?(release.target_path + name)
    release.log(self, "Removing existing target #{release.target_path + name}")
    FileUtils.rm_rf(release.target_path + name)
  end
  
  FileUtils.cp_r release.build_path, release.target_path + name
end