wpcap 0.2.2.1 → 0.2.2.3
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/lib/wpcap/recipes/mysql.rb +25 -23
- data/lib/wpcap/recipes/wordpress.rb +2 -2
- data/lib/wpcap/version.rb +1 -1
- metadata +1 -1
data/lib/wpcap/recipes/mysql.rb
CHANGED
@@ -136,7 +136,6 @@ configuration.load do
|
|
136
136
|
|
137
137
|
desc "Create MySQL database and user for this stage using database.yml values"
|
138
138
|
task :create, :roles => :db, :only => { :primary => true } do
|
139
|
-
create_yaml
|
140
139
|
prepare_env
|
141
140
|
create_db_if_missing
|
142
141
|
end
|
@@ -159,26 +158,13 @@ configuration.load do
|
|
159
158
|
run_with_tty server, %W( mysql --user=#{db_username} -password#{db_password} --host=#{db_host} #{db_database} )
|
160
159
|
end
|
161
160
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
set :db_database, "#{application.split(".").first}_#{stage}"
|
170
|
-
set :db_password, random_password(16)
|
171
|
-
set :db_prefix, db_config["development"]["prefix"]
|
172
|
-
run "mkdir -p #{shared_path}/config"
|
173
|
-
template "mysql.yml.erb", template_path
|
174
|
-
server_yaml = capture "cat #{template_path}"
|
175
|
-
server_mysql_config_yaml = YAML.load(server_yaml)
|
176
|
-
update_db_config(server_mysql_config_yaml)
|
177
|
-
|
178
|
-
end
|
179
|
-
|
180
|
-
def db_config
|
181
|
-
@db_config ||= fetch_db_config
|
161
|
+
def db_config(reset = false)
|
162
|
+
if reset
|
163
|
+
@db_config = fetch_db_config
|
164
|
+
else
|
165
|
+
@db_config ||= fetch_db_config
|
166
|
+
end
|
167
|
+
|
182
168
|
end
|
183
169
|
|
184
170
|
def remote_config(key)
|
@@ -213,7 +199,7 @@ configuration.load do
|
|
213
199
|
set(:local_dump) { "/tmp/#{application}.sql.bz2" }
|
214
200
|
|
215
201
|
if db_config[load_stage]
|
216
|
-
|
202
|
+
|
217
203
|
set(:db_priv_user) { remote_config(:db_priv_user).nil? ? db_config[load_stage]["username"] : remote_config(:db_priv_user) }
|
218
204
|
set(:db_priv_pass) { remote_config(:db_priv_pass).nil? ? db_config[load_stage]["password"] : remote_config(:db_priv_pass) }
|
219
205
|
set(:db_host) { db_config[load_stage]["host"] }
|
@@ -221,8 +207,23 @@ configuration.load do
|
|
221
207
|
set(:db_username) { db_config[load_stage]["username"] }
|
222
208
|
set(:db_password) { db_config[load_stage]["password"] }
|
223
209
|
set(:db_encoding) { db_config[load_stage]["encoding"] }
|
224
|
-
set(:db_prefix) { db_config[load_stage]["prefix"] }
|
210
|
+
set(:db_prefix) { db_config[load_stage]["prefix"] }
|
211
|
+
|
212
|
+
else
|
213
|
+
|
214
|
+
set :db_priv_user , remote_config(:db_priv_user)
|
215
|
+
set :db_priv_pass , remote_config(:db_priv_pass)
|
216
|
+
set :db_username , "#{application.split(".").first}_#{stage}"
|
217
|
+
set :db_database , "#{application.split(".").first}_#{stage}"
|
218
|
+
set :db_password , random_password(16)
|
219
|
+
set :db_prefix , db_config["development"]["prefix"]
|
225
220
|
|
221
|
+
run "mkdir -p #{shared_path}/config"
|
222
|
+
template "mysql.yml.erb", "#{shared_path}/config/database.yml"
|
223
|
+
server_yaml = capture "cat #{shared_path}/config/database.yml"
|
224
|
+
server_mysql_config_yaml = YAML.load(server_yaml)
|
225
|
+
update_db_config(server_mysql_config_yaml)
|
226
|
+
db_config(true)
|
226
227
|
end
|
227
228
|
|
228
229
|
end
|
@@ -260,6 +261,7 @@ configuration.load do
|
|
260
261
|
|
261
262
|
def create_db_if_missing(environment = stage)
|
262
263
|
unless database_exits?(environment)
|
264
|
+
create_yaml
|
263
265
|
sql = <<-SQL
|
264
266
|
CREATE DATABASE #{db_database};
|
265
267
|
GRANT ALL PRIVILEGES ON #{db_database}.* TO #{db_username}@#{db_host} IDENTIFIED BY '#{db_password}';
|
@@ -51,7 +51,7 @@ configuration.load do
|
|
51
51
|
|
52
52
|
# set correct permissions
|
53
53
|
run "chmod -R 755 #{latest_release}/app/wp-content/plugins"
|
54
|
-
run "chmod -R
|
54
|
+
run "chmod -R 775 #{shared_path}/uploads"
|
55
55
|
run "chmod -R 755 #{shared_path}/cache"
|
56
56
|
end
|
57
57
|
|
@@ -164,7 +164,7 @@ configuration.load do
|
|
164
164
|
after "db:mysql:pull", "wordpress:update_local_db"
|
165
165
|
after "db:mysql:pull", "wordpress:assets_pull"
|
166
166
|
|
167
|
-
desc "Protect system files"
|
167
|
+
desc "[internal] Protect system files"
|
168
168
|
task :protect, :except => { :no_release => true } do
|
169
169
|
run "chmod 444 #{latest_release}/app/wp-config.php*"
|
170
170
|
run "cd #{current_path} && chown -R #{user} . && find . -type d -print0 | xargs -0 chmod 755"
|
data/lib/wpcap/version.rb
CHANGED