capistrano-ash 1.3.7 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDNkNzI1MjBlOWRlMjNjYWM3NTMyM2Q1ZWE5YWYyZGIxNjRiZmQyMQ==
4
+ YzFiZmRjNzA1NjRmYzNhN2E5MDczMTA1YzJmNDIwMzhkOGI0YjA5Yg==
5
5
  data.tar.gz: !binary |-
6
- ZmJiMmU4YjM5OGVkYTdmM2U2MjdkNDJlNjIxZjdmZDU1MzE1YTJlYw==
6
+ NjE3NjU3Zjc0MGNjMDhjNTIxZGM4Njk3ZGY4NTBkOTIzODM0YmI1NQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDVhYzM5MzVmNTgyNWU3Y2M3YzIzNjZkODNjNGE5NjM2MGNhY2VlZTI3NDIw
10
- ODVjYTVkZmQzNzIxMzM5MDI0N2M4YTk4YWNlYzliODkxODBkMDc3NDM5Mzli
11
- ZTY0MGJkN2YzODYwOTRkZGJhZGFlOWU2ZGFhYTc4NTA0YWExZmU=
9
+ MmU5MmQ5Y2QyZGEzYzBhYTMyNDE3ZmU1OWYwYzgxNGUyMjExZjUxODExMGFl
10
+ ODk5ODRjMzA3NGUxNWQ4MjlkZTE4NDZmMzc2MGM2ZTQxMWRmYWE0MWFiZjZk
11
+ OTc4YzY3YzY1MzIyZDI1YTZmY2Q2MTRjN2QxN2FkZmQ0MzkxODM=
12
12
  data.tar.gz: !binary |-
13
- MWJjOTA5Mzc0OWViNjgwM2M5YWI0ODA2NzViNWEwOWE2OWY5ZDkwMTE2N2Y3
14
- ZDhmMTFhYjY3NWVhZTVlMzU5ZGJmODM5NmY0Zjk1ZDQ5MDk5NDFiODE1NDY5
15
- NTY4NTllOWEzMzNhMjliYTU5MDgwNjc5ZGI2OTgzMzI2MTJlZTI=
13
+ ZTM4MGEyNDQ0NWY2MjRlNjIzMGM3MzE5MjdkNjBiNGE1NWFmZDhkNWU1ODVj
14
+ MzY2NGM3ZGIyM2I5MTcwMTY1YTYzNGVmZTFmMzkwYjBmY2Q2NmE0YTE5MWU1
15
+ YjM2YTZlY2U1ODg4ZmFmYjQ2YjBlNWE0ZTBhYTQwNjFhYzc5NDU=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.7
1
+ 1.4.0
data/lib/ash/drupal.rb CHANGED
@@ -60,6 +60,7 @@ configuration.load do
60
60
  # before/after callbacks not firing for 'deploy:symlink'
61
61
  # or 'deploy:create_symlink'
62
62
  after "deploy", "drupal:symlink"
63
+ after "drupal:symlink_config_file", "drupal:run_makefiles"
63
64
  after "drupal:symlink","drupal:protect"
64
65
  after "drupal:symlink", "drupal:clearcache"
65
66
  before "drupal:clearcache", "compass"
@@ -199,6 +200,27 @@ configuration.load do
199
200
  end
200
201
  end
201
202
 
203
+ desc "Run drush make files to update core and contributed modules"
204
+ task :run_makefiles, :roles => :web do
205
+ makefiles = fetch(:drush_makefiles, nil)
206
+ begin
207
+ case true
208
+ when makefiles.is_a?(NilClass)
209
+ logger.info "Skipping `drush:run_makefiles` because no makefiles were defined"
210
+ when makefiles.is_a?(String)
211
+ run "cd #{latest_release} && #{drush_bin} make #{latest_release}/#{drush_makefiles} -y"
212
+ when makefiles.is_a?(Array)
213
+ makefiles.each do |makefile|
214
+ run "cd #{latest_release} && #{drush_bin} make #{latest_release}/#{makefile} -y"
215
+ end
216
+ else
217
+ logger.important "Failed to run drush make files because `:drush_makefiles` was neither a string nor an array. You can correct this by setting `:drush_makefiles` as such: `set :drush_makefiles, 'ash_core.make'`. Just replace with the appropriate name or filepath to a drush make file."
218
+ end
219
+ rescue Exception => e
220
+ logger.important e.message
221
+ end
222
+ end
223
+
202
224
  desc "Replace local database paths with remote paths"
