capdrupal 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +98 -23
- data/VERSION +1 -1
- data/capdrupal.gemspec +1 -1
- data/lib/capdrupal.rb +2 -1
- metadata +2 -2
data/README.markdown
CHANGED
@@ -1,27 +1,12 @@
|
|
1
1
|
# Capdrupal
|
2
2
|
|
3
|
-
This gem provides a number of tasks which are useful for deploying Drupal projects with capistrano.
|
3
|
+
This gem provides a number of tasks which are useful for deploying Drupal projects with [Capistrano](https://github.com/capistrano/capistrano).
|
4
4
|
|
5
|
-
Credit goes to https://github.com/previousnext/capistrano-drupal for many ideas here.
|
6
5
|
|
7
6
|
## Installation
|
8
|
-
|
7
|
+
[gems](http://rubygems.org) must be installed on your system first.
|
9
8
|
|
10
|
-
|
11
|
-
* rubygems
|
12
|
-
* railsless-deploy
|
13
|
-
|
14
|
-
You can check to see a list of installed gems by running this.
|
15
|
-
|
16
|
-
$ gem query --local
|
17
|
-
|
18
|
-
If any of these gems is missing you can install them with:
|
19
|
-
|
20
|
-
$ gem install gemname
|
21
|
-
|
22
|
-
Finally install the capistrano-drupal recipes as a gem.
|
23
|
-
|
24
|
-
### From RubyGems.org
|
9
|
+
### From RubyGems.org
|
25
10
|
|
26
11
|
$ gem install capdrupal
|
27
12
|
|
@@ -32,14 +17,98 @@ Finally install the capistrano-drupal recipes as a gem.
|
|
32
17
|
$ gem build capdrupal.gemspec
|
33
18
|
$ gem install capdrupal-{version}.gem
|
34
19
|
|
20
|
+
|
21
|
+
## Configuration
|
22
|
+
|
23
|
+
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.
|
24
|
+
|
25
|
+
First, go to your project directory and launch Capistrano.
|
26
|
+
|
27
|
+
$ cd path/to/your/directory/
|
28
|
+
$ capify .
|
29
|
+
|
30
|
+
Capistrano create two files `capfile` and `config/deploy.rb`. Open `capfile` and set the depencies.
|
31
|
+
|
32
|
+
require 'rubygems'
|
33
|
+
require 'capdrupal'
|
34
|
+
load 'config/deploy'
|
35
|
+
|
36
|
+
Then, go to `config/deploy.rb` to set the parameters of your project. First you have to define the general informations (generaly use by multiple server) and the different stage you have.
|
37
|
+
|
38
|
+
# USER
|
39
|
+
set :user, "name"
|
40
|
+
set :group, "name"
|
41
|
+
set :runner_group, "name"
|
42
|
+
|
43
|
+
# APP
|
44
|
+
set :application, "appName"
|
45
|
+
set :stages, %w(stage1 stage2)
|
46
|
+
|
47
|
+
The specific Drupal informations and if you have already or not [Drush](https://drupal.org/project/drush) installed on your server (if your not sure, keep it TRUE).
|
48
|
+
|
49
|
+
# DRUPAL
|
50
|
+
set :app_path, "drupal"
|
51
|
+
set :shared_children, ['drupal/sites/default/files']
|
52
|
+
set :shared_files, ['drupal/sites/default/settings.php']
|
53
|
+
set :download_drush, true
|
54
|
+
|
55
|
+
Then, all the informations related to your Git repository
|
56
|
+
|
57
|
+
set :scm, "git"
|
58
|
+
set :repository, "git@github.com:user/repo-name.git"
|
59
|
+
|
60
|
+
Finally, set the other Capistrano related options, the number of realeases you want and the cleanup at the end of the deployment.
|
61
|
+
|
62
|
+
set :use_sudo, false
|
63
|
+
default_run_options[:pty] = true
|
64
|
+
ssh_options[:forward_agent] = true
|
65
|
+
role :app, domain
|
66
|
+
role :db, domain
|
67
|
+
|
68
|
+
set :keep_releases, 5
|
69
|
+
after "deploy:update", "deploy:cleanup"
|
70
|
+
|
71
|
+
Awesome, your configuration file is almost complete ! From now and whenever you want to add a new stage, create an new file in `config/deploy/` with in :
|
72
|
+
|
73
|
+
# Stage name (same as your filename, for example stage1.rb)
|
74
|
+
set :stages, "stage1"
|
75
|
+
|
76
|
+
# The Git branch you want to use
|
77
|
+
set :branch, "dev"
|
78
|
+
|
79
|
+
# The domain and the path to your app directory
|
80
|
+
set :domain, "staging.domain.com"
|
81
|
+
set :deploy_to, "/home/path/to/my/app/"
|
82
|
+
|
83
|
+
# And the user if it's not the same as define in deploy.rb
|
84
|
+
set :user, "staging"
|
85
|
+
set :group, "staging"
|
86
|
+
set :runner_group, "staging"
|
87
|
+
|
35
88
|
## Usage
|
36
89
|
|
37
|
-
|
90
|
+
So, after configuration come action ! The first time, you have to run this command with the choosing stage.
|
91
|
+
|
92
|
+
$ cap stage1 deploy:setup
|
93
|
+
|
94
|
+
In fact, Capistrano create directories and symlink to the targeted server. The `shared` directory contains all shared files of your app who don't need to be change. `Releases` contains the different releases of your app with a number define in `deploy.rb` and finally `current` is the symlink who target the right release.
|
95
|
+
|
96
|
+
myApp
|
97
|
+
├── current -> /home/myApp/releases/20130527070530
|
98
|
+
├── releases
|
99
|
+
│ ├── 20130527065508
|
100
|
+
│ ├── 20130527065907
|
101
|
+
│ └── 20130527070530
|
102
|
+
└── shared
|
103
|
+
|
104
|
+
Now, every time you want to deploy you app !
|
105
|
+
|
106
|
+
$ cap stage1 deploy
|
107
|
+
|
108
|
+
And if some troubles occur, juste launch the rollback command to return to the previous release.
|
109
|
+
|
110
|
+
$ cap deploy:rollback
|
38
111
|
|
39
|
-
require 'rubygems'
|
40
|
-
require 'railsless-deploy'
|
41
|
-
require 'capistrano-drupal'
|
42
|
-
load 'config/deploy'
|
43
112
|
|
44
113
|
You should then be able to proceed as you would usually, you may want to familiarise yourself with the truncated list of tasks, you can get a full list with:
|
45
114
|
|
@@ -78,3 +147,9 @@ This show a list of all avaible commands:
|
|
78
147
|
cap prod # Set the target stage to `prod'.
|
79
148
|
cap shell # Begin an interactive Capistrano session.
|
80
149
|
|
150
|
+
|
151
|
+
## Credits
|
152
|
+
|
153
|
+
Inspired by [capistrano-drupal](https://github.com/previousnext/capistrano-drupal).
|
154
|
+
|
155
|
+
Made by [Antistatique](http://www.antistatique.net) who's always looking for new talented developpers ! Just mail us on [hello@antistatique.net](mailto:hello@antistatique.net).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
data/capdrupal.gemspec
CHANGED
data/lib/capdrupal.rb
CHANGED
@@ -37,6 +37,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
37
37
|
drush.cache_clear
|
38
38
|
drush.feature_revert
|
39
39
|
drush.site_online
|
40
|
+
drush.cache_clear
|
40
41
|
end
|
41
42
|
|
42
43
|
# This is an optional step that can be defined.
|
@@ -157,7 +158,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
157
158
|
|
158
159
|
desc "Revert feature"
|
159
160
|
task :feature_revert, :on_error => :continue do
|
160
|
-
run "#{drush_cmd} -r #{latest_release}/#{app_path} features-revert-all"
|
161
|
+
run "#{drush_cmd} -r #{latest_release}/#{app_path} features-revert-all -y"
|
161
162
|
end
|
162
163
|
|
163
164
|
desc "Set the site online"
|
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.9.
|
4
|
+
version: 0.9.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-06-
|
15
|
+
date: 2013-06-17 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: capistrano
|