forked from Vinsanity/wp-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.rb
74 lines (55 loc) · 1.77 KB
/
deploy.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# config valid only for Capistrano 3.4
lock '3.4.0'
# require Slack config
require './config/slack'
############################################
# Setup WordPress
############################################
set :wp_user, "yourname" # The admin username
set :wp_email, "[email protected]" # The admin email address
set :wp_sitename, "WP Deploy" # The site title
set :wp_localurl, "http://wpdeploy" # Your local environment URL
############################################
# Setup project
############################################
set :application, "wp-deploy"
set :repo_url, "[email protected]:Mixd/wp-deploy.git"
set :scm, :git
set :git_strategy, SubmoduleStrategy
############################################
# Setup Capistrano
############################################
set :log_level, :info
set :use_sudo, false
set :ssh_options, {
forward_agent: true
}
set :keep_releases, 5
############################################
# Linked files and directories (symlinks)
############################################
set :linked_files, %w{wp-config.php .htaccess}
set :linked_dirs, %w{content/uploads}
namespace :deploy do
desc "create WordPress files for symlinking"
task :create_wp_files do
on roles(:app) do
execute :touch, "#{shared_path}/wp-config.php"
execute :touch, "#{shared_path}/.htaccess"
end
end
after 'check:make_linked_dirs', :create_wp_files
desc "Creates robots.txt for non-production envs"
task :create_robots do
on roles(:app) do
if fetch(:stage) != :production then
io = StringIO.new('User-agent: *
Disallow: /')
upload! io, File.join(release_path, "robots.txt")
execute :chmod, "644 #{release_path}/robots.txt"
end
end
end
after :finished, :create_robots
after :finishing, "deploy:cleanup"
end