Class: Mamiya::Steps::Prepare

Inherits:
Abstract
  • Object
show all
Defined in:
lib/mamiya/steps/prepare.rb

Instance Attribute Summary

Attributes inherited from Abstract

#config, #logger, #options

Instance Method Summary collapse

Methods inherited from Abstract

#initialize

Constructor Details

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

Instance Method Details

#given_scriptObject

This class see target_dir’s script



32
# File 'lib/mamiya/steps/prepare.rb', line 32

alias given_script script

#run!Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mamiya/steps/prepare.rb', line 10

def run!
  @exception = nil
  Mamiya.chdir(target) do
    logger.info "Preparing #{target}..."

    script.before_prepare(labels)[]
    script.prepare(labels)[]

    File.write target.join('.mamiya.prepared'), "#{Time.now.to_i}\n"
  end
rescue Exception => e
  @exception = e
  raise e
ensure
  logger.warn "Exception occured, cleaning up..." if @exception

  script.after_prepare(labels)[@exception]

  logger.info "DONE!" unless @exception
end

#scriptObject



34
35
36
37
38
39
40
41
# File 'lib/mamiya/steps/prepare.rb', line 34

def script
  @target_script ||= Mamiya::Script.new.load!(
    target.join('.mamiya.script', target_meta['script'])).tap do |script|
    script.set(:deploy_to, config.deploy_to_for(script.application))
    script.set(:release_path, target)
    script.set(:logger, logger)
  end
end