203
225
  task :updatedb, :roles => :web, :except => { :no_release => true } do
204
226
  multisites.each_pair do |folder, url|
@@ -0,0 +1,160 @@
1
+ # Require our base library.
2
+ require 'ash/base'
3
+ require 'railsless-deploy'
4
+
5
+ configuration = Capistrano::Configuration.respond_to?(:instance) ?
6
+ Capistrano::Configuration.instance(:must_exist) :
7
+ Capistrano.configuration(:must_exist)
8
+
9
+ configuration.load do
10
+
11
+ # --------------------------------------------
12
+ # Setting nested WordPress variable defaults
13
+ # --------------------------------------------
14
+
15
+ # ------
16
+ # Database Credentials
17
+ # assumes you're using the same database user, password and database
18
+ # as your main project would use; if you are not doing so, simply use
19
+ # the following template for defining the credentials:
20
+ #
21
+ # Alternative Database Credential Configuration:
22
+ # set :wp_db_user, "mycustomuser"
23
+ # set :wp_db_name, "custom_wp_database"
24
+ # set :wp_db_pass, proc{ Capistrano::CLI.password_prompt("Database password for '#{wp_db_user}':") }
25
+ # ------
26
+ set (:wp_db_user) { "#{dbuser}" }
27
+ set (:wp_db_name) { "#{dbname}" }
28
+ set (:wp_db_pass) { "#{dbpass}" }
29
+
30
+ # ------
31
+ # Multi-WordPress installations
32
+ # Create an array of configuration settings for
33
+ # each of the WordPress sites that should follow
34
+ # the following defined for each installation:
35
+ #
36
+ # :wp_blogs # array, contains hashes with each hash
37
+ # # containing options for a given WordPress
38
+ # # installation
39
+ #
40
+ # :directory # string, relative file path to the WordPress
41
+ # # installation from the project's root directory
42
+ #
43
+ # :db_prefix # string, table prefix for all WordPress tables
44
+ #
45
+ # :base_url # hash, contains key/value pairs for environments and
46
+ # # their full URLs
47
+ # # NOTE: DO NOT INCLUDE the trailing slash "/" in the URL
48
+ #
49
+ # The following is an example of a well formed and
50
+ # valid configuration array for multiple WordPress
51
+ # installations
52
+ #
53
+ # set :wp_blogs, [
54
+ # { :directory => "blog1", :db_prefix => "wp1_",
55
+ # :base_url => {
56
+ # :staging => "http://staging.example.com",
57
+ # :production => "http://www.example.com"
58
+ # }
59
+ # },
60
+ # { :directory => "blog2", :db_prefix => "wp2_",
61
+ # :base_url => {
62
+ # :staging => "http://staging.anotherexample.com",
63
+ # :production => "http://www.anotherexample.com"
64
+ # }
65
+ # }
66
+ # ]
67
+ # ------
68
+ set :wp_blogs, [ {} ]
69
+
70
+ namespace :wordpress do
71
+ namespace :nested do
72
+
73
+ desc "Setup/configure nested wordpress installations"
74
+ task :default, :roles => :web do
75
+ wordpress.nested.setup # setup shared directories for WP files (e.g., uploades, cache, etc.)
76
+ wordpress.nested.symlink # symlink configuration files and any shared directories
77
+ wordpress.nested.protect # protect the config file!
78
+ wordpress.nested.updatedb # update the WP database(s) with their home or base url
79
+ end
80
+
81
+ desc "Setup nested WordPress install"
82
+ task :setup, :roles => :web do
83
+ wordpress.nested.setup_shared
84
+ end
85
+
86
+ desc "Setup shared folders for WordPress"
87
+ task :setup_shared, :roles => :web do
88
+ wp_blogs.each do |blog|
89
+ wp_blog_directory = blog[:directory]
90
+
91
+ # create shared directories
92
+ run "mkdir -p #{shared_path}/#{wp_blog_directory}/uploads"
93
+ run "mkdir -p #{shared_path}/#{wp_blog_directory}/cache"
94
+ # set correct permissions
95
+ run "chmod -R 755 #{shared_path}/#{wp_blog_directory}"
96
+ end
97
+ end
98
+
99
+ desc "[internal] Removes unnecessary files and directories"
100
+ task :prepare_for_symlink, :roles => :web, :except => { :no_release => true } do
101
+ wp_blogs.each do |blog|
102
+ wp_blog_directory = blog[:directory]
103
+ wp_uploads_path = "#{wp_blog_directory}/wp-content/uploads"
104
+ wp_cache_path = "#{wp_blog_directory}/wp-content/cache"
105
+
106
+ # remove shared directories
107
+ run "rm -Rf #{latest_release}/#{wp_uploads_path}"
108
+ run "rm -Rf #{latest_release}/#{wp_cache_path}"
109
+
110
+ # Removing cruft files.
111
+ run "rm -Rf #{latest_release}/#{wp_blog_directory}/license.txt"
112
+ run "rm -Rf #{latest_release}/#{wp_blog_directory}/readme.html"
113
+ end
114
+ end
115
+
116
+ desc "Links the correct settings file"
117
+ task :symlink, :roles => :web, :except => { :no_release => true } do
118
+ # internal call to the :prepare_for_symlink task
119
+ wordpress.nested.prepare_for_symlink
120
+
121
+ # symlink files/directories
122
+ wp_blogs.each do |blog|
123
+ wp_blog_directory = blog[:directory]
124
+ wp_uploads_path = "#{wp_blog_directory}/wp-content/uploads"
125
+ wp_cache_path = "#{wp_blog_directory}/wp-content/cache"
126
+
127
+ run "ln -nfs #{shared_path}/#{wp_blog_directory}/uploads #{latest_release}/#{wp_uploads_path}"
128
+ run "ln -nfs #{shared_path}/#{wp_blog_directory}/cache #{latest_release}/#{wp_cache_path}"
129
+ run "ln -nfs #{latest_release}/#{wp_blog_directory}/wp-config.#{stage}.php #{latest_release}/#{wp_blog_directory}/wp-config.php"
130
+ end
131
+ end
132
+
133
+ desc "Set WordPress Base URL in database"
134
+ task :updatedb, :roles => :db, :except => { :no_release => true } do
135
+ servers = find_servers_for_task(current_task)
136
+ servers.each do |server|
137
+ wp_db_host = server.host
138
+
139
+ wp_blogs.each do |blog|
140
+ wp_blog_directory = blog[:directory]
141
+ wp_db_prefix = blog[:db_prefix]
142
+ wp_base_url_prefix = blog[:base_url]["#{stage}".to_sym]
143
+ wp_base_url = "#{wp_base_url_prefix}/#{wp_blog_directory}"
144
+
145
+ run "mysql -h #{wp_db_host} -u #{wp_db_user} --password='#{wp_db_pass}' -e 'UPDATE #{wp_db_name}.#{wp_db_prefix}options SET option_value = \"#{wp_base_url}\" WHERE option_name = \"siteurl\" OR option_name = \"home\"'"
146
+ end
147
+ end
148
+ end
149
+
150
+ desc "Protect system files"
151
+ task :protect, :except => { :no_release => true } do
152
+ wp_blogs.each do |blog|
153
+ wp_blog_directory = blog[:directory]
154
+ run "chmod 444 #{latest_release}/#{wp_blog_directory}/wp-config.php*"
155
+ end
156
+ end
157
+ end
158
+ end
159
+
160
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-ash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - August Ash
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-06 00:00:00.000000000 Z
11
+ date: 2013-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -87,6 +87,7 @@ files:
87
87
  - lib/ash/hosted_magento.rb
88
88
  - lib/ash/magento.rb
89
89
  - lib/ash/wordpress.rb
90
+ - lib/ash/wordpress_nested.rb
90
91
  - lib/ash/wordpress_shared_hosting.rb
91
92
  - lib/ash/zend_doctrine.rb
92
93
  - lib/ash/zend_doctrine_shared_hosting.rb