Class: Resource::SwapRelease
Instance Method Summary collapse
-
#initialize(release_path, &block) ⇒ SwapRelease
constructor
A new instance of SwapRelease.
- #run ⇒ Object
Methods inherited from Base
inherited, #not_if, #set_base_defaults, #should_skip?, #unix_mode
Methods included from ClassAttr
Methods included from BlockAttr
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
#run ⇒ Object
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 |