Bin will be removed on June 1, 2014 in favor of http://gist.github.com. Please save all your pastes before then. So long, and thanks for all the fish!×
1
2
3
4
5
6
7
8
9
10
11
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
53
54
55
56
57
58
59
role :web, "vhost"
set :scm, :git
set :scm_verbose, false
set :repository,  "git@codebasehq.com:stoopdev/app/v2.git"
set :branch, 'ahrc'
set :deploy_via, :remote_cache
set :use_sudo, false
set :application, 'ahrc'
set :deploy_to, "/home/user/public_html/vhost/"
set :current_dir, "public"
set :cake_folder, "/home/user/cake"
set :cake_version, "cakephp1.3"
 
ssh_options[:username] = 'user'
ssh_options[:forward_agent] = true
 
namespace :deploy do
  task :start do
  end
 
  task :stop do
  end
 
  task :restart do
  end
 
  desc <<-DESC
    Symlinks shared configuration and directories into the latest release
    Also clear persistent and model cache and sessions and symlink for usability.
  DESC
  task :finalize_update do
    run "rm -rf #{deploy_to}/cake ; rm -rf #{deploy_to}/plugins"
    run "rm -rf #{latest_release}/config/database.php; rm -rf #{latest_release}/config/core.php; rm -rf #{latest_release}/tmp; rm -rf #{latest_release}/webroot/uploads;"
    run "cp -rf #{cake_folder}/#{cake_version}/cake #{deploy_to}/cake; cp -rf #{cake_folder}/plugins2 #{deploy_to}/plugins;"
    run "ln -s #{shared_path}/app/config/database.php #{latest_release}/config/database.php; ln -s #{shared_path}/app/config/core.php #{latest_release}/config/core.php; ln -s #{shared_path}/app/tmp #{latest_release}/tmp; ln -s #{shared_path}/app/webroot/uploads #{latest_release}/webroot/uploads;"
    run "#{sudo} rm -rf #{shared_path}/app/tmp/*; #{sudo} rm -rf #{shared_path}/app/webroot/files"
    run "mkdir #{shared_path}/app/tmp/cache; mkdir #{shared_path}/app/tmp/sessions; mkdir #{shared_path}/app/tmp/logs; mkdir #{shared_path}/app/tmp/tests}; mkdir #{shared_path}/app/webroot/files; mkdir #{shared_path}/app/webroot/files/gravatars"
    run "mkdir #{shared_path}/app/tmp/cache/models; mkdir #{shared_path}/app/tmp/cache/persistent; mkdir #{shared_path}/app/tmp/cache/views; mkdir #{shared_path}/app/tmp/cache/models/projects;"
    run "chmod -R 777 #{shared_path}/app/tmp; chmod -R 777 #{shared_path}/app/webroot/uploads"
    #run "#{cake_folder}/#{cake_version}/cake/console/cake migration reset -app #{latest_release} ; #{cake_folder}/#{cake_version}/cake/console/cake migration up -app #{latest_release}"
 end
 
  task :symlink do
    run "rm -rf #{deploy_to}#{current_dir} && cp -rf #{latest_release} #{deploy_to}#{current_dir}"
  end
 
  task :migrate do
  end
 
  task :restart do
  end
 
namespace :tail do
  task :default do
    run "tail -f #{deploy_to}/logs/*.log"
  end