Class: CachedDeploySymfony

Inherits:
CachedDeploy show all
Defined in:
lib/chef-deploy/cached_deploy_symfony.rb

Instance Method Summary collapse

Methods inherited from CachedDeploy

#all_releases, #callback, #check_current_revision_and_noop_if_same, #chef_run, #cleanup, #configuration, #current_path, #deploy, #group, #initialize, #latest_release, #migrate, #node, #oldest_release, #previous_release, #release_dir, #release_path, #restart, #rollback, #run, #run_with_result, #shared_path, #source, #sudo, #user

Constructor Details

This class inherits a constructor from CachedDeploy

Instance Method Details



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/chef-deploy/cached_deploy_symfony.rb', line 6

def symlink(release_to_link=latest_release)
  Chef::Log.info "symlinking and finishing deploy"
  symlink = false
  begin
    chef_run [ "chmod -R g+w #{release_to_link}",
          "rm -rf #{release_to_link}/log #{release_to_link}/cache",
          "ln -nfs #{shared_path}/log #{release_to_link}/log",
          "ln -nfs #{shared_path}/cache #{release_to_link}/cache",
          "chown -R #{user}:#{group} #{release_to_link}"
        ].join(" && ")
    symlink = true
    chef_run "rm -f #{current_path} && ln -nfs #{release_to_link} #{current_path} && chown -R #{user}:#{group} #{current_path}"
  rescue => e
    chef_run "rm -f #{current_path} && ln -nfs #{previous_release(release_to_link)} #{current_path} && chown -R #{user}:#{group} #{current_path}" if symlink
    chef_run "rm -rf #{release_to_link}"
    raise e
  end
end