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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c884389597d8f5e65ee9b39266cada0e0c34cd4
4
- data.tar.gz: 180bcda175b002d7cbd674c7e1a106934cc8f940
3
+ metadata.gz: 2fea0c56b19ca70fa66bf4029418c42407c2242c
4
+ data.tar.gz: 575f1604cf50b06381cf1007cabbc5461f1cc306
5
5
  SHA512:
6
- metadata.gz: dafaef49fa10f0c7cbf564010cb01d2798691a3894dd4a6d3338f374363a7f84be593dec759125edf40e28eb20e554d08fa0271204a47378b56a9c86a5bfdd47
7
- data.tar.gz: b83b079fbb34c6e224b1abd96a4a06dc37041449d8f3f3f6b7fcb95bc967f447cb00e9b4c4cc986192dca4bb5fe8c0439e376a2dc3bc7256815ae717e2885d66
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 one task:
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.2'
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}
@@ -16,7 +16,9 @@ namespace(:mysql) do
16
16
  task :download => :before
17
17
  task :change_url => :before
18
18
  task :import => :before
19
- task :sync => [:backup, :download, :change_url, :import]
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
- change_urls_in_file("etc/db_backups/remote.sql", REMOTE_ENV['WP_HOME'], LOCAL_ENV['WP_HOME'])
48
- puts "Changed urls in file!"
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.2
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-05-26 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano