Class: Mamiya::Steps::Build

Inherits:
Abstract show all
Defined in:
lib/mamiya/steps/build.rb

Defined Under Namespace

Classes: ApplicationNotSpecified, ScriptFileNotSpecified

Instance Attribute Summary

Attributes inherited from Abstract

#config, #logger, #options, #script

Instance Method Summary collapse

Methods inherited from Abstract

#initialize

Constructor Details

This class inherits a constructor from Mamiya::Steps::Abstract

Instance Method Details

#packageObject



54
55
56
# File 'lib/mamiya/steps/build.rb', line 54

def package
  @package ||= Mamiya::Package.new(package_path)
end

#run!Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/mamiya/steps/build.rb', line 12

def run!
  @exception = nil

  unless script_file
    raise ScriptFileNotSpecified, "Set script files to :script_file"
  end

  unless script.application
    raise ApplicationNotSpecified, ":application should be specified in your script file"
  end

  run_before_build
  run_prepare_build
  run_build

  # XXX: Is this really suitable here? Package class should do?
  copy_deploy_scripts

  

  build_package

  logger.info "Packed."

rescue Exception => e
  @exception = e
  raise
ensure
  logger.warn "Exception occured, cleaning up..." if @exception

  if script_dest.exist?
    FileUtils.remove_entry_secure script_dest
  end

  logger.info "Running script.after_build"
  script.after_build[@exception]

  unless @exception
    logger.info "DONE: #{package_name} built at #{package.path}"
  end
end