bedrock-capistrano-mysql 0.0.2 → 0.0.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.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/bedrock-capistrano-mysql.gemspec +1 -1
- data/lib/capistrano/mysql.rb +5 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fea0c56b19ca70fa66bf4029418c42407c2242c
|
4
|
+
data.tar.gz: 575f1604cf50b06381cf1007cabbc5461f1cc306
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39f8c873915cdc0da16d845b0ffbf7f53dd2cbd75be28d3cf6664f833c45f9257ffd7f9b6be3b5fed2b86443618d51119ed9997540a43bd997dfa7c136828118
|
7
|
+
data.tar.gz: 94fcc2229fea41057975070072ae8c63d5ff1cbe5d4f15817590810b0a553cd6582d904a4b0e8f7bca9b70c18f528a32e313a1e220717ba6a1bf9b4c757f0d0d
|
data/README.md
CHANGED
@@ -26,11 +26,14 @@ Require the module in your `Capfile`:
|
|
26
26
|
require 'bedrock-capistrano-mysql'
|
27
27
|
```
|
28
28
|
|
29
|
-
`bedrock-capistrano-mysql` comes with
|
29
|
+
`bedrock-capistrano-mysql` comes with five tasks:
|
30
30
|
|
31
31
|
* mysql:backup
|
32
|
+
* mysql:download
|
33
|
+
* mysql:change_url
|
34
|
+
* mysql:import
|
32
35
|
|
33
|
-
The `mysql:backup` task will backup your database to your shared-folder. It will keep the five latest backups.
|
36
|
+
The `mysql:backup` task will backup your database to your shared-folder. It will keep the five latest backups. `mysql:download` downloads the file to your local project folder. `mysql:change_url` does a search and replace for the domain. `mysql:import` imports it into your dev database and `mysql:sync` does everything, in this order.
|
34
37
|
|
35
38
|
## Contributing
|
36
39
|
|
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'bedrock-capistrano-mysql'
|
6
|
-
spec.version = '0.0.
|
6
|
+
spec.version = '0.0.3'
|
7
7
|
spec.authors = ['Fredrik Sundström']
|
8
8
|
spec.email = ['fredrik.sundstrom@norkay.se']
|
9
9
|
spec.description = %q{MySQL tasks for roots/bedrock, using Capistrano 3.x}
|
data/lib/capistrano/mysql.rb
CHANGED
@@ -16,7 +16,9 @@ namespace(:mysql) do
|
|
16
16
|
task :download => :before
|
17
17
|
task :change_url => :before
|
18
18
|
task :import => :before
|
19
|
-
|
19
|
+
|
20
|
+
desc "Sync MySQL Database"
|
21
|
+
task :sync => [:backup, :download, :import, :change_url]
|
20
22
|
|
21
23
|
desc "Backup MySQL Database"
|
22
24
|
task :backup do
|
@@ -44,8 +46,8 @@ namespace(:mysql) do
|
|
44
46
|
desc "Change the urls in the MySQL backup file"
|
45
47
|
task :change_url do
|
46
48
|
on roles(:db) do
|
47
|
-
|
48
|
-
puts "Changed urls
|
49
|
+
system "cd ..; cd #{LOCAL_ENV['VAGRANT_PATH']}; vagrant ssh -c 'cd /srv/www/#{LOCAL_ENV['VAGRANT_APP_FOLDER']}/current; wp search-replace \'#{REMOTE_ENV['WP_HOME']}\' \'#{LOCAL_ENV['WP_HOME']}\''"
|
50
|
+
puts "Changed urls!"
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
@@ -77,12 +79,6 @@ def get_latest_backup_filename(path)
|
|
77
79
|
filename
|
78
80
|
end
|
79
81
|
|
80
|
-
def change_urls_in_file(filename, replace, with)
|
81
|
-
text = File.read(filename)
|
82
|
-
new_contents = text.gsub(replace, with)
|
83
|
-
File.open(filename, "w") {|file| file.puts new_contents }
|
84
|
-
end
|
85
|
-
|
86
82
|
def local_mysql_credentials
|
87
83
|
credential_params = ""
|
88
84
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bedrock-capistrano-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fredrik Sundström
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|