capistrano-trellis-bedrock-wpcli 0.0.1 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d70cce220f8b7147408ed6b1736da6d079f184c3
4
- data.tar.gz: e49c475596e26202735be2452e9f8b97a6b70734
3
+ metadata.gz: fcdb7ccc8f3ccd720a11f8360ef21661f24462a1
4
+ data.tar.gz: 7470e55cd535edb87230b4f933c9a0d06a84fa7c
5
5
  SHA512:
6
- metadata.gz: 8cdc94d9844ad45ca2f01ac718e4dea2b03def36cc1c467e09d40f369d4cfb30e9050918af72279993f4ea90aa940aef9dccda5672410542081055501b62cd18
7
- data.tar.gz: 031fe3ebcfd7c1d497badb9431684ac068d1d8f60a4e3370fbd50dae9fc8588f0daa6586eebdccf8aaf77e360f3ff979518b08c659bc3a29e637ceb6fc1b3999
6
+ metadata.gz: 054d30b026b05cf5cefbb478fcbf4f324705689ead397ffeed5de23078c46ec462edf943470f27760beda1da7ff8150fc914fcea5702565d261c53beaafc2c65
7
+ data.tar.gz: 7ba518d82ab20725301b53dc0e893c2e6a866937b8ec1742ae9192d99b748369dfe718fd06a04299e4ccc90aac28be22425e3483f886b2d9d859cbc31ce635d2
@@ -0,0 +1,12 @@
1
+ ### 0.0.2: August 11th, 2016
2
+ * Add CHANGELOG.md
3
+ * Rewrite README.md
4
+ * Improve search and replace removing http:// in favor of only //
5
+ * Add delete transient option after each push and pull on the imported database
6
+
7
+ ### 0.0.1: August 1st, 2016
8
+ * Rename gem from capistrano-wpcli to capistrano-trellis-bedrock-wpcli
9
+ * Update LICENSE.md
10
+ * Add support only for Trellis and Bedrock
11
+ * Remove support for WP-CLI custom commands and WP-CLI rewrite commands
12
+ * Update all dependencies
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-trellis-bedrock-wpcli (1.0.0)
4
+ capistrano-trellis-bedrock-wpcli (0.0.1)
5
5
  capistrano (~> 3.6.0)
6
6
  sshkit (~> 1.11.1)
7
7
 
@@ -1,13 +1,13 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Ensoul
3
+ Copyright (c) Ensoul
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
11
 
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
data/README.md CHANGED
@@ -1,155 +1,97 @@
1
- # Capistrano::WPCLI
1
+ # Capistrano::WPCLI for Trellis and Bedrock
2
2
 
