wordmove 5.0.0.dev → 5.2.0
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/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
- data/.github/ISSUE_TEMPLATE/discussion.md +10 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/stale.yml +17 -0
- data/.github/workflows/ruby.yml +30 -0
- data/CONTRIBUTING.md +86 -0
- data/LICENSE +21 -0
- data/README.mdown +39 -67
- data/deploy/deploy.sh +1 -1
- data/lib/wordmove/deployer/base.rb +2 -4
- data/lib/wordmove/hook.rb +52 -47
- data/lib/wordmove/logger.rb +6 -1
- data/lib/wordmove/movefile.rb +14 -5
- data/lib/wordmove/sql_adapter/wpcli.rb +34 -3
- data/lib/wordmove/version.rb +1 -1
- data/wordmove.gemspec +1 -1
- metadata +23 -11
- data/.travis.yml +0 -24
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe407e16e7e4429e38fbfb9ee56e1918e7f6d40a8fdc8f3999d419134ffd8417
|
|
4
|
+
data.tar.gz: 868152d983a5833d63ca1cc8d442b900ae4e892a6e18505cf61cdd7898ad3092
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af4b3aa6aee1709a2cef4295c32abda5fb247777306ff0a7bcb523310c82036d97f12e993c8aebe631868d6d886cb3d738bbb38829070c5bbf3ef38c80942a6f
|
|
7
|
+
data.tar.gz: 8c6f937b0cda51db90afd5119677be8bffe7870e4ba29d7bc1c02c7e011ba1f169110f680a04d78d07d3d28165d474e156cdba03cf95bfe8d5c7a321d51a8d42
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**Wordmove command**
|
|
14
|
+
Command used on the CLI: (e.g.: `wordmove pull --all --no-db`)
|
|
15
|
+
|
|
16
|
+
**Expected behavior**
|
|
17
|
+
A clear and concise description of what you expected to happen.
|
|
18
|
+
|
|
19
|
+
**movefile.yml**
|
|
20
|
+
Paste (removing personal data) the interesting part, if any, of your `movefile.yml` formatting it inside a code block with `yml` syntax and double checking the indentation.
|
|
21
|
+
|
|
22
|
+
**Exception/trace**
|
|
23
|
+
Paste (removing personal data) the entire trace of error/exception you encountered, if any
|
|
24
|
+
|
|
25
|
+
**Environment (please complete the following information):**
|
|
26
|
+
- OS:
|
|
27
|
+
- Ruby: (`ruby --version`)
|
|
28
|
+
- Wordmove: (`wordmove --version`)
|
|
29
|
+
|
|
30
|
+
**Doctor**
|
|
31
|
+
* [x] `wordmove doctor` is all green
|
|
32
|
+
|
|
33
|
+
(If it is not, report the error you got.)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: feature
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
data/.github/stale.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Number of days of inactivity before an issue becomes stale
|
|
2
|
+
daysUntilStale: 60
|
|
3
|
+
# Number of days of inactivity before a stale issue is closed
|
|
4
|
+
daysUntilClose: 7
|
|
5
|
+
# Issues with these labels will never be considered stale
|
|
6
|
+
exemptLabels:
|
|
7
|
+
- feature
|
|
8
|
+
- bug
|
|
9
|
+
# Label to use when marking an issue as stale
|
|
10
|
+
staleLabel: wontfix
|
|
11
|
+
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
12
|
+
markComment: >
|
|
13
|
+
This issue has been automatically marked as stale because it has not had
|
|
14
|
+
recent activity. It will be closed if no further activity occurs. Thank you
|
|
15
|
+
for your contributions.
|
|
16
|
+
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
17
|
+
closeComment: false
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
+
|
|
8
|
+
name: Tests
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [ master ]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [ master ]
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test:
|
|
18
|
+
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v2
|
|
23
|
+
- name: Set up Ruby
|
|
24
|
+
uses: ruby/setup-ruby@v1
|
|
25
|
+
with:
|
|
26
|
+
ruby-version: 2.6
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: bundle install
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: bundle exec rake
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Welcome to the contributor guide. If you can't find important information you're welcome
|
|
2
|
+
to edit this page or open a discussion issue to talk with maintainers.
|
|
3
|
+
|
|
4
|
+
In this guide you'll find informations about:
|
|
5
|
+
* [Bug reporting](#bug-reporting)
|
|
6
|
+
* [Development](#development)
|
|
7
|
+
* [Maintainer tasks](#maintainer-tasks)
|
|
8
|
+
|
|
9
|
+
### Bug reporting
|
|
10
|
+
|
|
11
|
+
Wordmove is an hard piece of software to debug and it is used by many users with many
|
|
12
|
+
different environments - Windows also, even if it isn't officially supported by the dev team.
|
|
13
|
+
|
|
14
|
+
So *please*, help the community adding some crucial informations and posting well
|
|
15
|
+
formatted code. Inspirational details:
|
|
16
|
+
|
|
17
|
+
* OS
|
|
18
|
+
* Ruby version
|
|
19
|
+
* Wordmove version
|
|
20
|
+
* Are you using system Ruby, rbenv or RVM?
|
|
21
|
+
* Describe at your best the action you required to Wordmove: push/pull, ftp/ssh
|
|
22
|
+
* Paste (safely) your full or partial `movefile.yml`
|
|
23
|
+
* Paste (safely) the entire trace of error/exception you encountered, if any
|
|
24
|
+
* If you paste code or the STDOUT log/trace **format them**. If it sound as a joke I swear I'm serious:
|
|
25
|
+
use GitHub's Markdown syntax to keep things readable if you'd like to discuss your problem with the community.
|
|
26
|
+
* Label the issue if you can
|
|
27
|
+
|
|
28
|
+
As a general advise: we tend to not support Wordmove's versions older than the latest stable.
|
|
29
|
+
We'd appreciate your help opening an in depth report if you'd find that an older version is working
|
|
30
|
+
better for you.
|
|
31
|
+
|
|
32
|
+
Thank you all for your support and for the love <3
|
|
33
|
+
|
|
34
|
+
### Development
|
|
35
|
+
|
|
36
|
+
#### Get Wordmove
|
|
37
|
+
|
|
38
|
+
* fork wordmove
|
|
39
|
+
* clone your own repo
|
|
40
|
+
* be sure to check-out the right branch, usually `master`
|
|
41
|
+
|
|
42
|
+
##### Installing Ruby
|
|
43
|
+
|
|
44
|
+
To install ruby, please, use [rbenv](https://github.com/rbenv/rbenv) or [RVM](https://rvm.io).
|
|
45
|
+
|
|
46
|
+
##### Contribute
|
|
47
|
+
|
|
48
|
+
* run `bundle install` to install gem dependencies
|
|
49
|
+
* `git checkout -b my_feature_or_fix_name`
|
|
50
|
+
* code, commit, push and send a pull request on GitHub
|
|
51
|
+
|
|
52
|
+
> Version bump is considered to be a maintainer's task, so please leave the version
|
|
53
|
+
alone while working on your branch.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
##### Test Wordmove
|
|
57
|
+
|
|
58
|
+
Wordmove has a decent test coverage. We _require_ that pull requests does not break tests launched by the CI.
|
|
59
|
+
In order to launch tests on you dev machine
|
|
60
|
+
|
|
61
|
+
```fish
|
|
62
|
+
rake
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The command will launch the test suite - written with RSpec - and rubocop.
|
|
66
|
+
|
|
67
|
+
In order to use the gem locally you can install it
|
|
68
|
+
|
|
69
|
+
```fish
|
|
70
|
+
rake install
|
|
71
|
+
wordmove --version
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
or run the executable directly
|
|
75
|
+
|
|
76
|
+
```fish
|
|
77
|
+
bin/wordmove --version
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Maintainer tasks
|
|
81
|
+
|
|
82
|
+
ToDo:
|
|
83
|
+
|
|
84
|
+
* [ ] versioning and version dumping
|
|
85
|
+
* [ ] changelog/release
|
|
86
|
+
* [ ] publishing the gem
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013-2019 weLaika Soc. Coop.
|
|
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:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.mdown
CHANGED
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
Wordmove is a
|
|
5
|
+
Wordmove is a command line tool that lets you automatically mirror local WordPress
|
|
6
6
|
installations and DB data back and forth from your local development machine to
|
|
7
|
-
|
|
7
|
+
one or more remote servers.
|
|
8
8
|
|
|
9
|
-
Wordmove has also a neat hook system which enables you to run arbitrary commands
|
|
10
|
-
before and after push/pull actions. Local and remote commands are both supported
|
|
11
|
-
ones
|
|
9
|
+
Wordmove has also a neat [hook](https://github.com/welaika/wordmove/wiki/Hooks) system which enables you to run arbitrary commands
|
|
10
|
+
before and after push/pull actions. Local and remote commands are both supported (remote
|
|
11
|
+
ones only on SSH protocol).
|
|
12
12
|
|
|
13
|
-
[FTP support has been discontinued](https://github.com/welaika/wordmove/wiki/FTP-support-disclaimer), thus
|
|
14
|
-
while base functionalities are granted.
|
|
13
|
+
[FTP support development has been discontinued](https://github.com/welaika/wordmove/wiki/FTP-support-disclaimer), thus not all features are granted when using this protocol.
|
|
15
14
|
|
|
16
|
-
[](https://github.com/welaika/wordmove/actions)
|
|
17
16
|
[](https://wphub-auto-invitation.herokuapp.com/)
|
|
18
17
|
[](https://rubygems.org/gems/wordmove)
|
|
19
18
|
[](https://hub.docker.com/r/welaika/wordmove/)
|
|
@@ -21,7 +20,9 @@ while base functionalities are granted.
|
|
|
21
20
|
|
|
22
21
|
## Installation
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
Wordmove is developed in ruby and packaged and distributed as a gem.
|
|
24
|
+
|
|
25
|
+
To install:
|
|
25
26
|
|
|
26
27
|
gem install wordmove
|
|
27
28
|
|
|
@@ -29,17 +30,21 @@ And to update:
|
|
|
29
30
|
|
|
30
31
|
gem update wordmove
|
|
31
32
|
|
|
33
|
+
You can read more about ruby gems ecosystem on the official site https://rubygems.org/.
|
|
34
|
+
|
|
32
35
|
## Peer dependencies
|
|
33
36
|
|
|
34
|
-
Wordmove
|
|
37
|
+
Wordmove acts as automation glue between tools you already have and love. These are its peer dependencies which **you need to have installed** and executable through your system $PATH:
|
|
38
|
+
|
|
39
|
+
| Program | Mandatory? |
|
|
40
|
+
| --------- | -------------------------------- |
|
|
41
|
+
| rsync | Yes for SSH protocol |
|
|
42
|
+
| mysql | Yes |
|
|
43
|
+
| mysqldump | Yes |
|
|
44
|
+
| wp-cli | Yes by default, but configurable |
|
|
45
|
+
| lftp | Yes, for FTP protocol |
|
|
35
46
|
|
|
36
|
-
|
|
37
|
-
| ------- | ---------------------------- | ------------------------------- |
|
|
38
|
-
| rsync | Mirror files and dirs | Yes for SSH connections |
|
|
39
|
-
| mysql | Import database | Yes |
|
|
40
|
-
| mysqldump | Dump database | Yes |
|
|
41
|
-
| wp-cli | Adapt database | Yes by default, but configurable|
|
|
42
|
-
| lftp | all | Yes, for FTP connections |
|
|
47
|
+
Wordmove also expect that the remote server will have the following commands: `gzip`, `nice`, `mysql`, `rsync`. All of these should be always present by default on any WordPress hosting.
|
|
43
48
|
|
|
44
49
|
## Usage
|
|
45
50
|
|
|
@@ -59,11 +64,17 @@ Move inside the WordPress folder and use `wordmove init` to generate a new `move
|
|
|
59
64
|
|
|
60
65
|
**See the wiki article: [Usage and flags explained](https://github.com/welaika/wordmove/wiki/Usage-and-flags-explained) for more info.**
|
|
61
66
|
|
|
62
|
-
### Screencasts
|
|
63
67
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
|
|
69
|
+
### Multistage
|
|
70
|
+
|
|
71
|
+
You can define multiple remote environments in your `movefile.yml`, such as production, staging, etc. Every first level key in the YAML other than the defaults and mandatory `global` and `local` will be interpreted as a remote environment.
|
|
72
|
+
|
|
73
|
+
Use `-e` with `pull` or `push` to run the command on the specified environment.
|
|
74
|
+
|
|
75
|
+
For example: `wordmove push -e staging -d` will push your local database to the staging environment.
|
|
76
|
+
|
|
77
|
+
We warmly **recommend to read the wiki article**: [Multiple environments explained](https://github.com/welaika/wordmove/wiki/Multiple-environments-explained)
|
|
67
78
|
|
|
68
79
|
## movefile.yml
|
|
69
80
|
|
|
@@ -141,24 +152,12 @@ production:
|
|
|
141
152
|
# where: remote
|
|
142
153
|
```
|
|
143
154
|
|
|
144
|
-
|
|
145
|
-
](https://github.com/welaika/wordmove/wiki/Multiple-environments-explained) if you need multi-stage support,
|
|
146
|
-
and the wiki article [Movefile configurations explained](https://github.com/welaika/wordmove/wiki/movefile.yml-configurations-explained)
|
|
147
|
-
to understand about the supported configurations.**
|
|
155
|
+
We warmly **recommend to read the wiki articles**
|
|
148
156
|
|
|
149
|
-
|
|
157
|
+
* [Multiple environments explained](https://github.com/welaika/wordmove/wiki/Multiple-environments-explained)
|
|
158
|
+
* [Movefile configurations explained](https://github.com/welaika/wordmove/wiki/movefile.yml-configurations-explained)
|
|
150
159
|
|
|
151
|
-
|
|
152
|
-
Use `-e` with `pull` or `push` to run the command on the specified environment.
|
|
153
|
-
|
|
154
|
-
For example:
|
|
155
|
-
|
|
156
|
-
wordmove push -e staging -d
|
|
157
|
-
|
|
158
|
-
will push your local database to the staging environment only.
|
|
159
|
-
|
|
160
|
-
We warmly **recommend** to read the wiki article: [Multiple environments explained
|
|
161
|
-
](https://github.com/welaika/wordmove/wiki/Multiple-environments-explained)
|
|
160
|
+
to understand more about supported configurations.
|
|
162
161
|
|
|
163
162
|
## Environment Variables
|
|
164
163
|
|
|
@@ -171,6 +170,7 @@ Environment variables are written using the **ERB tags** syntax:
|
|
|
171
170
|
```
|
|
172
171
|
|
|
173
172
|
### Variables set up
|
|
173
|
+
|
|
174
174
|
Environment variables can be set up using two methods:
|
|
175
175
|
|
|
176
176
|
#### Using the shell:
|
|
@@ -281,38 +281,10 @@ Visit [Wordpress Tools](https://www.wptools.it).
|
|
|
281
281
|
|
|
282
282
|
## Contribute
|
|
283
283
|
|
|
284
|
-
|
|
285
|
-
We will accordingly tag and release or pre-release versions to the rubygems.org repository.
|
|
286
|
-
Do not consider the `dev` branch for your forks and PR.
|
|
287
|
-
We will never more use version-named branches as in the past, but we'll tag release on `master` and pre-release on `dev`.
|
|
288
|
-
|
|
289
|
-
### Please, **read the full [contributor guide](https://github.com/welaika/wordmove/wiki/Contributor-Guide)**.
|
|
284
|
+
Please, read the [contributor guide](https://github.com/welaika/wordmove/blob/master/CONTRIBUTING.md).
|
|
290
285
|
|
|
291
|
-
Feel free to open
|
|
286
|
+
Feel free to open a discussion issue about contribution if you need more info.
|
|
292
287
|
|
|
293
288
|
## Author
|
|
294
289
|
|
|
295
290
|
made with ❤️ and ☕️ by [weLaika](https://dev.welaika.com)
|
|
296
|
-
|
|
297
|
-
## License
|
|
298
|
-
|
|
299
|
-
(The MIT License)
|
|
300
|
-
|
|
301
|
-
Copyright © 2013-2019 weLaika
|
|
302
|
-
|
|
303
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
304
|
-
this software and associated documentation files (the ‘Software’), to deal in
|
|
305
|
-
the Software without restriction, including without limitation the rights to
|
|
306
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
307
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
308
|
-
subject to the following conditions:
|
|
309
|
-
|
|
310
|
-
The above copyright notice and this permission notice shall be included in all
|
|
311
|
-
copies or substantial portions of the Software.
|
|
312
|
-
|
|
313
|
-
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
314
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
315
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
316
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
317
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
318
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/deploy/deploy.sh
CHANGED
|
@@ -100,11 +100,9 @@ module Wordmove
|
|
|
100
100
|
|
|
101
101
|
return true if simulate?
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
file << open(url).read
|
|
103
|
+
File.open(local_path, 'w') do |file|
|
|
104
|
+
file << URI.open(url).read
|
|
106
105
|
end
|
|
107
|
-
# rubocop:enable Security/Open
|
|
108
106
|
end
|
|
109
107
|
|
|
110
108
|
def simulate?
|
data/lib/wordmove/hook.rb
CHANGED
|
@@ -4,6 +4,7 @@ module Wordmove
|
|
|
4
4
|
Logger.new(STDOUT).tap { |l| l.level = Logger::DEBUG }
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
+
# rubocop:disable Metrics/MethodLength
|
|
7
8
|
def self.run(action, step, cli_options)
|
|
8
9
|
movefile = Wordmove::Movefile.new(cli_options[:config])
|
|
9
10
|
options = movefile.fetch(false)
|
|
@@ -15,37 +16,48 @@ module Wordmove
|
|
|
15
16
|
step
|
|
16
17
|
)
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
Wordmove::Hook::Local.run(hooks.local_hooks, options[:local], cli_options[:simulate])
|
|
20
|
-
end
|
|
19
|
+
return if hooks.empty?
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
logger.task "Running #{action}/#{step} hooks"
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
hooks.all_commands.each do |command|
|
|
24
|
+
case command[:where]
|
|
25
|
+
when 'local'
|
|
26
|
+
Wordmove::Hook::Local.run(command, options[:local], cli_options[:simulate])
|
|
27
|
+
when 'remote'
|
|
28
|
+
if options[environment][:ftp]
|
|
29
|
+
logger.debug "You have configured remote hooks to run over "\
|
|
30
|
+
"an FTP connection, but this is not possible. Skipping."
|
|
31
|
+
next
|
|
32
|
+
end
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
Wordmove::Hook::Remote.run(command, options[environment], cli_options[:simulate])
|
|
35
|
+
else
|
|
36
|
+
next
|
|
37
|
+
end
|
|
29
38
|
end
|
|
30
|
-
|
|
31
|
-
Wordmove::Hook::Remote.run(
|
|
32
|
-
hooks.remote_hooks, options[environment], cli_options[:simulate]
|
|
33
|
-
)
|
|
34
39
|
end
|
|
40
|
+
# rubocop:enable Metrics/MethodLength
|
|
35
41
|
|
|
36
42
|
Config = Struct.new(:options, :action, :step) do
|
|
37
43
|
def empty?
|
|
38
|
-
|
|
44
|
+
all_commands.empty?
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def all_commands
|
|
48
|
+
return [] if empty_step?
|
|
49
|
+
|
|
50
|
+
options[action][step] || []
|
|
39
51
|
end
|
|
40
52
|
|
|
41
|
-
def
|
|
53
|
+
def local_commands
|
|
42
54
|
return [] if empty_step?
|
|
43
55
|
|
|
44
56
|
options[action][step]
|
|
45
57
|
.select { |hook| hook[:where] == 'local' } || []
|
|
46
58
|
end
|
|
47
59
|
|
|
48
|
-
def
|
|
60
|
+
def remote_commands
|
|
49
61
|
return [] if empty_step?
|
|
50
62
|
|
|
51
63
|
options[action][step]
|
|
@@ -69,24 +81,20 @@ module Wordmove
|
|
|
69
81
|
parent.logger
|
|
70
82
|
end
|
|
71
83
|
|
|
72
|
-
def self.run(
|
|
73
|
-
logger.task "Running local hooks"
|
|
74
|
-
|
|
84
|
+
def self.run(command_hash, options, simulate = false)
|
|
75
85
|
wordpress_path = options[:wordpress_path]
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return true if simulate
|
|
87
|
+
logger.task_step true, "Exec command: #{command_hash[:command]}"
|
|
88
|
+
return true if simulate
|
|
80
89
|
|
|
81
|
-
|
|
82
|
-
|
|
90
|
+
stdout_return = `cd #{wordpress_path} && #{command_hash[:command]} 2>&1`
|
|
91
|
+
logger.task_step true, "Output: #{stdout_return}"
|
|
83
92
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
end
|
|
93
|
+
if $CHILD_STATUS.exitstatus.zero?
|
|
94
|
+
logger.success ""
|
|
95
|
+
else
|
|
96
|
+
logger.error "Error code: #{$CHILD_STATUS.exitstatus}"
|
|
97
|
+
raise Wordmove::LocalHookException unless command_hash[:raise].eql? false
|
|
90
98
|
end
|
|
91
99
|
end
|
|
92
100
|
end
|
|
@@ -96,28 +104,25 @@ module Wordmove
|
|
|
96
104
|
parent.logger
|
|
97
105
|
end
|
|
98
106
|
|
|
99
|
-
def self.run(
|
|
100
|
-
logger.task "Running remote hooks"
|
|
101
|
-
|
|
107
|
+
def self.run(command_hash, options, simulate = false)
|
|
102
108
|
ssh_options = options[:ssh]
|
|
103
109
|
wordpress_path = options[:wordpress_path]
|
|
104
110
|
|
|
105
111
|
copier = Photocopier::SSH.new(ssh_options).tap { |c| c.logger = logger }
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
end
|
|
112
|
+
|
|
113
|
+
logger.task_step false, "Exec command: #{command_hash[:command]}"
|
|
114
|
+
return true if simulate
|
|
115
|
+
|
|
116
|
+
stdout, stderr, exit_code =
|
|
117
|
+
copier.exec!("cd #{wordpress_path} && #{command_hash[:command]}")
|
|
118
|
+
|
|
119
|
+
if exit_code.zero?
|
|
120
|
+
logger.task_step false, "Output: #{stdout}"
|
|
121
|
+
logger.success ""
|
|
122
|
+
else
|
|
123
|
+
logger.task_step false, "Output: #{stderr}"
|
|
124
|
+
logger.error "Error code #{exit_code}"
|
|
125
|
+
raise Wordmove::RemoteHookException unless command_hash[:raise].eql? false
|
|
121
126
|
end
|
|
122
127
|
end
|
|
123
128
|
end
|
data/lib/wordmove/logger.rb
CHANGED
|
@@ -7,7 +7,12 @@ module Wordmove
|
|
|
7
7
|
formatted_message = if strings_to_hide.empty?
|
|
8
8
|
message
|
|
9
9
|
else
|
|
10
|
-
message.gsub(
|
|
10
|
+
message.gsub(
|
|
11
|
+
Regexp.new(
|
|
12
|
+
strings_to_hide.map { |string| Regexp.escape(string) }.join('|')
|
|
13
|
+
),
|
|
14
|
+
'[secret]'
|
|
15
|
+
)
|
|
11
16
|
end
|
|
12
17
|
|
|
13
18
|
"\n#{formatted_message}\n"
|
data/lib/wordmove/movefile.rb
CHANGED
|
@@ -47,11 +47,20 @@ module Wordmove
|
|
|
47
47
|
available_enviroments = extract_available_envs(options)
|
|
48
48
|
options.merge!(cli_options).deep_symbolize_keys!
|
|
49
49
|
|
|
50
|
-
if
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
if options[:environment] != 'local'
|
|
51
|
+
if available_enviroments.size > 1 && options[:environment].nil?
|
|
52
|
+
raise(
|
|
53
|
+
UndefinedEnvironment,
|
|
54
|
+
"You need to specify an environment with --environment parameter"
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
if options[:environment].present?
|
|
59
|
+
unless available_enviroments.include?(options[:environment].to_sym)
|
|
60
|
+
raise UndefinedEnvironment, "No environment found for \"#{options[:environment]}\". "\
|
|
61
|
+
"Available Environments: #{available_enviroments.join(' ')}"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
55
64
|
end
|
|
56
65
|
|
|
57
66
|
(options[:environment] || available_enviroments.first).to_sym
|
|
@@ -11,12 +11,43 @@ module Wordmove
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def command
|
|
14
|
-
unless
|
|
14
|
+
unless wp_in_path?
|
|
15
15
|
raise UnmetPeerDependencyError, "WP-CLI is not installed or not in your $PATH"
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
opts = [
|
|
19
|
+
"--path=#{cli_config_path}",
|
|
20
|
+
from,
|
|
21
|
+
to,
|
|
22
|
+
"--quiet",
|
|
23
|
+
"--skip-columns=guid",
|
|
24
|
+
"--all-tables",
|
|
25
|
+
"--allow-root"
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
"wp search-replace #{opts.join(' ')}"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def wp_in_path?
|
|
34
|
+
system('which wp > /dev/null 2>&1')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def cli_config_path
|
|
38
|
+
load_from_yml || load_from_cli || local_path
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def load_from_yml
|
|
42
|
+
cli_config_path = File.join(local_path, "wp-cli.yml")
|
|
43
|
+
return unless File.exist?(cli_config_path)
|
|
44
|
+
|
|
45
|
+
YAML.load_file(cli_config_path).with_indifferent_access["path"]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def load_from_cli
|
|
49
|
+
cli_config = JSON.parse(`wp cli param-dump --with-values`, symbolize_names: true)
|
|
50
|
+
cli_config.dig(:path, :current)
|
|
20
51
|
end
|
|
21
52
|
end
|
|
22
53
|
end
|
data/lib/wordmove/version.rb
CHANGED
data/wordmove.gemspec
CHANGED
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.add_runtime_dependency "colorize", "~> 0.8.1"
|
|
34
34
|
spec.add_runtime_dependency "dotenv", "~> 2.7.5"
|
|
35
35
|
spec.add_runtime_dependency "kwalify", "~> 0"
|
|
36
|
-
spec.add_runtime_dependency "photocopier", "1.
|
|
36
|
+
spec.add_runtime_dependency "photocopier", "~> 1.4", ">= 1.4.0"
|
|
37
37
|
spec.add_runtime_dependency "thor", "~> 0.20.3"
|
|
38
38
|
|
|
39
39
|
spec.required_ruby_version = ">= 2.6.0"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wordmove
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stefano Verna
|
|
@@ -9,10 +9,10 @@ authors:
|
|
|
9
9
|
- Fabrizio Monti
|
|
10
10
|
- Alessandro Fazzi
|
|
11
11
|
- Filippo Gangi Dino
|
|
12
|
-
autorequire:
|
|
12
|
+
autorequire:
|
|
13
13
|
bindir: exe
|
|
14
14
|
cert_chain: []
|
|
15
|
-
date:
|
|
15
|
+
date: 2020-12-13 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
18
18
|
name: activesupport
|
|
@@ -80,16 +80,22 @@ dependencies:
|
|
|
80
80
|
name: photocopier
|
|
81
81
|
requirement: !ruby/object:Gem::Requirement
|
|
82
82
|
requirements:
|
|
83
|
-
- -
|
|
83
|
+
- - ">="
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: 1.4.0
|
|
86
|
+
- - "~>"
|
|
84
87
|
- !ruby/object:Gem::Version
|
|
85
|
-
version: 1.
|
|
88
|
+
version: '1.4'
|
|
86
89
|
type: :runtime
|
|
87
90
|
prerelease: false
|
|
88
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
92
|
requirements:
|
|
90
|
-
- -
|
|
93
|
+
- - ">="
|
|
91
94
|
- !ruby/object:Gem::Version
|
|
92
|
-
version: 1.
|
|
95
|
+
version: 1.4.0
|
|
96
|
+
- - "~>"
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
version: '1.4'
|
|
93
99
|
- !ruby/object:Gem::Dependency
|
|
94
100
|
name: thor
|
|
95
101
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -214,15 +220,21 @@ executables:
|
|
|
214
220
|
extensions: []
|
|
215
221
|
extra_rdoc_files: []
|
|
216
222
|
files:
|
|
223
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
|
224
|
+
- ".github/ISSUE_TEMPLATE/discussion.md"
|
|
225
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
|
226
|
+
- ".github/stale.yml"
|
|
227
|
+
- ".github/workflows/ruby.yml"
|
|
217
228
|
- ".gitignore"
|
|
218
229
|
- ".rspec"
|
|
219
230
|
- ".rubocop.yml"
|
|
220
231
|
- ".ruby-gemset"
|
|
221
232
|
- ".ruby-version"
|
|
222
|
-
- ".travis.yml"
|
|
223
233
|
- ".vscode/launch.json"
|
|
224
234
|
- CHANGELOG.md
|
|
235
|
+
- CONTRIBUTING.md
|
|
225
236
|
- Gemfile
|
|
237
|
+
- LICENSE
|
|
226
238
|
- README.mdown
|
|
227
239
|
- Rakefile
|
|
228
240
|
- assets/images/wordmove.png
|
|
@@ -303,12 +315,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
303
315
|
version: 2.6.0
|
|
304
316
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
317
|
requirements:
|
|
306
|
-
- - "
|
|
318
|
+
- - ">="
|
|
307
319
|
- !ruby/object:Gem::Version
|
|
308
|
-
version:
|
|
320
|
+
version: '0'
|
|
309
321
|
requirements: []
|
|
310
322
|
rubygems_version: 3.0.3
|
|
311
|
-
signing_key:
|
|
323
|
+
signing_key:
|
|
312
324
|
specification_version: 4
|
|
313
325
|
summary: Wordmove, Capistrano for Wordpress
|
|
314
326
|
test_files: []
|
data/.travis.yml
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
|
|
3
|
-
rvm:
|
|
4
|
-
- 2.6.5
|
|
5
|
-
|
|
6
|
-
cache: bundler
|
|
7
|
-
|
|
8
|
-
before_install:
|
|
9
|
-
- gem update --system
|
|
10
|
-
- gem install bundler
|
|
11
|
-
|
|
12
|
-
install:
|
|
13
|
-
- curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
|
14
|
-
- chmod +x wp-cli.phar
|
|
15
|
-
- sudo mv wp-cli.phar /usr/local/bin/wp
|
|
16
|
-
- bundle install --jobs=3 --retry=3
|
|
17
|
-
|
|
18
|
-
deploy:
|
|
19
|
-
provider: script
|
|
20
|
-
script: bash deploy/deploy.sh
|
|
21
|
-
on:
|
|
22
|
-
tags: true
|
|
23
|
-
branch: master
|
|
24
|
-
ruby: '2.6.5'
|