cap-drupal 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.mkd +18 -3
- data/VERSION +1 -1
- data/lib/recipes/drupal.rb +41 -12
- metadata +1 -3
- data/README.rdoc +0 -17
data/README.mkd
CHANGED
@@ -1,19 +1,25 @@
|
|
1
1
|
# Cap Drupal
|
2
2
|
|
3
|
-
Capistrano drupal
|
3
|
+
Capistrano drupal recipes.
|
4
|
+
|
5
|
+
Dump dbs, backup user generated content, clear cache, and rsync to local host.
|
6
|
+
|
7
|
+
This the first releases. Feedbacks, fork and comments welcomed :)
|
4
8
|
|
5
9
|
## Install
|
6
10
|
|
7
|
-
|
11
|
+
# gem install cap-drupal
|
8
12
|
|
9
13
|
|
10
14
|
## Usage
|
11
15
|
|
12
16
|
mkdir config
|
13
17
|
cap-drupal .
|
18
|
+
|
19
|
+
# helper
|
14
20
|
cap multistage:prepare
|
15
21
|
|
16
|
-
Now you have this tree
|
22
|
+
Now you have this tree
|
17
23
|
|
18
24
|
.
|
19
25
|
+--- config
|
@@ -23,3 +29,12 @@ Now you have this tree
|
|
23
29
|
| | +--- preview.rb
|
24
30
|
| +--- deploy.rb
|
25
31
|
+--- Capfile
|
32
|
+
|
33
|
+
## Help
|
34
|
+
|
35
|
+
# list tasks with capistrano
|
36
|
+
cap -T
|
37
|
+
|
38
|
+
# get extend help: ex drupal:clearcache
|
39
|
+
cap -e drupal:clearcache
|
40
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/recipes/drupal.rb
CHANGED
@@ -12,20 +12,27 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
12
12
|
|
13
13
|
namespace :drupal do
|
14
14
|
|
15
|
-
desc
|
15
|
+
desc <<-DESC
|
16
|
+
Clear all drupal caches. Invoke drush cc all.
|
17
|
+
DESC
|
16
18
|
task :clearcache, :roles => :db do
|
17
19
|
run "sudo drush -r \"#{deploy_to}\" cc all"
|
18
20
|
end
|
19
21
|
|
20
22
|
namespace :clean do
|
21
23
|
namespace :db do
|
22
|
-
desc
|
24
|
+
desc <<-DESC
|
25
|
+
List db dumps to delete. Based on timestamp, show the oldest
|
26
|
+
which exceed max_keep_dump.
|
27
|
+
DESC
|
23
28
|
task :check, :roles => :db do
|
24
29
|
dumps_to_delete do |dump|
|
25
30
|
puts "will delete #{dump}"
|
26
31
|
end
|
27
32
|
end
|
28
|
-
desc
|
33
|
+
desc <<-DESC
|
34
|
+
Delete db dumps over max_keep_dump.
|
35
|
+
DESC
|
29
36
|
task :commit, :roles => :db do
|
30
37
|
dumps_to_delete do |dump|
|
31
38
|
run "rm #{dump}"
|
@@ -33,13 +40,18 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
33
40
|
end
|
34
41
|
end
|
35
42
|
namespace :ugc do
|
36
|
-
desc
|
43
|
+
desc <<-DESC
|
44
|
+
List ugc backups to delete. Based on timestamp, show the oldest
|
45
|
+
which exceed max_keep_dump.
|
46
|
+
DESC
|
37
47
|
task :check, :roles => :web do
|
38
48
|
backups_to_delete do |backup|
|
39
49
|
puts "will delete #{backup}"
|
40
50
|
end
|
41
51
|
end
|
42
|
-
desc
|
52
|
+
desc <<-DESC
|
53
|
+
Delete ugc backups over max_keep_backup
|
54
|
+
DESC
|
43
55
|
task :commit, :roles => :web do
|
44
56
|
backups_to_delete do |backup|
|
45
57
|
run "rm -rf #{backup}"
|
@@ -49,19 +61,25 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
49
61
|
end
|
50
62
|
|
51
63
|
namespace :db do
|
52
|
-
desc
|
64
|
+
desc <<-DESC
|
65
|
+
Dump the db to cap user home directory.
|
66
|
+
DESC
|
53
67
|
task :dump, :roles => :db do
|
54
68
|
filename = "#{application}-#{stage}-#{now}.sql"
|
55
69
|
run "sudo drush -r \"#{deploy_to}\" sql-dump > ~/#{filename}"
|
56
70
|
end
|
57
71
|
|
58
|
-
desc
|
72
|
+
desc <<-DESC
|
73
|
+
Download latest db dump to current local dir.
|
74
|
+
DESC
|
59
75
|
task :latest, :roles => :db do
|
60
76
|
dumps = capture("ls -xt ~/#{application}-#{stage}-*sql").split.reverse
|
61
77
|
get(dumps.last, "#{dumps.last.split('/').last}")
|
62
78
|
end
|
63
79
|
|
64
|
-
|
80
|
+
desc <<-DESC
|
81
|
+
Dump the db and download to local dir.
|
82
|
+
DESC
|
65
83
|
task :download, :roles => :db do
|
66
84
|
dump
|
67
85
|
latest
|
@@ -71,12 +89,16 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
71
89
|
# user generated content
|
72
90
|
namespace :ugc do
|
73
91
|
|
74
|
-
desc
|
92
|
+
desc <<-DESC
|
93
|
+
Show the ugc files current size (du -sh).
|
94
|
+
DESC
|
75
95
|
task :size, :role => :web do
|
76
96
|
run "du -sh #{ugc_path}"
|
77
97
|
end
|
78
98
|
|
79
|
-
desc
|
99
|
+
desc <<-DESC
|
100
|
+
Copy user generated content to cap user home.
|
101
|
+
DESC
|
80
102
|
task :backup, :role => :web do
|
81
103
|
size
|
82
104
|
dirname = "~/#{application}-#{stage}-#{now}-ugc"
|
@@ -85,7 +107,10 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
85
107
|
run "touch #{dirname}"
|
86
108
|
end
|
87
109
|
|
88
|
-
desc
|
110
|
+
desc <<-DESC
|
111
|
+
Rsync the latest ugc backup to a local dir.
|
112
|
+
Use a local cache dir so rsync do not transfert same files twice.
|
113
|
+
DESC
|
89
114
|
task :latest, :role => :web do
|
90
115
|
backups = capture("ls -dxt ~/#{application}-#{stage}-*-ugc").split.reverse
|
91
116
|
size
|
@@ -95,7 +120,11 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
95
120
|
system "rsync -lrp #{ugc_local_cache}/ #{backups.last.split('/').last}"
|
96
121
|
end
|
97
122
|
|
98
|
-
desc
|
123
|
+
desc <<-DESC
|
124
|
+
Backup and dowload user generated content.
|
125
|
+
Copy on remote to cap home. Then rsync to a local dir.
|
126
|
+
Use a local cache dir so rsync do not transfert same files twice.
|
127
|
+
DESC
|
99
128
|
task :download, :roles => :db do
|
100
129
|
backup
|
101
130
|
latest
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cap-drupal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathieu Elie
|
@@ -31,13 +31,11 @@ extensions: []
|
|
31
31
|
extra_rdoc_files:
|
32
32
|
- LICENSE
|
33
33
|
- README.mkd
|
34
|
-
- README.rdoc
|
35
34
|
files:
|
36
35
|
- .document
|
37
36
|
- .gitignore
|
38
37
|
- LICENSE
|
39
38
|
- README.mkd
|
40
|
-
- README.rdoc
|
41
39
|
- Rakefile
|
42
40
|
- VERSION
|
43
41
|
- bin/cap-drupal
|
data/README.rdoc
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
= cap-drupal
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Note on Patches/Pull Requests
|
6
|
-
|
7
|
-
* Fork the project.
|
8
|
-
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
future version unintentionally.
|
11
|
-
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
-
* Send me a pull request. Bonus points for topic branches.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2010 Mathieu ELie. See LICENSE for details.
|