capistrano-wpcli 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-wpcli (0.0.4)
4
+ capistrano-wpcli (0.0.5)
5
5
  capistrano (>= 3.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -34,6 +34,10 @@ Executes the WP-CLI command passed as parameter.
34
34
  Pushes the local WP database to the remote server and replaces the urls.
35
35
  * `wpcli:db:pull`<br/>
36
36
  Pulls the remote server WP database to local and replaces the urls.
37
+ * `wpcli:rewrite:flush`<br/>
38
+ Flush rewrite rules.
39
+ * `wpcli:rewrite:hard_flush`<br/>
40
+ Perform a hard flush - update `.htaccess` rules as well as rewrite rules in database.
37
41
 
38
42
  ### Configuration
39
43
 
@@ -51,7 +55,7 @@ Url of the Wordpress root installation on the local server (used by search-repla
51
55
  A local temp dir which is read and writeable. Defaults to `/tmp`.
52
56
 
53
57
  * `set :wpcli_args`<br/>
54
- You can pass arguments directly to WPCLI using this var. For example `--network` for a Wordpress Multisite installation.
58
+ You can pass arguments directly to WPCLI using this var. By default it will try to load values from `ENV['WPCLI_ARGS']`.
55
59
 
56
60
  ## Contributing
57
61
 
@@ -1,6 +1,10 @@
1
1
  namespace :load do
2
2
  task :defaults do
3
3
  set :wp_roles, :all
4
+
5
+ # You can pass parameters to WPCLI setting
6
+ # env var WPCLI_ARGS on each run
7
+ set :wpcli_args, ENV['WPCLI_ARGS']
4
8
  end
5
9
  end
6
10
 
@@ -10,7 +14,7 @@ namespace :wpcli do
10
14
  args.with_defaults(:command => :help)
11
15
  on release_roles(fetch(:wp_roles)) do
12
16
  within release_path do
13
- execute :wp, args[:command], *args.extras
17
+ execute :wp, args[:command], fetch(:wpcli_args)
14
18
  end
15
19
  end
16
20
  end
@@ -10,10 +10,6 @@ namespace :load do
10
10
 
11
11
  # A local temp dir which is read and writeable
12
12
  set :local_tmp_dir, "/tmp"
13
-
14
- # You can pass arguments directly to WPCLI using
15
- # this var
16
- set :wpcli_args, "--skip-columns=guid"
17
13
 
18
14
  # Temporal db dumps path
19
15
  set :wpcli_remote_db_file, "#{fetch(:tmp_dir)}/wpcli_database.sql"
@@ -27,15 +23,15 @@ namespace :wpcli do
27
23
  task :pull do
28
24
  on roles(:web) do
29
25
  within release_path do
30
- execute :wp, "db export", fetch(:wpcli_remote_db_file)
26
+ execute :wp, :db, :export, fetch(:wpcli_remote_db_file)
31
27
  download! fetch(:wpcli_remote_db_file), fetch(:wpcli_local_db_file)
32
28
  execute :rm, fetch(:wpcli_remote_db_file)
33
29
  end
34
30
 
35
31
  run_locally do
36
- execute :wp, "db import", fetch(:wpcli_local_db_file)
37
- execute :rm, "#{fetch(:wpcli_local_db_file)}"
38
- execute :wp, "search-replace", fetch(:wpcli_remote_url), fetch(:wpcli_local_url), fetch(:wpcli_args)
32
+ execute :wp, :db, :import, fetch(:wpcli_local_db_file)
33
+ execute :rm, fetch(:wpcli_local_db_file)
34
+ execute :wp, "search-replace", fetch(:wpcli_remote_url), fetch(:wpcli_local_url), fetch(:wpcli_args) || "--skip-columns=guid"
39
35
  end
40
36
  end
41
37
  end
@@ -44,7 +40,7 @@ namespace :wpcli do
44
40
  task :push do
45
41
  on roles(:web) do
46
42
  run_locally do
47
- execute :wp, "db export", fetch(:wpcli_local_db_file)
43
+ execute :wp, :db, :export, fetch(:wpcli_local_db_file)
48
44
  end
49
45
 
50
46
  upload! fetch(:wpcli_local_db_file), fetch(:wpcli_remote_db_file)
@@ -54,9 +50,9 @@ namespace :wpcli do
54
50
  end
55
51
 
56
52
  within release_path do
57
- execute :wp, "db import", fetch(:wpcli_remote_db_file)
53
+ execute :wp, :db, :import, fetch(:wpcli_remote_db_file)
58
54
  execute :rm, fetch(:wpcli_remote_db_file)
59
- execute :wp, "search-replace", fetch(:wpcli_local_url), fetch(:wpcli_remote_url), fetch(:wpcli_args)
55
+ execute :wp, "search-replace", fetch(:wpcli_local_url), fetch(:wpcli_remote_url), fetch(:wpcli_args) || "--skip-columns=guid"
60
56
  end
61
57
  end
62
58
  end
@@ -0,0 +1,21 @@
1
+ namespace :wpcli do
2
+ namespace :rewrite do
3
+ desc "Flush rewrite rules."
4
+ task :flush do
5
+ on roles(:web) do
6
+ within release_path do
7
+ execute :wp, :rewrite, :flush, fetch(:wpcli_args)
8
+ end
9
+ end
10
+ end
11
+
12
+ desc "Perform a hard flush - update `.htaccess` rules as well as rewrite rules in database."
13
+ task :hard_flush do
14
+ on roles(:web) do
15
+ within release_path do
16
+ execute :wp, :rewrite, :flush, "--hard", fetch(:wpcli_args)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Wpcli
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -1,2 +1,5 @@
1
- load File.expand_path("../tasks/wpcli.rake", __FILE__)
2
- load File.expand_path("../tasks/wpdb.rake", __FILE__)
1
+ # Load all tasks
2
+ files = Dir[File.join(File.dirname(__FILE__), 'tasks', '*.rake')]
3
+ files.each do |file|
4
+ load file
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.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -77,6 +77,7 @@ files:
77
77
  - lib/capistrano-wpcli.rb
78
78
  - lib/capistrano/tasks/wpcli.rake
79
79
  - lib/capistrano/tasks/wpdb.rake
80
+ - lib/capistrano/tasks/wprewrite.rake
80
81
  - lib/capistrano/wpcli.rb
81
82
  - lib/capistrano/wpcli/version.rb
82
83
  homepage: https://github.com/lavmeiker/capistrano-wpcli
@@ -94,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
95
  version: '0'
95
96
  segments:
96
97
  - 0
97
- hash: -2867424744216119694
98
+ hash: 3429493196073849224
98
99
  required_rubygems_version: !ruby/object:Gem::Requirement
99
100
  none: false
100
101
  requirements:
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
104
  version: '0'
104
105
  segments:
105
106
  - 0
106
- hash: -2867424744216119694
107
+ hash: 3429493196073849224
107
108
  requirements: []
108
109
  rubyforge_project:
109
110
  rubygems_version: 1.8.23