capdrupal 0.9.8 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +53 -45
- data/VERSION +1 -1
- data/capdrupal.gemspec +1 -1
- data/lib/capdrupal.rb +66 -53
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2473c00739299636685fdf30bb850053de863be0
|
4
|
+
data.tar.gz: c610c19cc38b01f01814bd485527d7c636c02554
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32df96a6ee3ebedf0c577a4dd5bbfef7173c117129ded83932e4f4f91cfc01f21c70387fbea6976525316edaa33ad86df600f03a4984fa132369d1019e32529f
|
7
|
+
data.tar.gz: 8008cf06155af8497cf402d6589a1c0c65aa82446f4b416581ff2fe617bbb3625e9536728d6bcfb62de719bd2a37c76aed4e6105031096f25d24146932fa9566
|
data/README.markdown
CHANGED
@@ -14,18 +14,7 @@ Capdrupal Gem Version | Branch | Capistrano Version | Drupal Version
|
|
14
14
|
## Installation
|
15
15
|
[gems](http://rubygems.org) must be installed on your system first.
|
16
16
|
|
17
|
-
###
|
18
|
-
|
19
|
-
$ gem install capdrupal
|
20
|
-
|
21
|
-
### From Github
|
22
|
-
|
23
|
-
$ git clone git://github.com/antistatique/capdrupal.git
|
24
|
-
$ cd capdrupal
|
25
|
-
$ gem build capdrupal.gemspec
|
26
|
-
$ gem install capdrupal-{version}.gem
|
27
|
-
|
28
|
-
### Use Bundler to avoid conflict with Capistrano 3
|
17
|
+
### With Bundler (highly recommanded)
|
29
18
|
|
30
19
|
This version use capistrano 2. Installation with [bundler](http://bundler.io/) let you use both version and avoid conflict.
|
31
20
|
|
@@ -43,14 +32,25 @@ Install the depencies
|
|
43
32
|
|
44
33
|
$ bundle install
|
45
34
|
|
46
|
-
Use capistrano
|
35
|
+
Use capistrano throw bundle
|
47
36
|
|
48
37
|
$ bundle exec cap deploy
|
49
38
|
|
39
|
+
### From RubyGems.org
|
40
|
+
|
41
|
+
$ gem install capdrupal
|
42
|
+
|
43
|
+
### From Github
|
44
|
+
|
45
|
+
$ git clone git://github.com/antistatique/capdrupal.git
|
46
|
+
$ cd capdrupal
|
47
|
+
$ gem build capdrupal.gemspec
|
48
|
+
$ gem install capdrupal-{version}.gem
|
49
|
+
|
50
50
|
|
51
51
|
## Configuration
|
52
52
|
|
53
|
-
|
53
|
+
This was tested with Git, 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.
|
54
54
|
|
55
55
|
First, go to your project directory and launch Capistrano.
|
56
56
|
|
@@ -121,9 +121,13 @@ In fact, Capistrano create directories and symlink to the targeted server. The `
|
|
121
121
|
│ └── 20130527070530
|
122
122
|
└── shared
|
123
123
|
|
124
|
-
Now, every time you want to deploy
|
124
|
+
Now, every time you want to deploy your app !
|
125
125
|
|
126
126
|
$ cap deploy
|
127
|
+
|
128
|
+
If you want to deploy your app and also revert features, clear cache
|
129
|
+
|
130
|
+
$ cap deploy:full
|
127
131
|
|
128
132
|
And if some troubles occur, juste launch the rollback command to return to the previous release.
|
129
133
|
|
@@ -137,36 +141,40 @@ You should then be able to proceed as you would usually, you may want to familia
|
|
137
141
|
This show a list of all avaible commands:
|
138
142
|
|
139
143
|
|
140
|
-
cap
|
141
|
-
cap
|
142
|
-
cap deploy
|
143
|
-
cap deploy:
|
144
|
-
cap deploy:
|
145
|
-
cap deploy:
|
146
|
-
cap deploy:
|
147
|
-
cap deploy:
|
148
|
-
cap deploy:
|
149
|
-
cap deploy:
|
150
|
-
cap deploy:
|
151
|
-
cap deploy:
|
152
|
-
cap deploy:
|
153
|
-
cap deploy:
|
154
|
-
cap
|
155
|
-
cap
|
156
|
-
cap
|
157
|
-
cap
|
158
|
-
cap
|
159
|
-
cap
|
160
|
-
cap drush
|
161
|
-
cap
|
162
|
-
cap
|
163
|
-
cap
|
164
|
-
cap
|
165
|
-
cap
|
166
|
-
cap
|
167
|
-
cap
|
168
|
-
cap
|
169
|
-
cap
|
144
|
+
cap database:copy:to_local # Copy remote database into your local database
|
145
|
+
cap database:copy:to_remote # Copy local database to the remote database
|
146
|
+
cap deploy # Deploys your project.
|
147
|
+
cap deploy:check # Test deployment dependencies.
|
148
|
+
cap deploy:cleanup # Clean up old releases.
|
149
|
+
cap deploy:cold # Deploys and starts a `cold' application.
|
150
|
+
cap deploy:create_symlink # Updates the symlink to the most recently deployed version.
|
151
|
+
cap deploy:full # Deploy your project and do an updatedb, feature revert, cache clear...
|
152
|
+
cap deploy:pending # Displays the commits since your last deploy.
|
153
|
+
cap deploy:pending:diff # Displays the `diff' since your last deploy.
|
154
|
+
cap deploy:rollback # Rolls back to a previous version and restarts.
|
155
|
+
cap deploy:rollback:code # Rolls back to the previously deployed version.
|
156
|
+
cap deploy:setup # Prepares one or more servers for deployment.
|
157
|
+
cap deploy:symlink # Deprecated API.
|
158
|
+
cap deploy:update # Copies your project and updates the symlink.
|
159
|
+
cap deploy:update_code # Copies your project to the remote servers.
|
160
|
+
cap deploy:upload # Copy files to the currently deployed version.
|
161
|
+
cap dev # Set the target stage to `dev'.
|
162
|
+
cap drupal:backupdb # Backup the database using backup and migrate
|
163
|
+
cap drupal:cache_clear # Clear All the cache
|
164
|
+
cap drupal:drush # Run any drush command
|
165
|
+
cap drupal:feature_revert # Revert feature
|
166
|
+
cap drupal:site_offline # Set the site offline
|
167
|
+
cap drupal:site_online # Set the site online
|
168
|
+
cap drupal:symlink_shared # Symlinks static directories and static files that need to remain between deployments
|
169
|
+
cap drupal:updatedb # Run Drupal database migrations if required
|
170
|
+
cap drush:get # Gets drush and installs it
|
171
|
+
cap files:pull # Pull drupal sites files (from remote to local)
|
172
|
+
cap files:push # Push drupal sites files (from local to remote)
|
173
|
+
cap git:push_deploy_tag # Place release tag into Git and push it to origin server.
|
174
|
+
cap invoke # Invoke a single command on the remote servers.
|
175
|
+
cap multistage:prepare # Stub out the staging config files.
|
176
|
+
cap production # Set the target stage to `production'.
|
177
|
+
cap shell # Begin an interactive Capistrano session.
|
170
178
|
|
171
179
|
|
172
180
|
## Credits
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.0
|
data/capdrupal.gemspec
CHANGED
data/lib/capdrupal.rb
CHANGED
@@ -31,25 +31,13 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
31
31
|
depend :remote, :command, "curl"
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
if download_drush
|
37
|
-
drush.get
|
38
|
-
end
|
34
|
+
# This is an optional step that can be defined.
|
35
|
+
#after "deploy", "git:push_deploy_tag"
|
39
36
|
|
37
|
+
after "deploy:finalize_update" do
|
40
38
|
drupal.symlink_shared
|
41
|
-
|
42
|
-
drush.site_offline
|
43
|
-
drush.updatedb
|
44
|
-
drush.cache_clear
|
45
|
-
drush.feature_revert
|
46
|
-
drush.site_online
|
47
|
-
drush.cache_clear
|
48
39
|
end
|
49
40
|
|
50
|
-
# This is an optional step that can be defined.
|
51
|
-
#after "deploy", "git:push_deploy_tag"
|
52
|
-
|
53
41
|
namespace :deploy do
|
54
42
|
desc <<-DESC
|
55
43
|
Prepares one or more servers for deployment. Before you can use any \
|
@@ -73,8 +61,27 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
73
61
|
run "#{try_sudo} chmod 2775 #{sub_dirs.join(' ')}"
|
74
62
|
end
|
75
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
|
76
82
|
end
|
77
83
|
|
84
|
+
|
78
85
|
namespace :drupal do
|
79
86
|
desc "Symlinks static directories and static files that need to remain between deployments"
|
80
87
|
task :symlink_shared, :roles => :app, :except => { :no_release => true } do
|
@@ -97,6 +104,44 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
97
104
|
end
|
98
105
|
end
|
99
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
|
100
145
|
end
|
101
146
|
|
102
147
|
namespace :files do
|
@@ -110,11 +155,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
110
155
|
|
111
156
|
desc "Push drupal sites files (from local to remote)"
|
112
157
|
task :push, :roles => :app, :except => { :no_release => true } do
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
run_locally("rsync --recursive --times --rsh=ssh --compress --human-readable --progress #{local_files_dir} #{user}@#{domain}:#{remote_files_dir}")
|
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/"
|
117
161
|
|
162
|
+
run_locally("rsync --recursive --times --rsh=ssh --compress --human-readable --progress #{local_files_dir} #{user}@#{domain}:#{remote_files_dir}")
|
163
|
+
end
|
118
164
|
end
|
119
165
|
end
|
120
166
|
|
@@ -135,45 +181,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
135
181
|
end
|
136
182
|
|
137
183
|
namespace :drush do
|
138
|
-
|
139
184
|
desc "Gets drush and installs it"
|
140
185
|
task :get, :roles => :app, :except => { :no_release => true } do
|
141
|
-
run "#{try_sudo} cd #{shared_path} && curl -
|
186
|
+
run "#{try_sudo} cd #{shared_path} && curl -O -s http://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"
|
142
187
|
run "#{try_sudo} cd #{shared_path} && chmod u+x drush/drush"
|
143
188
|
end
|
144
189
|
|
145
|
-
desc "Set the site offline"
|
146
|
-
task :site_offline, :on_error => :continue do
|
147
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} vset site_offline 1 -y"
|
148
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} vset maintenance_mode 1 -y"
|
149
|
-
end
|
150
|
-
|
151
|
-
desc "Backup the database"
|
152
|
-
task :backupdb, :on_error => :continue do
|
153
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} bam-backup"
|
154
|
-
end
|
155
|
-
|
156
|
-
desc "Run Drupal database migrations if required"
|
157
|
-
task :updatedb, :on_error => :continue do
|
158
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} updatedb -y"
|
159
|
-
end
|
160
|
-
|
161
|
-
desc "Clear the drupal cache"
|
162
|
-
task :cache_clear, :on_error => :continue do
|
163
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} cache-clear all"
|
164
|
-
end
|
165
|
-
|
166
|
-
desc "Revert feature"
|
167
|
-
task :feature_revert, :on_error => :continue do
|
168
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} features-revert-all -y"
|
169
|
-
end
|
170
|
-
|
171
|
-
desc "Set the site online"
|
172
|
-
task :site_online, :on_error => :continue do
|
173
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} vset site_offline 0 -y"
|
174
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} vset maintenance_mode 0 -y"
|
175
|
-
end
|
176
|
-
|
177
190
|
end
|
178
191
|
|
179
192
|
# Inspired by Capifony project
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capdrupal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Perdrisat
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: capistrano
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
87
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.
|
88
|
+
rubygems_version: 2.2.2
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: A set of tasks for deploying Drupal projects with Capistrano
|