3
- [![Dependency Status](https://www.versioneye.com/user/projects/561c9bfda193340f2f001728/badge.svg?style=flat)](https://www.versioneye.com/user/projects/561c9bfda193340f2f001728)
3
+ [![Dependency Status](https://www.versioneye.com/user/projects/579f823e72d75c0039f7a28b/badge.svg?style=flat)](https://www.versioneye.com/user/projects/579f823e72d75c0039f7a28b)
4
4
 
5
- **Note: this plugin works only with Capistrano 3.**
5
+ **This project is based on [capistrano-wpcli](https://github.com/lavmeiker/capistrano-wpcli) and works only with Trellis and Bedrock.**
6
6
 
7
- Provides command line tools to facilitate Wordpress database and uploads deploy.
7
+ Provides command line tools to facilitate WordPress database and uploads deploy with Trellis and Bedrock.
8
8
 
9
- ## Installation
10
-
11
- Add this line to your application's Gemfile:
12
-
13
- gem 'capistrano-wpcli'
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install capistrano-wpcli
22
-
23
- ## Usage
24
-
25
- All you need to do is put the following in `Capfile` file:
26
-
27
- require 'capistrano/wpcli'
28
-
29
- ### How it works (Tasks)
9
+ ## Requirements
30
10
 
31
- cap staging wpcli:db:push
11
+ * Ruby >= 2.0
32
12
 
33
- Pushes the local WP database to the remote server and replaces the urls.
13
+ Required gems:
34
14
 
35
- Optionally backs up the remote database before pushing (if `wpcli_backup_db` is set to true, see Configuration).
15
+ * `capistrano` (~> 3.6)
16
+ * `sshkit` (~> 1.11)
17
+ * `bundler` (~> 1.12)
18
+ * `rake` (~> 11.2)
36
19
 
37
- - - -
20
+ These can be installed manually with `gem install <gem name>` but it's highly suggested you use [Bundler](http://bundler.io/) to manage them. Bundler is basically the Ruby equivalent to PHP's Composer. Just as Composer manages your PHP packages/dependencies, Bundler manages your Ruby gems/dependencies. Bundler itself is a Gem and can be installed via `gem install bundler` (sudo may be required).
38
21
 
39
- cap staging wpcli:db:pull
22
+ The `Gemfile` in the root of this repo specifies the required Gems (just like `composer.json`). Once you have Bundler installed, run `bundle install` to install the Gems in the `Gemfile`. When using Bundler, you'll need to prefix the `cap` command with `bundle exec` as seen below (this ensures you're not using system Gems which can cause conflicts).
40
23
 
41
- Pulls the remote server WP database to local and replaces the urls.
42
-
43
- - - -
44
-
45
- cap staging wpcli:db:backup:remote
46
-
47
- Pulls the remote server WP database to localhost, uses `wpcli_local_db_backup_dir` to define the location of the export.
48
-
49
- - - -
50
-
51
- cap development wpcli:db:backup:local
52
-
53
- Backs up the local WP database to localhost, uses `wpcli_local_db_backup_dir` to define the location of the export.
54
-
55
- - - -
56
-
57
- cap staging wpcli:uploads:rsync:push
58
-
59
- Push local uploads delta to remote machine using rsync.
60
-
61
- - - -
24
+ ## Installation
62
25
 
63
- cap staging wpcli:uploads:rsync:pull
26
+ 1. Download the latest release of [capistrano-bedrock](https://github.com/itsensoul/capistrano-bedrock/releases/latest).
27
+ 2. Copy the following `capistrano-bedrock` files into the root of your Bedrock project:
28
+ * `Capfile`
29
+ * `Gemfile`
30
+ * `Gemfile.lock`
31
+ * `database.sh`
32
+ * `uploads.sh`
33
+ 3. Copy the content of `capistrano-bedrock .gitignore` file into the `.gitignore` file of your Bedrock project.
34
+ 4. Copy the following `capistrano-bedrock` files/folders into your `config` directory:
35
+ * `config/deploy/*`
36
+ * `config/deploy.rb`
37
+ 5. Run `gem install bundler -v "~>1.12.0" && bundle` into the root of your Bedrock project.
38
+ 6. Edit your `config/deploy.rb` configs to set the roles/servers and connection options.
39
+ 7. Edit your `config/deploy/*` stage/environment configs to set the specific roles/servers and connection options for each stage/environment.
40
+ 8. Enjoy `capistrano-trellis-bedrock-wpcli` [Tasks](#tasksanchor).
64
41
 
65
- Pull remote uploads delta to local machine using rsync.
42
+ ## Usage
66
43
 
44
+ <a name="configurationanchor"></a>
67
45
  ### Configuration
68
46
 
69
- This plugin needs some configuration to work properly. You can put all your configs in Capistrano stage files i.e. `config/deploy/production.rb`.
47
+ This plugin needs some configuration to work properly.
70
48
 
71
- Here's the list of options and the defaults for each option:
49
+ Here's the list of available options and the defaults for each option to put in your `config/deploy.rb` file:
72
50
 
73
- - - -
51
+ |Option|Default|Usage|
52
+ |---|---|---|
53
+ |`set :wpcli_local_url`|`//example.dev`|Url of the WordPress root installation on the local server (used by search-replace command).|
54
+ |`set :local_tmp_dir`|`/tmp`|Absolute path to local directory temporary directory which is read and writeable.|
55
+ |`set :wpcli_backup_db`|`false`|Set to true if you would like to create remote database backup on each push and local database backup on each pull.|
56
+ |`set :wpcli_delete_transients`|`true`|Set to false if you wouldn't like to delete transients on each push and pull. Transients will be removed only on the imported database.|
57
+ |`set :wpcli_local_db_backup_dir`|`config/backup`|Absolute or relative path to local directory for storing database backups which is read and writeable. **IMPORTANT: Make sure to add the folder to .gitignore to prevent db backups from being in version control.**|
58
+ |`set :wpcli_local_uploads_dir`|`web/app/uploads/`|Absolute or relative path to local WordPress uploads directory. **IMPORTANT: Add trailing slash!**|
59
+ |`set :wpcli_args`|`ENV['WPCLI_ARGS']`|You can pass arguments directly to WP-CLI using this var.|
60
+ |`set :format_options, log_file:`|`log/capistrano.log`|Capistrano's verbose output is saved to this file to facilitate debugging. Set to `nil` to disable completely. **IMPORTANT: Make sure to add the folder to .gitignore to prevent Capistrano logs from being in version control.**|
74
61
 
75
- set :wpcli_remote_url
62
+ <br/>
63
+ Here's the list of available options and the defaults for each option to put in your `config/deploy/staging.rb` or `config/deploy/production.rb` file:
76
64
 
77
- Url of the WP root installation on the remote server (used by search-replace command).
65
+ |Option|Default|Usage|
66
+ |---|---|---|
67
+ |`set :wpcli_remote_url`|`//example.com`|Url of the WordPress root installation on the remote server (used by search-replace command).|
68
+ |`set :wpcli_remote_uploads_dir`|`#{shared_path.to_s}/uploads/`|Absolute path to remote WordPress uploads directory. If this option is the same for staging and production, you can put this option in your `config/deploy.rb` file **IMPORTANT: Add trailing slash!**|
78
69
 
79
- - - -
70
+ **Note: if you are using Trellis with staging and production on same server you probably need to modify this standard configuration.**
80
71
 
81
- set :wpcli_local_url
72
+ <a name="tasksanchor"></a>
73
+ ### Tasks
82
74
 
83
- Url of the WP root installation on the local server (used by search-replace command).
75
+ ####1. Manage database
84
76
 
85
- - - -
77
+ * `bundle exec cap staging/production wpcli:db:push` - Pushes the local WordPress database to the remote server and replaces the urls (Optionally backs up the remote database before pushing, only if `wpcli_backup_db` is set to true, see [Configuration](#configurationanchor))
86
78
 
87
- set :local_tmp_dir
79
+ * `bundle exec cap staging/production wpcli:db:pull` - Pulls the remote server WordPress database to local and replaces the urls (Optionally backs up the local database before pulling, only if `wpcli_backup_db` is set to true, see [Configuration](#configurationanchor))
88
80
 
89
- Absolute path to local directory temporary directory which is read and writeable.
81
+ * `bundle exec cap staging/production wpcli:db:backup:remote` - Backs up remote staging/production database (uses `wpcli_local_db_backup_dir` to define the location of the export)
90
82
 
91
- Defaults to `/tmp`
83
+ * `bundle exec cap development wpcli:db:backup:local` - Backs up local vagrant database (uses `wpcli_local_db_backup_dir` to define the location of the export)
92
84
 
93
- - - -
85
+ ####2. Manage updates
94
86
 
95
- set :wpcli_backup_db
87
+ * `bundle exec cap staging wpcli:uploads:rsync:push` - Pushes the local uploads delta to remote machine using rsync.
96
88
 
97
- Set to true if you would like to create backups of databases on each push. Defaults to false.
98
-
99
- - - -
100
-
101
- set :wpcli_local_db_backup_dir
102
-
103
- Absolute or relative path to local directory for storing database backups which is read and writeable.
104
-
105
- Defaults to `config/backup`
106
-
107
- **IMPORTANT: Make sure to add the folder to .gitignore to prevent db backups from being in version control.**
108
-
109
- - - -
110
-
111
- set :wpcli_local_uploads_dir
112
-
113
- Absolute or relative path to local WP uploads directory.
114
-
115
- Defaults to `web/app/uploads/`.
116
-
117
- **IMPORTANT: Add trailing slash!**
118
-
119
- - - -
120
-
121
- set :wpcli_remote_uploads_dir
122
-
123
- Absolute path to remote wordpress uploads directory.
124
-
125
- Defaults to `#{shared_path.to_s}/web/app/uploads/`
126
-
127
- **IMPORTANT: Add trailing slash!**
128
-
129
- ### FAQ
130
-
131
- - What if i want to use a custom port for rsync?
132
- You can by setting your port somewhere inside the :ssh_options precedence.
133
- See here: http://capistranorb.com/documentation/advanced-features/properties/#precedence
134
-
135
- ### Vagrant
136
-
137
- If you are using another machine as a development server (Vagrant for example), you should define a `dev` role and indicate the path where the project lives on that server. This normally goes on `deploy.rb` file. Here's an example:
138
-
139
- server "example.dev", user: 'vagrant', password: 'vagrant', roles: %w{dev}
140
-
141
- set :dev_path, '/srv/www/example.dev/current'
89
+ * `bundle exec cap staging wpcli:uploads:rsync:pull` - Pulls the remote uploads delta to local machine using rsync.
142
90
 
143
91
  ## Contributing
144
92
 
145
- 1. Fork it ( https://github.com/lavmeiker/capistrano-wpcli/fork )
93
+ 1. Fork it (https://github.com/itsensoul/capistrano-trellis-bedrock-wpcli/fork)
146
94
  2. Create your feature branch (`git checkout -b my-new-feature`)
147
95
  3. Commit your changes (`git commit -am 'Add some feature'`)
148
96
  4. Push to the branch (`git push origin my-new-feature`)
149
97
  5. Create a new Pull Request
150
-
151
-
152
- # READ AND APPLY THE ISTRUCTIONS BELOW ONLY IF STAGING AND PRODUCTION ARE ON THE SAME SERVER
153
- # These parameters need first to be moved into production.rb and staging.rb and then replace #{fetch(:bedrock_folder)} with the name of production and staging bedrock folder
154
- set :deploy_to, -> { "/srv/www/#{fetch(:bedrock_folder)}" }
155
- set :wpcli_remote_uploads_dir, -> { "/srv/www/#{fetch(:bedrock_folder)}/current/web/app/uploads/" }
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency 'capistrano', '~> 3.6.0'
22
- spec.add_dependency 'sshkit', '~> 1.11.1'
21
+ spec.add_dependency 'capistrano', '~> 3.6'
22
+ spec.add_dependency 'sshkit', '~> 1.11'
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.12.5"
25
- spec.add_development_dependency "rake", "~> 11.2.2"
24
+ spec.add_development_dependency "bundler", "~> 1.12"
25
+ spec.add_development_dependency "rake", "~> 11.2"
26
26
 
27
27
  end
@@ -4,11 +4,11 @@ namespace :load do
4
4
 
5
5
  # The url under which the wordpress installation is
6
6
  # available on the remote server
7
- set :wpcli_remote_url, "http://example.com"
7
+ set :wpcli_remote_url, "//example.com"
8
8
 
9
9
  # The url under which the wordpress installation is
10
10
  # available on the local server
11
- set :wpcli_local_url, "http://example.dev"
11
+ set :wpcli_local_url, "//example.dev"
12
12
 
13
13
  # A local temp dir which is read and writeable
14
14
  set :local_tmp_dir, "/tmp"
@@ -16,9 +16,12 @@ namespace :load do
16
16
  # Use current time for annotating the backup file
17
17
  set :current_time, -> {Time.now.strftime("%Y_%m_%d_%H_%M")}
18
18
 
19
- # Boolean to determine wether the database should be backed up or not
19
+ # Boolean to determine whether the database should be backed up or not
20
20
  set :wpcli_backup_db, false
21
21
 
22
+ # Boolean to determine whether the transients should be deleted
23
+ set :wpcli_delete_transients, true
24
+
22
25
  # Set the location of the db backup files. This is relative to the local project root path.
23
26
  set :wpcli_local_db_backup_dir, "config/backup"
24
27
 
@@ -54,7 +57,8 @@ namespace :wpcli do
54
57
  execute :gunzip, "-c", fetch(:wpcli_local_db_file), ">", local_tmp_file
55
58
  execute :wp, :db, :import, local_tmp_file
56
59
  execute :rm, fetch(:wpcli_local_db_file), local_tmp_file
57
- execute :wp, "search-replace", fetch(:wpcli_remote_url), fetch(:wpcli_local_url), fetch(:wpcli_args) || "--skip-columns=guid", "--url=" + fetch(:wpcli_remote_url)
60
+ execute :wp, "search-replace", fetch(:wpcli_remote_url), fetch(:wpcli_local_url), fetch(:wpcli_args) || "--all-tables", "--url=" + fetch(:wpcli_remote_url)
61
+ if fetch(:wpcli_delete_transients) then execute :wp, "transient", "delete-all" end
58
62
  end
59
63
  end
60
64
  run_locally do
@@ -77,7 +81,8 @@ namespace :wpcli do
77
81
  execute :gunzip, "-c", fetch(:wpcli_remote_db_file), ">", remote_tmp_file
78
82
  execute :wp, :db, :import, remote_tmp_file
79
83
  execute :rm, fetch(:wpcli_remote_db_file), remote_tmp_file
80
- execute :wp, "search-replace", fetch(:wpcli_local_url), fetch(:wpcli_remote_url), fetch(:wpcli_args) || "--skip-columns=guid", "--url=" + fetch(:wpcli_local_url)
84
+ execute :wp, "search-replace", fetch(:wpcli_local_url), fetch(:wpcli_remote_url), fetch(:wpcli_args) || "--all-tables", "--url=" + fetch(:wpcli_local_url)
85
+ if fetch(:wpcli_delete_transients) then execute :wp, "transient", "delete-all" end
81
86
  end
82
87
  end
83
88
  on roles(:dev) do
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Wpcli
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-trellis-bedrock-wpcli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ensoul
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-01 00:00:00.000000000 Z
11
+ date: 2016-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.6.0
19
+ version: '3.6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.6.0
26
+ version: '3.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sshkit
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.11.1
33
+ version: '1.11'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.11.1
40
+ version: '1.11'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.12.5
47
+ version: '1.12'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.12.5
54
+ version: '1.12'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 11.2.2
61
+ version: '11.2'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 11.2.2
68
+ version: '11.2'
69
69
  description: Provides command line tools to facilitate WordPress uploads and database
70
70
  deploy with Trellis and Bedrock.
71
71
  email:
@@ -75,9 +75,10 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
+ - CHANGELOG.md
78
79
  - Gemfile
79
80
  - Gemfile.lock
80
- - LICENSE
81
+ - LICENSE.md
81
82
  - README.md
82
83
  - Rakefile
83
84
  - capistrano-trellis-bedrock-wpcli.gemspec