capdrupal 0.11.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/README.markdown +44 -63
- data/VERSION +1 -1
- data/capdrupal.gemspec +28 -28
- data/lib/capdrupal.rb +0 -272
- data/lib/capistrano/drupal.rb +1 -0
- data/lib/capistrano/tasks/drupal.rake +127 -0
- metadata +30 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cc5619d823734b1d9d997fa25c6a7088a952bec
|
4
|
+
data.tar.gz: f8f0b637a41c13a58353c8ae0d11c52a2c25d751
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2e17b1992ec423f35c5a0cac4faa239da74b3fdd6eced5f1fad27a3895c5551d26d5354ea05a67894bf993c59ba59f290bfde4c3135acc2b3a1c0d453b3a544
|
7
|
+
data.tar.gz: 9ab4b29438b5bf47726e7b79d3ec1bc77d5c02588a0b2345483d5c7fe21f8e8d8c344a441249409cb550c94f99f6422d4d3f92acb8e2c96f765f3f65069057a8
|
data/.gitignore
ADDED
data/README.markdown
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
**Capdrupal is deprecated in favor of https://github.com/capistrano/drupal-deploy**
|
2
|
-
|
3
|
-
|
4
1
|
# Capdrupal
|
5
2
|
|
6
3
|
This gem provides a number of tasks which are useful for deploying Drupal projects with [Capistrano](https://github.com/capistrano/capistrano).
|
7
4
|
|
8
|
-
# Capdrupal version
|
9
5
|
|
6
|
+
## Installation
|
7
|
+
[gems](http://rubygems.org) must be installed on your system first.
|
10
8
|
|
11
|
-
|
12
|
-
--------------------- | ------ | ------------------ | --------------
|
13
|
-
0.x | d7 | 2 | 7.x
|
14
|
-
2.x | master | 3 | 8.x
|
9
|
+
### From RubyGems.org
|
15
10
|
|
11
|
+
$ gem install capdrupal
|
16
12
|
|
17
|
-
|
18
|
-
[gems](http://rubygems.org) must be installed on your system first.
|
13
|
+
### From Github
|
19
14
|
|
20
|
-
|
15
|
+
$ git clone git://github.com/antistatique/capdrupal.git
|
16
|
+
$ cd capdrupal
|
17
|
+
$ gem build capdrupal.gemspec
|
18
|
+
$ gem install capdrupal-{version}.gem
|
19
|
+
|
20
|
+
### Use Bundler to avoid conflict with Capistrano 3
|
21
21
|
|
22
22
|
This version use capistrano 2. Installation with [bundler](http://bundler.io/) let you use both version and avoid conflict.
|
23
23
|
|
@@ -35,25 +35,14 @@ Install the depencies
|
|
35
35
|
|
36
36
|
$ bundle install
|
37
37
|
|
38
|
-
Use capistrano
|
38
|
+
Use capistrano throuw bundle
|
39
39
|
|
40
40
|
$ bundle exec cap deploy
|
41
41
|
|
42
|
-
### From RubyGems.org
|
43
|
-
|
44
|
-
$ gem install capdrupal
|
45
|
-
|
46
|
-
### From Github
|
47
|
-
|
48
|
-
$ git clone git://github.com/antistatique/capdrupal.git
|
49
|
-
$ cd capdrupal
|
50
|
-
$ gem build capdrupal.gemspec
|
51
|
-
$ gem install capdrupal-{version}.gem
|
52
|
-
|
53
42
|
|
54
43
|
## Configuration
|
55
44
|
|
56
|
-
|
45
|
+
It's highly recommended to use Git in your project, but you can also use Subversion or your favorite versionning software. This tutorial his made for multistage deployment, but you can easily use it just for one target.
|
57
46
|
|
58
47
|
First, go to your project directory and launch Capistrano.
|
59
48
|
|
@@ -124,13 +113,9 @@ In fact, Capistrano create directories and symlink to the targeted server. The `
|
|
124
113
|
│ └── 20130527070530
|
125
114
|
└── shared
|
126
115
|
|
127
|
-
Now, every time you want to deploy
|
116
|
+
Now, every time you want to deploy you app !
|
128
117
|
|
129
118
|
$ cap deploy
|
130
|
-
|
131
|
-
If you want to deploy your app and also revert features, clear cache
|
132
|
-
|
133
|
-
$ cap deploy:full
|
134
119
|
|
135
120
|
And if some troubles occur, juste launch the rollback command to return to the previous release.
|
136
121
|
|
@@ -144,40 +129,36 @@ You should then be able to proceed as you would usually, you may want to familia
|
|
144
129
|
This show a list of all avaible commands:
|
145
130
|
|
146
131
|
|
147
|
-
cap
|
148
|
-
cap
|
149
|
-
cap deploy
|
150
|
-
cap deploy:
|
151
|
-
cap deploy:
|
152
|
-
cap deploy:
|
153
|
-
cap deploy:
|
154
|
-
cap deploy:
|
155
|
-
cap deploy:
|
156
|
-
cap deploy:
|
157
|
-
cap deploy:
|
158
|
-
cap deploy:
|
159
|
-
cap deploy:
|
160
|
-
cap deploy:
|
161
|
-
cap
|
162
|
-
cap
|
163
|
-
cap
|
164
|
-
cap
|
165
|
-
cap
|
166
|
-
cap
|
167
|
-
cap
|
168
|
-
cap
|
169
|
-
cap
|
170
|
-
cap
|
171
|
-
cap
|
172
|
-
cap
|
173
|
-
cap
|
174
|
-
cap
|
175
|
-
cap
|
176
|
-
cap
|
177
|
-
cap invoke # Invoke a single command on the remote servers.
|
178
|
-
cap multistage:prepare # Stub out the staging config files.
|
179
|
-
cap production # Set the target stage to `production'.
|
180
|
-
cap shell # Begin an interactive Capistrano session.
|
132
|
+
cap deploy # Deploys your project.
|
133
|
+
cap deploy:check # Test deployment dependencies.
|
134
|
+
cap deploy:cleanup # Clean up old releases.
|
135
|
+
cap deploy:cold # Deploys and starts a `cold' application.
|
136
|
+
cap deploy:create_symlink # Updates the symlink to the most recently deployed version.
|
137
|
+
cap deploy:pending # Displays the commits since your last deploy.
|
138
|
+
cap deploy:pending:diff # Displays the `diff' since your last deploy.
|
139
|
+
cap deploy:rollback # Rolls back to a previous version and restarts.
|
140
|
+
cap deploy:rollback:code # Rolls back to the previously deployed version.
|
141
|
+
cap deploy:setup # Prepares one or more servers for deployment.
|
142
|
+
cap deploy:symlink # Deprecated.
|
143
|
+
cap deploy:update # Copies your project and updates the symlink.
|
144
|
+
cap deploy:update_code # Copies your project to the remote servers.
|
145
|
+
cap deploy:upload # Copy files to the currently deployed version.
|
146
|
+
cap dev # Set the target stage to `dev'.
|
147
|
+
cap drupal:symlink_shared # Symlinks static directories and static files that need to remain between d...
|
148
|
+
cap drush:backupdb # Backup the database
|
149
|
+
cap drush:cache_clear # Clear the drupal cache
|
150
|
+
cap drush:feature_revert # Revert feature
|
151
|
+
cap drush:get # Gets drush and installs it
|
152
|
+
cap drush:site_offline # Set the site offline
|
153
|
+
cap drush:site_online # Set the site online
|
154
|
+
cap drush:updatedb # Run Drupal database migrations if required
|
155
|
+
cap files:pull # Pull drupal sites files (from remote to local)
|
156
|
+
cap files:push # Push drupal sites files (from local to remote)
|
157
|
+
cap git:push_deploy_tag # Place release tag into Git and push it to origin server.
|
158
|
+
cap invoke # Invoke a single command on the remote servers.
|
159
|
+
cap multistage:prepare # Stub out the staging config files.
|
160
|
+
cap prod # Set the target stage to `prod'.
|
161
|
+
cap shell # Begin an interactive Capistrano session.
|
181
162
|
|
182
163
|
|
183
164
|
## Credits
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
2.0.0
|
data/capdrupal.gemspec
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'capdrupal'
|
8
|
+
spec.version = '2.0.0'
|
9
|
+
spec.license = 'MIT'
|
10
|
+
spec.authors = [ "Simon Perdrisat", "Gilles Doge" ]
|
11
|
+
spec.email = 'gilles.doge@gmail.com'
|
12
|
+
spec.homepage = %q{http://github.com/antistatique/capdrupal/}
|
13
|
+
|
14
|
+
spec.platform = Gem::Platform::RUBY
|
15
|
+
spec.description = <<-DESC
|
16
|
+
A set of tasks for deploying Drupal 8 projects with Capistrano 3 and the help of Drush.
|
10
17
|
DESC
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
s.add_dependency 'capistrano', '~> 2.13', '>= 2.13.4'
|
25
|
-
s.add_dependency 'railsless-deploy', '~> 1.1', '>= 1.1.2'
|
26
|
-
|
27
|
-
s.authors = [ "Simon Perdrisat", "Gilles Doge", "Robert Wohleb", "Kim Pepper" ]
|
28
|
-
s.email = 'gilles.doge@gmail.com'
|
29
|
-
s.homepage = %q{http://github.com/antistatique/capdrupal/}
|
18
|
+
spec.summary = 'A set of tasks for deploying Drupal 8 projects with Capistrano 3'
|
19
|
+
|
20
|
+
|
21
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
|
+
spec.files = `git ls-files`.split($/)
|
23
|
+
specrequire_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_dependency 'capistrano', '~> 3.0', '>= 3.2.0'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.1'
|
29
|
+
|
30
30
|
end
|
data/lib/capdrupal.rb
CHANGED
@@ -1,272 +0,0 @@
|
|
1
|
-
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
-
|
3
|
-
require 'capistrano/recipes/deploy/scm'
|
4
|
-
require 'capistrano/recipes/deploy/strategy'
|
5
|
-
require 'railsless-deploy'
|
6
|
-
|
7
|
-
# =========================================================================
|
8
|
-
# These variables may be set in the client capfile if their default values
|
9
|
-
# are not sufficient.
|
10
|
-
# =========================================================================
|
11
|
-
|
12
|
-
_cset :scm, :git
|
13
|
-
_cset :deploy_via, :remote_cache
|
14
|
-
_cset :branch, "master"
|
15
|
-
_cset :git_enable_submodules, true
|
16
|
-
|
17
|
-
_cset :download_drush, false
|
18
|
-
_cset(:drush_cmd) { download_drush ? "#{shared_path}/drush/drush" : "drush" }
|
19
|
-
|
20
|
-
_cset :runner_group, "www-data"
|
21
|
-
_cset :group_writable, false
|
22
|
-
|
23
|
-
_cset(:deploy_to) { "/var/www/#{application}" }
|
24
|
-
_cset(:app_path) { "drupal" }
|
25
|
-
_cset :shared_children, false
|
26
|
-
|
27
|
-
_cset :backup_path, "backups"
|
28
|
-
_cset :remote_tmp_dir, "/tmp"
|
29
|
-
|
30
|
-
if download_drush
|
31
|
-
depend :remote, :command, "curl"
|
32
|
-
end
|
33
|
-
|
34
|
-
# This is an optional step that can be defined.
|
35
|
-
#after "deploy", "git:push_deploy_tag"
|
36
|
-
|
37
|
-
after "deploy:finalize_update" do
|
38
|
-
drupal.symlink_shared
|
39
|
-
end
|
40
|
-
|
41
|
-
namespace :deploy do
|
42
|
-
desc <<-DESC
|
43
|
-
Prepares one or more servers for deployment. Before you can use any \
|
44
|
-
of the Capistrano deployment tasks with your project, you will need to \
|
45
|
-
make sure all of your servers have been prepared with `cap deploy:setup'. When \
|
46
|
-
you add a new server to your cluster, you can easily run the setup task \
|
47
|
-
on just that server by specifying the HOSTS environment variable:
|
48
|
-
|
49
|
-
$ cap HOSTS=new.server.com deploy:setup
|
50
|
-
|
51
|
-
It is safe to run this task on servers that have already been set up; it \
|
52
|
-
will not destroy any deployed revisions or data.
|
53
|
-
DESC
|
54
|
-
task :setup, :except => { :no_release => true } do
|
55
|
-
dirs = [deploy_to, releases_path, shared_path].join(' ')
|
56
|
-
run "#{try_sudo} mkdir -p #{releases_path} #{shared_path}"
|
57
|
-
run "#{try_sudo} chown -R #{user}:#{runner_group} #{deploy_to}"
|
58
|
-
if shared_children.size > 0
|
59
|
-
sub_dirs = shared_children.map { |d| File.join(shared_path, d) }
|
60
|
-
run "#{try_sudo} mkdir -p #{sub_dirs.join(' ')}"
|
61
|
-
run "#{try_sudo} chmod 2775 #{sub_dirs.join(' ')}"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
desc <<-DESC
|
66
|
-
Deploy your project and do an updatedb, feature revert, cache clear...
|
67
|
-
DESC
|
68
|
-
task :full do
|
69
|
-
deploy
|
70
|
-
|
71
|
-
if download_drush
|
72
|
-
drush.get
|
73
|
-
end
|
74
|
-
|
75
|
-
drupal.site_offline
|
76
|
-
drupal.updatedb
|
77
|
-
drupal.cache_clear
|
78
|
-
drupal.feature_revert
|
79
|
-
drupal.site_online
|
80
|
-
drupal.cache_clear
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
|
85
|
-
namespace :drupal do
|
86
|
-
desc "Symlinks static directories and static files that need to remain between deployments"
|
87
|
-
task :symlink_shared, :roles => :app, :except => { :no_release => true } do
|
88
|
-
if shared_children
|
89
|
-
# Creating symlinks for shared directories
|
90
|
-
shared_children.each do |link|
|
91
|
-
run "#{try_sudo} mkdir -p #{shared_path}/#{link}"
|
92
|
-
run "#{try_sudo} sh -c 'if [ -d #{release_path}/#{link} ] ; then rm -rf #{release_path}/#{link}; fi'"
|
93
|
-
run "#{try_sudo} ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
if shared_files
|
98
|
-
# Creating symlinks for shared files
|
99
|
-
shared_files.each do |link|
|
100
|
-
link_dir = File.dirname("#{shared_path}/#{link}")
|
101
|
-
run "#{try_sudo} mkdir -p #{link_dir}"
|
102
|
-
run "#{try_sudo} touch #{shared_path}/#{link}"
|
103
|
-
run "#{try_sudo} ln -nfs #{shared_path}/#{link} #{release_path}/#{link}"
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
desc 'Run any drush command'
|
109
|
-
task :drush do
|
110
|
-
drush_command = Capistrano::CLI.ui.ask "Drush command you want to run (eg. 'cache-rebuild'). Type 'help' to have a list of avaible command."
|
111
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} #{drush_command}"
|
112
|
-
end
|
113
|
-
|
114
|
-
desc "Set the site offline"
|
115
|
-
task :site_offline do
|
116
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} vset site_offline 1 -y"
|
117
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} vset maintenance_mode 1 -y"
|
118
|
-
end
|
119
|
-
|
120
|
-
desc "Backup the database using backup and migrate"
|
121
|
-
task :backupdb, :on_error => :continue do
|
122
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} bam-backup"
|
123
|
-
end
|
124
|
-
|
125
|
-
desc "Run Drupal database migrations if required"
|
126
|
-
task :updatedb, :on_error => :continue do
|
127
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} updatedb -y"
|
128
|
-
end
|
129
|
-
|
130
|
-
desc "Clear All the cache"
|
131
|
-
task :cache_clear do
|
132
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} cache-clear all"
|
133
|
-
end
|
134
|
-
|
135
|
-
desc "Revert feature"
|
136
|
-
task :feature_revert do
|
137
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} features-revert-all -y"
|
138
|
-
end
|
139
|
-
|
140
|
-
desc "Set the site online"
|
141
|
-
task :site_online do
|
142
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} vset site_offline 0 -y"
|
143
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} vset maintenance_mode 0 -y"
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
namespace :files do
|
148
|
-
desc "Pull drupal sites files (from remote to local)"
|
149
|
-
task :pull, :roles => :app, :except => { :no_release => true } do
|
150
|
-
remote_files_dir = "#{current_path}/#{app_path}/sites/default/files/"
|
151
|
-
local_files_dir = "#{app_path}/sites/default/files/"
|
152
|
-
|
153
|
-
run_locally("rsync --recursive --times --rsh=ssh --compress --human-readable --progress #{user}@#{domain}:#{remote_files_dir} #{local_files_dir}")
|
154
|
-
end
|
155
|
-
|
156
|
-
desc "Push drupal sites files (from local to remote)"
|
157
|
-
task :push, :roles => :app, :except => { :no_release => true } do
|
158
|
-
if Capistrano::CLI.ui.agree("Do you really want to push your local files to the server? This can ovewrite files. (y/N)") then
|
159
|
-
remote_files_dir = "#{current_path}/#{app_path}/sites/default/files/"
|
160
|
-
local_files_dir = "#{app_path}/sites/default/files/"
|
161
|
-
|
162
|
-
run_locally("rsync --recursive --times --rsh=ssh --compress --human-readable --progress #{local_files_dir} #{user}@#{domain}:#{remote_files_dir}")
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
namespace :git do
|
168
|
-
|
169
|
-
desc "Place release tag into Git and push it to origin server."
|
170
|
-
task :push_deploy_tag do
|
171
|
-
user = `git config --get user.name`
|
172
|
-
email = `git config --get user.email`
|
173
|
-
tag = "release_#{release_name}"
|
174
|
-
if exists?(:stage)
|
175
|
-
tag = "#{stage}_#{tag}"
|
176
|
-
end
|
177
|
-
puts `git tag #{tag} #{revision} -m "Deployed by #{user} <#{email}>"`
|
178
|
-
puts `git push origin tag #{tag}`
|
179
|
-
end
|
180
|
-
|
181
|
-
end
|
182
|
-
|
183
|
-
namespace :drush do
|
184
|
-
desc "Gets drush and installs it"
|
185
|
-
task :get, :roles => :app, :except => { :no_release => true } do
|
186
|
-
run "#{try_sudo} cd #{shared_path} && curl -LO -s https://ftp.drupal.org/files/projects/drush-7.x-5.8.tar.gz && tar -xf drush-7.x-5.8.tar.gz && rm drush-7.x-5.8.tar.gz"
|
187
|
-
run "#{try_sudo} cd #{shared_path} && chmod u+x drush/drush"
|
188
|
-
end
|
189
|
-
|
190
|
-
end
|
191
|
-
|
192
|
-
# Inspired by Capifony project
|
193
|
-
namespace :database do
|
194
|
-
namespace :dump do
|
195
|
-
task :remote do
|
196
|
-
filename = "#{application}_dump.#{Time.now.utc.strftime("%Y%m%d%H%M%S")}.sql.gz"
|
197
|
-
sqlfile = "#{remote_tmp_dir}/#{filename}"
|
198
|
-
|
199
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} sql-dump | gzip -9 > #{sqlfile}"
|
200
|
-
|
201
|
-
FileUtils::mkdir_p("#{backup_path}")
|
202
|
-
|
203
|
-
download(sqlfile, "#{backup_path}/#{filename}")
|
204
|
-
|
205
|
-
begin
|
206
|
-
FileUtils.ln_sf(filename, "#{backup_path}/#{application}_dump.latest.sql.gz")
|
207
|
-
rescue Exception # fallback for file systems that don't support symlinks
|
208
|
-
FileUtils.cp_r("#{backup_path}/#{filename}", "#{backup_path}/#{application}_dump.latest.sql.gz")
|
209
|
-
end
|
210
|
-
|
211
|
-
run "rm #{sqlfile}"
|
212
|
-
end
|
213
|
-
|
214
|
-
task :local do
|
215
|
-
filename = "#{application}.local_dump.#{Time.now.utc.strftime("%Y%m%d%H%M%S")}.sql.gz"
|
216
|
-
sqlfile = "#{backup_path}/#{filename}"
|
217
|
-
|
218
|
-
FileUtils::mkdir_p("#{backup_path}")
|
219
|
-
|
220
|
-
run_locally "cd #{app_path} && drush sql-dump | gzip -9 > ../#{sqlfile}"
|
221
|
-
|
222
|
-
begin
|
223
|
-
FileUtils.ln_sf(sqlfile, "#{backup_path}/#{application}.local_dump.latest.sql.gz")
|
224
|
-
rescue Exception # fallback for file systems that don't support symlinks
|
225
|
-
FileUtils.cp_r(sqlfile, "#{backup_path}/#{application}.local_dump.latest.sql.gz")
|
226
|
-
end
|
227
|
-
|
228
|
-
sqlfile
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
namespace :copy do
|
233
|
-
desc "Copy remote database into your local database"
|
234
|
-
task :to_local do
|
235
|
-
gzfile = "#{backup_path}/#{application}_dump.latest.sql.gz"
|
236
|
-
sqlfile = "#{backup_path}/#{application}_dump.sql"
|
237
|
-
|
238
|
-
database.dump.remote
|
239
|
-
|
240
|
-
# be sure the file not already exist before un-gziping it
|
241
|
-
if File.exist?(sqlfile)
|
242
|
-
FileUtils.rm(sqlfile)
|
243
|
-
end
|
244
|
-
|
245
|
-
f = File.new(sqlfile, "a+")
|
246
|
-
gz = Zlib::GzipReader.new(File.open(gzfile, "r"))
|
247
|
-
f << gz.read
|
248
|
-
f.close
|
249
|
-
|
250
|
-
run_locally "cd #{app_path} && drush sql-connect < ../#{sqlfile}"
|
251
|
-
|
252
|
-
FileUtils.rm(sqlfile)
|
253
|
-
end
|
254
|
-
|
255
|
-
desc "Copy local database to the remote database"
|
256
|
-
task :to_remote do
|
257
|
-
filename = "#{application}.local_dump.#{Time.now.utc.strftime("%Y%m%d%H%M%S")}.sql.gz"
|
258
|
-
|
259
|
-
if Capistrano::CLI.ui.agree("Do you really want to replace remote database by your local one? (y/N)") then
|
260
|
-
gzfile = database.dump.local
|
261
|
-
|
262
|
-
upload(gzfile, "#{remote_tmp_dir}/#{filename}")
|
263
|
-
|
264
|
-
mysqlcommand = capture("#{drush_cmd} -r #{latest_release}/#{app_path} sql-connect")
|
265
|
-
run "zcat #{remote_tmp_dir}/#{filename} | #{mysqlcommand}"
|
266
|
-
|
267
|
-
run "rm #{remote_tmp_dir}/#{filename}"
|
268
|
-
end
|
269
|
-
end
|
270
|
-
end
|
271
|
-
end
|
272
|
-
end
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../tasks/drupal.rake', __FILE__)
|
@@ -0,0 +1,127 @@
|
|
1
|
+
|
2
|
+
# Load default values the capistrano 3.x way.
|
3
|
+
# See https://github.com/capistrano/capistrano/pull/605
|
4
|
+
namespace :load do
|
5
|
+
task :defaults do
|
6
|
+
set :composer_download_url, "https://getcomposer.org/installer"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
# Specific Drupal tasks
|
12
|
+
namespace :drupal do
|
13
|
+
|
14
|
+
desc 'Run any drush command'
|
15
|
+
task :drush do
|
16
|
+
ask(:drush_command, "Drush command you want to run (eg. 'cache-rebuild'). Type 'help' to have a list of avaible command.")
|
17
|
+
on roles(:app) do
|
18
|
+
within fetch(:drupal_path) do
|
19
|
+
execute :drush, fetch(:drush_command)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Show logs'
|
25
|
+
task :logs do
|
26
|
+
on roles(:app) do
|
27
|
+
within fetch(:drupal_path) do
|
28
|
+
execute :drush, 'watchdog-show --tail'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
desc 'Provides information about things that may be wrong in your Drupal installation, if any.'
|
34
|
+
task :requirements do
|
35
|
+
on roles(:app) do
|
36
|
+
within fetch(:drupal_path) do
|
37
|
+
execute :drush, 'core-requirements'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
desc 'Open an interactive shell on a Drupal site.'
|
43
|
+
task :cli do
|
44
|
+
on roles(:app) do
|
45
|
+
within fetch(:drupal_path) do
|
46
|
+
execute :drush, 'core-cli'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
namespace :config do
|
52
|
+
desc 'List any pending database updates.'
|
53
|
+
task :import do
|
54
|
+
on roles(:app) do
|
55
|
+
within fetch(:drupal_path) do
|
56
|
+
execute :drush, 'config-import'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
namespace :update do
|
63
|
+
desc 'List any pending database updates.'
|
64
|
+
task :updatedb_status do
|
65
|
+
on roles(:app) do
|
66
|
+
within fetch(:drupal_path) do
|
67
|
+
execute :drush, 'updatedb-status'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
desc 'Apply any database updates required (as with running update.php).'
|
73
|
+
task :updatedb do
|
74
|
+
on roles(:app) do
|
75
|
+
within fetch(:drupal_path) do
|
76
|
+
execute :drush, 'updatedb'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
desc 'Show a report of available minor updates to Drupal core and contrib projects.'
|
82
|
+
task :updatedb_status do
|
83
|
+
on roles(:app) do
|
84
|
+
within fetch(:drupal_path) do
|
85
|
+
execute :drush, 'pm-refresh'
|
86
|
+
execute :drush, 'pm-updatestatus'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
namespace :cache do
|
93
|
+
desc 'Clear all caches'
|
94
|
+
task :clear do
|
95
|
+
on roles(:app) do
|
96
|
+
within fetch(:drupal_path) do
|
97
|
+
execute :drush, 'cache-rebuild'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
# Install composer
|
106
|
+
namespace :composer do
|
107
|
+
desc "Install composer"
|
108
|
+
task :install do
|
109
|
+
on roles(:app) do
|
110
|
+
within shared_path do
|
111
|
+
execute 'curl', '-s' ,fetch(:composer_download_url) , '| php'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Install drush
|
118
|
+
namespace :drush do
|
119
|
+
desc "Install Drush"
|
120
|
+
task :install do
|
121
|
+
on roles(:app) do
|
122
|
+
within shared_path do
|
123
|
+
execute :composer, 'require drush/drush:dev-master'
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
metadata
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capdrupal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Perdrisat
|
8
8
|
- Gilles Doge
|
9
|
-
- Robert Wohleb
|
10
|
-
- Kim Pepper
|
11
9
|
autorequire:
|
12
10
|
bindir: bin
|
13
11
|
cert_chain: []
|
14
|
-
date:
|
12
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
15
13
|
dependencies:
|
16
14
|
- !ruby/object:Gem::Dependency
|
17
15
|
name: capistrano
|
@@ -19,52 +17,62 @@ dependencies:
|
|
19
17
|
requirements:
|
20
18
|
- - "~>"
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
20
|
+
version: '3.0'
|
23
21
|
- - ">="
|
24
22
|
- !ruby/object:Gem::Version
|
25
|
-
version: 2.
|
23
|
+
version: 3.2.0
|
26
24
|
type: :runtime
|
27
25
|
prerelease: false
|
28
26
|
version_requirements: !ruby/object:Gem::Requirement
|
29
27
|
requirements:
|
30
28
|
- - "~>"
|
31
29
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
30
|
+
version: '3.0'
|
33
31
|
- - ">="
|
34
32
|
- !ruby/object:Gem::Version
|
35
|
-
version: 2.
|
33
|
+
version: 3.2.0
|
36
34
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
35
|
+
name: bundler
|
38
36
|
requirement: !ruby/object:Gem::Requirement
|
39
37
|
requirements:
|
40
38
|
- - "~>"
|
41
39
|
- !ruby/object:Gem::Version
|
42
|
-
version: '1.
|
43
|
-
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 1.1.2
|
46
|
-
type: :runtime
|
40
|
+
version: '1.3'
|
41
|
+
type: :development
|
47
42
|
prerelease: false
|
48
43
|
version_requirements: !ruby/object:Gem::Requirement
|
49
44
|
requirements:
|
50
45
|
- - "~>"
|
51
46
|
- !ruby/object:Gem::Version
|
52
|
-
version: '1.
|
53
|
-
|
47
|
+
version: '1.3'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rake
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
54
53
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
54
|
+
version: '10.1'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.1'
|
56
62
|
description: |2
|
57
|
-
A set of tasks for deploying Drupal projects with Capistrano and the help of Drush.
|
63
|
+
A set of tasks for deploying Drupal 8 projects with Capistrano 3 and the help of Drush.
|
58
64
|
email: gilles.doge@gmail.com
|
59
65
|
executables: []
|
60
66
|
extensions: []
|
61
|
-
extra_rdoc_files:
|
62
|
-
- README.markdown
|
67
|
+
extra_rdoc_files: []
|
63
68
|
files:
|
69
|
+
- ".gitignore"
|
64
70
|
- README.markdown
|
65
71
|
- VERSION
|
66
72
|
- capdrupal.gemspec
|
67
73
|
- lib/capdrupal.rb
|
74
|
+
- lib/capistrano/drupal.rb
|
75
|
+
- lib/capistrano/tasks/drupal.rake
|
68
76
|
homepage: http://github.com/antistatique/capdrupal/
|
69
77
|
licenses:
|
70
78
|
- MIT
|
@@ -85,8 +93,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
93
|
version: '0'
|
86
94
|
requirements: []
|
87
95
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.2.2
|
89
97
|
signing_key:
|
90
98
|
specification_version: 4
|
91
|
-
summary: A set of tasks for deploying Drupal projects with Capistrano
|
99
|
+
summary: A set of tasks for deploying Drupal 8 projects with Capistrano 3
|
92
100
|
test_files: []
|