drupistrano 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/drupistrano/hooks.rb +2 -2
- data/lib/drupistrano/recipe.rb +75 -15
- data/lib/drupistrano/version.rb +1 -1
- metadata +28 -52
data/lib/drupistrano/hooks.rb
CHANGED
@@ -2,8 +2,8 @@ Capistrano::Configuration.instance.load do
|
|
2
2
|
# Hooks
|
3
3
|
after "deploy:update_code", "deploy:symlink_configuration"
|
4
4
|
|
5
|
+
before "deploy:symlink", "drupal:clear_cache"
|
5
6
|
before "deploy:symlink", "deploy:backup_db"
|
6
7
|
before "deploy:symlink", "deploy:move_default_files"
|
7
|
-
before "deploy:symlink", "
|
8
|
-
before "deploy:symlink", "deploy:clear_cache"
|
8
|
+
before "deploy:symlink", "drupal:revert_features"
|
9
9
|
end
|
data/lib/drupistrano/recipe.rb
CHANGED
@@ -48,20 +48,6 @@ Capistrano::Configuration.instance.load do
|
|
48
48
|
CMD
|
49
49
|
end
|
50
50
|
|
51
|
-
desc "Revert all features"
|
52
|
-
task :revert_features, :roles => :app do
|
53
|
-
if previous_release
|
54
|
-
run "cd #{current_release} && #{drush_cmd} -y features-revert-all"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
desc "Clear all cache"
|
59
|
-
task :clear_cache, :roles => :app do
|
60
|
-
if previous_release
|
61
|
-
run "cd #{current_release} && #{drush_cmd} cache-clear all"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
51
|
desc "Execute database updates"
|
66
52
|
task :migrate, :roles => :db do
|
67
53
|
run "cd #{current_release} && #{drush_cmd} -y updatedb"
|
@@ -69,7 +55,7 @@ Capistrano::Configuration.instance.load do
|
|
69
55
|
|
70
56
|
desc "Setup configuration"
|
71
57
|
task :setup_configuration, :roles => :app do
|
72
|
-
run "mkdir -p #{site_config_path}"
|
58
|
+
run "mkdir -p #{site_config_path} && mkdir -p #{shared_path}/files"
|
73
59
|
top.upload File.join('sites', 'default', 'default.settings.php'),
|
74
60
|
File.join(site_config_path, 'settings.php')
|
75
61
|
end
|
@@ -96,4 +82,78 @@ Capistrano::Configuration.instance.load do
|
|
96
82
|
run symlink_execute_cmd
|
97
83
|
end
|
98
84
|
end
|
85
|
+
|
86
|
+
namespace :drupal do
|
87
|
+
desc "Execute a drush command remotely"
|
88
|
+
task :drush, :roles => :app, :once => true do
|
89
|
+
cmd = ENV["CMD"] || ""
|
90
|
+
abort "Please specify a command (via the FILES environment variable)" if cmd.empty?
|
91
|
+
run "cd #{current_release} && #{drush_cmd} -y #{cmd}"
|
92
|
+
end
|
93
|
+
|
94
|
+
desc "Revert all features"
|
95
|
+
task :revert_features, :roles => :app do
|
96
|
+
if previous_release
|
97
|
+
run "cd #{current_release} && #{drush_cmd} -y features-revert-all"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
desc "Clear all cache"
|
102
|
+
task :clear_cache, :roles => :app do
|
103
|
+
if previous_release
|
104
|
+
run "cd #{current_release} && #{drush_cmd} cache-clear all"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
namespace :files do
|
109
|
+
desc "Synchronize local files with remote server"
|
110
|
+
task :pull, :roles => :app, :once => true do
|
111
|
+
server = find_servers_for_task(current_task).first
|
112
|
+
server_user = server.user || user
|
113
|
+
system "rsync -avz #{server_user}@#{server.host}:#{shared_path}/files/ sites/default/files"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
namespace :db do
|
118
|
+
desc "Download DB dump from server to local machine"
|
119
|
+
task :pull, :roles => :db, :once => true do
|
120
|
+
Capistrano::CLI.ui.say("You are about to import the DB from the #{stage} server")
|
121
|
+
|
122
|
+
agree = Capistrano::CLI.ui.agree("Continue (Yes, [No]) ") do |q|
|
123
|
+
q.default = 'n'
|
124
|
+
end
|
125
|
+
|
126
|
+
exit unless agree
|
127
|
+
|
128
|
+
drupal.clear_cache
|
129
|
+
|
130
|
+
run "cd #{current_release}; #{drush_cmd} sql-dump > /tmp/dump.sql"
|
131
|
+
|
132
|
+
download("/tmp/dump.sql", "/tmp/dump.sql")
|
133
|
+
|
134
|
+
system "drush -y sql-drop"
|
135
|
+
system "drush sql-cli < /tmp/dump.sql"
|
136
|
+
end
|
137
|
+
|
138
|
+
desc "Copy local Database to remote server"
|
139
|
+
task :push, :roles => :db, :once => true do
|
140
|
+
Capistrano::CLI.ui.say <<-MSG
|
141
|
+
**************************** DANGER *****************************
|
142
|
+
*** You are about to EXPORT your DB to the #{stage} server ***
|
143
|
+
*****************************************************************
|
144
|
+
MSG
|
145
|
+
|
146
|
+
agree = Capistrano::CLI.ui.agree("Continue (Yes, [No]) ") do |q|
|
147
|
+
q.validate = /\Ayes?|no?\Z/i
|
148
|
+
q.default = 'n'
|
149
|
+
end
|
150
|
+
|
151
|
+
exit unless agree
|
152
|
+
|
153
|
+
system "drush cc all; drush sql-dump > /tmp/dump.sql"
|
154
|
+
top.upload("/tmp/dump.sql", "/tmp/dump.sql")
|
155
|
+
run "cd #{current_release} && #{drush_cmd} sql-cli < /tmp/dump.sql"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
99
159
|
end
|
data/lib/drupistrano/version.rb
CHANGED
metadata
CHANGED
@@ -1,49 +1,35 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: drupistrano
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 0.2.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Jorge Dias
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-02-10 00:00:00 +01:00
|
12
|
+
date: 2011-03-24 00:00:00.000000000 +01:00
|
19
13
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: capistrano
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &80262990 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 23
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 0
|
33
|
-
- 0
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
34
22
|
version: 1.0.0
|
35
23
|
type: :runtime
|
36
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *80262990
|
37
26
|
description: A Recipe to easily deploy Drupal Applications
|
38
|
-
email:
|
27
|
+
email:
|
39
28
|
- jorge@mrdias.com
|
40
29
|
executables: []
|
41
|
-
|
42
30
|
extensions: []
|
43
|
-
|
44
31
|
extra_rdoc_files: []
|
45
|
-
|
46
|
-
files:
|
32
|
+
files:
|
47
33
|
- .gitignore
|
48
34
|
- Gemfile
|
49
35
|
- README.md
|
@@ -55,38 +41,28 @@ files:
|
|
55
41
|
- lib/drupistrano/recipe.rb
|
56
42
|
- lib/drupistrano/version.rb
|
57
43
|
has_rdoc: true
|
58
|
-
homepage:
|
44
|
+
homepage: ''
|
59
45
|
licenses: []
|
60
|
-
|
61
46
|
post_install_message:
|
62
47
|
rdoc_options: []
|
63
|
-
|
64
|
-
require_paths:
|
48
|
+
require_paths:
|
65
49
|
- lib
|
66
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
51
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
72
|
-
|
73
|
-
- 0
|
74
|
-
version: "0"
|
75
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
57
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
|
81
|
-
segments:
|
82
|
-
- 0
|
83
|
-
version: "0"
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
84
62
|
requirements: []
|
85
|
-
|
86
63
|
rubyforge_project: drupistrano
|
87
|
-
rubygems_version: 1.
|
64
|
+
rubygems_version: 1.6.2
|
88
65
|
signing_key:
|
89
66
|
specification_version: 3
|
90
67
|
summary: Deployment Recipe for Drupal
|
91
68
|
test_files: []
|
92
|
-
|