wpcap 0.2.2.1 → 0.2.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- desc "Create database.yml in shared path with settings for current stage and test env"
163
- task :create_yaml do
164
- #Create a new database enviroment unless it already exists in config.
165
- return if db_config[stage]
166
-
167
- template_path = "#{shared_path}/config/database.yml"
168
- set :db_username, "#{application.split(".").first}_#{stage}"
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 755 #{shared_path}/uploads"
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"
@@ -1,3 +1,3 @@
1
1
  module Wpcap
2
- VERSION = "0.2.2.1"
2
+ VERSION = "0.2.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wpcap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2.1
4
+ version: 0.2.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: