wpcap 0.2.1 → 0.2.2

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.
@@ -53,7 +53,7 @@ configuration.load do
53
53
 
54
54
  prepare_env
55
55
  run "mkdir -p #{backups_path}"
56
- filename = "db_backup_#{Time.now.to_f}.sql.bz2"
56
+ filename = "db_backup.#{Time.now.to_f}.sql.bz2"
57
57
  filepath = "#{backups_path}/#{filename}"
58
58
  on_rollback { run "rm #{filepath}" }
59
59
  run "mysqldump --user=#{db_username} -p --host=#{db_host} #{db_database} | bzip2 -z9 > #{filepath}" do |ch, stream, out|
@@ -65,10 +65,7 @@ configuration.load do
65
65
  desc "Restores the database from the latest compressed dump"
66
66
  task :restore_most_recent, :roles => :db, :only => { :primary => true } do
67
67
  prepare_env
68
- run "bzcat #{most_recent_backup} | mysql --user=#{db_username} -p --host=#{db_host} #{db_database}" do |ch, stream, out|
69
- ch.send_data "#{db_password}\n" if out =~ /^Enter password:/
70
- puts out
71
- end
68
+ restore_dump(most_recent_backup)
72
69
  end
73
70
 
74
71
  desc "Restores the database from the latest compressed dump"
@@ -107,7 +104,7 @@ configuration.load do
107
104
  prepare_env(:development)
108
105
  run_locally "#{local_mysql_path}mysqldump --user #{db_username} --password=#{db_password} #{db_database} | bzip2 -z9 > #{local_dump}"
109
106
  run "mkdir -p #{backups_path}"
110
- filename = "local_upload_#{Time.now.to_f}.sql.bz2"
107
+ filename = "local_upload.#{Time.now.to_f}.sql.bz2"
111
108
  filepath = "#{backups_path}/#{filename}"
112
109
  upload "#{local_dump}" , "#{filepath}"
113
110
  end
@@ -156,18 +153,19 @@ configuration.load do
156
153
  desc "Create database.yml in shared path with settings for current stage and test env"
157
154
  task :create_yaml do
158
155
  #Create a new database enviroment unless it already exists in config.
159
- unless db_config[stage]
160
- template_path = "#{shared_path}/config/database.yml"
161
- set :db_username, "#{application.split(".").first}_#{stage}"
162
- set :db_database, "#{application.split(".").first}_#{stage}"
163
- set :db_password, random_password(16)
164
- set :db_prefix, db_config["development"]["prefix"]
165
- run "mkdir -p #{shared_path}/config"
166
- template "mysql.yml.erb", template_path
167
- server_yaml = capture "cat #{template_path}"
168
- server_mysql_config_yaml = YAML.load(server_yaml)
169
- update_db_config(server_mysql_config_yaml)
170
- end
156
+ return if db_config[stage]
157
+
158
+ template_path = "#{shared_path}/config/database.yml"
159
+ set :db_username, "#{application.split(".").first}_#{stage}"
160
+ set :db_database, "#{application.split(".").first}_#{stage}"
161
+ set :db_password, random_password(16)
162
+ set :db_prefix, db_config["development"]["prefix"]
163
+ run "mkdir -p #{shared_path}/config"
164
+ template "mysql.yml.erb", template_path
165
+ server_yaml = capture "cat #{template_path}"
166
+ server_mysql_config_yaml = YAML.load(server_yaml)
167
+ update_db_config(server_mysql_config_yaml)
168
+
171
169
  end
172
170
 
173
171
  def db_config
@@ -3,6 +3,5 @@
3
3
  database: <%= db_database[0..15] %>
4
4
  username: <%= db_username[0..15] %>
5
5
  password: <%= db_password[0..15] %>
6
- priv_username: root
7
- priv_password: <%= db_priv_pass[0..15] %>
8
- host: localhost
6
+ host: localhost
7
+ encoding: utf8
@@ -4,11 +4,16 @@ class Wpcap::Utility
4
4
  puts red("****#{text}****")
5
5
  end
6
6
 
7
+ def self.question(text)
8
+ puts blue("****#{text}****")
9
+ end
10
+
7
11
  def self.colorize(text, color_code)
8
12
  "\e[#{color_code}m#{text}\e[0m"
9
13
  end
10
14
 
11
15
  def self.red(text); self.colorize(text, 31); end
12
16
  def self.green(text); self.colorize(text, 32); end
13
-
14
- end
17
+ def self.blue(text); self.colorize(text, 34); end
18
+
19
+ end
@@ -1,3 +1,3 @@
1
1
  module Wpcap
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
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.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: