Class: Resource::SwapRelease

Inherits:
Base
  • Object
show all
Defined in:
lib/resource/swap_release.rb

Instance Method Summary collapse

Methods inherited from Base

inherited, #not_if, #set_base_defaults, #should_skip?, #unix_mode

Methods included from ClassAttr

included

Methods included from BlockAttr

included

Constructor Details

#initialize(release_path, &block) ⇒ SwapRelease

Returns a new instance of SwapRelease.



7
8
9
10
11
# File 'lib/resource/swap_release.rb', line 7

def initialize release_path, &block
  set_base_defaults
  @release_path = release_path
  self.instance_eval(&block)
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
# File 'lib/resource/swap_release.rb', line 13

def run
  Execution.block 'Swaping releases', "#{@current} ~> #{@release_path}", 'root' do |b|
    b.always_run true
    b.run "touch #{@current.chop}"
    b.run "rm #{@current.chop}"
    b.run "ln -s #{@release_path} #{@current.chop}"
    b.run "chown #{@owner}:#{@owner} #{@current.chop}"
  end
end