Skip to content

LudovicFauchet/wordmove

Repository files navigation

Wordmove

Wordmove is a nice little gem that lets you automatically mirror local Wordpress installations and DB data back and forth from your local development machine to the remote staging server. SSH and FTP connections are both supported.

Think of it like Capistrano for Wordpress, complete with push/pull capabilities.

Installation

That's easy:

gem install wordmove

Upgrading?

Beware!

From version 1.0 we have decided to change wordmove flags' behaviour: they used to tell wordmove which options to skip, now they tell instead which options to include. In the Movefile, we have also changed all "username" fields to be just "user".

So please, be very careful when upgrading ❤️

Usage

> wordmove help
Tasks:
  wordmove help [TASK]  # Describe available tasks or one specific task
  wordmove init         # Generates a brand new Movefile
  wordmove pull         # Pulls WP data from remote host to the local machine
  wordmove push         # Pushes WP data from local machine to remote host

Movefile

You can configure Wordmove creating a Movefile. That's just a YAML file with all the local and remote host infos:

local:
  vhost: "http://vhost.local"
  wordpress_path: "~/dev/sites/your_site"
  database:
    name: "database_name"
    user: "user"
    password: "password"
    host: "127.0.0.1"
staging:
  vhost: "http://remote.com"
  wordpress_path: "/var/www/your_site"
  # paths: # you can customize wordpress internal paths
  #   wp_content: "wp-content"
  #   uploads: "wp-content/uploads"
  #   plugins: "wp-content/plugins"
  #   languages: "wp-content/languages"
  exclude:
    - ".sass-cache"
    - ".git"
    - "bin"
    - "tmp/*"
    - "wp-content/*.sql"
    - "Gemfile*"
    - "Movefile"
  database:
    name: "database_name"
    user: "user"
    password: "password"
    host: "host"
  # ssh:
  #   host: "host"
  #   user: "user"
  #   password: "password" # password is optional, will use public keys if available.
  #   port: 22 # Port is optional
  #   gateway: # Gateway is optional
  #     host: "host"
  #     user: "user"
  #     password: "password" # password is optional, will use public keys if available.
  # ftp:
  #   user: "user"
  #   password: "password"
  #   host: "host"
  #   passive: true
# production: # multiple environments can be specified
#   [...]

If you have your local SSH public key already installed on the remote machine.. (recommended)

Just not use the remote.ssh.password field on your Movefile. Easy peasy.

If you want to specify SSH password on the Movefile

Please take a look at the various gotchas of the underlying photocopier gem.

How the heck you are able to sync the DB via FTP?

We're glad you asked! We basically upload via FTP a PHP script that performs the various import/export operations. This script then gets executed via HTTP. Don't worry too much about security though: the script is deleted just after the usage, and can only be executed by wordmove, as each time it requires a pre-shared one-time-password to be run.

If you want to specify both relative and absolute wordpress path (FTP relative paths anyone?)

Just add in the remote section of the Movefile a wordpress_absolute_path field specifying the absolute path (you may need to recover this from the __FILE__ constant), while using wordpress_path for the relative folder path.

If you want to specify a passive FTP connection

Add to the YAML config a passive flag set to true.

License

(The MIT License)

Copyright © 2013 weLaika

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Capistrano for Wordpress

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 91.3%
  • PHP 8.7%