/
capifony.rb
54 lines (45 loc) · 1.7 KB
/
capifony.rb
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
# Symfony environment on local
set :symfony_env_local, "dev"
# Symfony environment
set :symfony_env_prod, "prod"
# PHP binary to execute
set :php_bin, "php"
def prompt_with_default(var, default, &block)
set(var) do
Capistrano::CLI.ui.ask("#{var} [#{default}] : ", &block)
end
set var, default if eval("#{var.to_s}.empty?")
end
namespace :deploy do
desc <<-DESC
Blank task exists as a hook into which to install your own environment \
specific behaviour.
DESC
task :start, :roles => :app do
# Empty Task to overload with your platform specifics
end
desc <<-DESC
Blank task exists as a hook into which to install your own environment \
specific behaviour.
DESC
task :stop, :roles => :app do
# Empty Task to overload with your platform specifics
end
desc "Overwrite the restart task because symfony doesn't need it."
task :restart do ; end
desc <<-DESC
Prepares one or more servers for deployment. Before you can use any \
of the Capistrano deployment tasks with your project, you will need to \
make sure all of your servers have been prepared with `cap deploy:setup'. When \
you add a new server to your cluster, you can easily run the setup task \
on just that server by specifying the HOSTS environment variable:
$ cap HOSTS=new.server.com deploy:setup
It is safe to run this task on servers that have already been set up; it \
will not destroy any deployed revisions or data.
DESC
task :setup, :except => { :no_release => true } do
dirs = [deploy_to, releases_path, shared_path]
run "#{try_sudo} mkdir -p #{dirs.join(' ')}"
run "#{try_sudo} chmod g+w #{dirs.join(' ')}" if fetch(:group_writable, true)
end
end