capistrano-wpcli 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -67,6 +67,14 @@ Local dir where WP stores the uploads. IMPORTANT: Add trailing slash! Optional i
67
67
  * `set :wpcli_remote_uploads_dir`<br/>
68
68
  Remote dir where WP stores the uploads. IMPORTANT: Add trailing slash! Optional if using [Bedrock Wordpress Stack](http://roots.io/wordpress-stack/)
69
69
 
70
+ ### Vagrant
71
+
72
+ If you are using another machine as a development server (Vagrant for example), you should define a `dev` role and indicate the path were the project lives on that server. This normally goes on `deploy.rb` file. Here's an example:
73
+
74
+ `server "example.dev", user: 'vagrant', password: 'vagrant', roles: %w{dev}`
75
+
76
+ `set :dev_path, '/srv/www/example.dev/current'`
77
+
70
78
  ## Contributing
71
79
 
72
80
  1. Fork it ( https://github.com/lavmeiker/capistrano-wpcli/fork )
@@ -12,8 +12,8 @@ namespace :load do
12
12
  set :local_tmp_dir, "/tmp"
13
13
 
14
14
  # Temporal db dumps path
15
- set :wpcli_remote_db_file, "#{fetch(:tmp_dir)}/wpcli_database.sql.gz"
16
- set :wpcli_local_db_file, "#{fetch(:local_tmp_dir)}/wpcli_database.sql.gz"
15
+ set :wpcli_remote_db_file, -> {"#{fetch(:tmp_dir)}/wpcli_database.sql.gz"}
16
+ set :wpcli_local_db_file, -> {"#{fetch(:local_tmp_dir)}/wpcli_database.sql.gz"}
17
17
  end
18
18
  end
19
19
 
@@ -27,7 +27,17 @@ namespace :wpcli do
27
27
  download! fetch(:wpcli_remote_db_file), fetch(:wpcli_local_db_file)
28
28
  execute :rm, fetch(:wpcli_remote_db_file)
29
29
  end
30
+ end
30
31
 
32
+ unless roles(:dev).empty?
33
+ on roles(:dev) do
34
+ within fetch(:dev_path) do
35
+ execute :gunzip, "<", fetch(:wpcli_local_db_file), "|", :wp, :db, :import, "-"
36
+ execute :rm, fetch(:wpcli_local_db_file)
37
+ execute :wp, "search-replace", fetch(:wpcli_remote_url), fetch(:wpcli_local_url), fetch(:wpcli_args) || "--skip-columns=guid"
38
+ end
39
+ end
40
+ else
31
41
  run_locally do
32
42
  execute :gunzip, "<", fetch(:wpcli_local_db_file), "|", :wp, :db, :import, "-"
33
43
  execute :rm, fetch(:wpcli_local_db_file)
@@ -38,23 +48,36 @@ namespace :wpcli do
38
48
 
39
49
  desc "Push the local database"
40
50
  task :push do
41
- on roles(:web) do
51
+ unless roles(:dev).empty?
52
+ on roles(:dev) do
53
+ within fetch(:dev_path) do
54
+ execute :wp, :db, :export, "- |", :gzip, ">", fetch(:wpcli_local_db_file)
55
+ end
56
+ end
57
+ else
42
58
  run_locally do
43
59
  execute :wp, :db, :export, "- |", :gzip, ">", fetch(:wpcli_local_db_file)
44
60
  end
45
-
61
+ end
62
+ on roles(:web) do
46
63
  upload! fetch(:wpcli_local_db_file), fetch(:wpcli_remote_db_file)
47
-
48
- run_locally do
49
- execute :rm, fetch(:wpcli_local_db_file)
50
- end
51
-
52
64
  within release_path do
53
65
  execute :gunzip, "<", fetch(:wpcli_remote_db_file), "|", :wp, :db, :import, "-"
54
66
  execute :rm, fetch(:wpcli_remote_db_file)
55
67
  execute :wp, "search-replace", fetch(:wpcli_local_url), fetch(:wpcli_remote_url), fetch(:wpcli_args) || "--skip-columns=guid"
56
68
  end
57
69
  end
70
+ unless roles(:dev).empty?
71
+ on roles(:dev) do
72
+ within fetch(:dev_path) do
73
+ execute :rm, fetch(:wpcli_local_db_file)
74
+ end
75
+ end
76
+ else
77
+ run_locally do
78
+ execute :rm, fetch(:wpcli_local_db_file)
79
+ end
80
+ end
58
81
  end
59
82
  end
60
83
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Wpcli
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-wpcli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-31 00:00:00.000000000 Z
12
+ date: 2014-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano