-
Notifications
You must be signed in to change notification settings - Fork 0
/
capfile
122 lines (97 loc) · 3.42 KB
/
capfile
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
# This defines a deployment "recipe" that you can feed to capistrano
# (http://manuals.rubyonrails.com/read/book/17). It allows you to automate
# (among other things) the deployment of your application.
# =============================================================================
# REQUIRED VARIABLES
# =============================================================================
# You must always specify the application and repository for every recipe. The
# repository must be the git URL of the repository you want this recipe to
# correspond to. The deploy_to path must be the path on each machine that will
# form the root of the application path.
set :application, "dejavu"
role :web, "dejavu.cloudflakes.com"
set :user, "#{application}"
set :password, 'dejavu222'
# =============================================================================
# OPTIONAL VARIABLES
# =============================================================================
default_run_options[:pty] = true
set :repository, "git://github.com/Sheldon/dejavu.git"
set :branch, "master"
set :deploy_to, "."
set :cms_repository, "git://github.com/phpwax/wildfire.git"
set :cms_deploy_to, "./plugins/cms"
set :cms_branch, "v2"
set :wax_folder, "./wax"
set :wax_repository, "git://github.com/phpwax/phpwax.git"
set :wax_branch, "v2-stable"
# =============================================================================
# TASKS
# =============================================================================
# Define tasks that run on all (or only some) of the machines. You can specify
# a role (or set of roles) that each task should be executed on. You can also
# narrow the set of servers to a subset of a role by specifying options, which
# must match the options given for the servers to select (like :primary => true)
namespace :deploy do
desc "First setup of git clone after this point runs git pull"
task :setup do
run "git init"
run "git remote add origin #{repository}"
end
desc "Runs a git pull to update the application"
task :default do
begin
run "ls #{deploy_to}/.git"
rescue
setup
end
run "git pull origin #{branch}"
end
desc "Updates the database on the remote server"
task :syncdb do
run "script/syncdb production"
end
desc "Clears the cache on the remote server"
task :clearcache do
run "rm -f tmp/cache/*"
end
end
namespace :cms do
desc "First setup of git clone after this point runs git pull"
task :setup do
run "mkdir -p #{cms_deploy_to}"
run "cd #{cms_deploy_to} && git init"
run "cd #{cms_deploy_to} && git remote add origin #{cms_repository}"
end
desc "Runs a git pull to update the cms"
task :update do
begin
run "ls #{cms_deploy_to}/.git"
rescue
setup
end
run "cd #{cms_deploy_to} && git pull origin #{cms_branch}"
end
desc "Updates the CMS database"
task :syncdb do
run "script/plugin syncdb cms production"
end
end
namespace :wax do
desc "setup the framework directory"
task :setup do
run "mkdir -p #{wax_folder}"
run "cd #{wax_folder} && git init"
run "cd #{wax_folder} && git remote add origin #{wax_repository}"
end
desc "Run a wax update"
task :update do
begin
run "ls #{wax_folder}/.git"
rescue
setup
end
run "cd #{wax_folder} && git pull origin #{wax_branch}"
end
end