Git, WordPress plugins, and a bit of sanity: Scatter

A few months ago I made a tool called Scatter to help automate deploys and keep them separated from code. This weekend I completely rewrote it in Ruby (from Python) and added some new features (install it with gem install scatter_deploy). One of those new features is shared deploy scripts, which turns out to be a really handy way to deploy WordPress plugins from Git to I made a 5 minute screencast that shows the process of deploying and updating a plugin without ever touching SVN.

First, a bit of background.’s plugin system uses Subversion. I use Git for all of my projects. While there are a bunch of ways to communicate between the two systems, they’ve all been varying degrees of annoying for me. For a while I was using this workflow from Boone Gorges based on git-svn. It had some big problems though — it’s slow, and it causes huge problems when you try to do things in Git that SVN doesn’t understand (like use submodules). As a result, even Boone doesn’t actually use that Workflow anymore. I also considered this workflow from Daniel Bachhuber, which basically handles the problem by creating two repos in the same “place”. That felt very manual and error-prone though.

When I added support for shared deploy scripts in Scatter, I decided to use that to automate this whole plugin process. I started with Ben Balter’s plugin deploy script and made a few small changes to (1) add some safety checks and (2) build in assumptions that fit Scatter’s process. The result is that I can now run scatter -s wp from anywhere inside a WordPress plugin Git repository, and have everything just work. You can see some more details in the Scatter Deploy Examples readme.

This is not the only thing that Scatter does — it’s a more general deploy tool — but it’s one of the use cases that I think is pretty cool.

19 thoughts on “Git, WordPress plugins, and a bit of sanity: Scatter

  1. Nikolay Bachiyski

    Cool, I like the idea of keeping all those procedures in a single tool.

    A few words on the workflow of tagging a new WordPress plugin version. You don’t need to checkout the whole Subversion tree with all the branches. trunk is enough. For the purpose of tagging svn copy works with URLs, too, so you can run svn cp /tmp/wp-evanescence-trunk-checkout -m "Tagging x.y.z of evanescence". This will save a ton of time and bandwidth.

    1. evan Post author

      Cool, I think I knew that at some point but clearly forgot. I’ll change that in the example repo — feel free to make a pull request before I get to it, if you’re so inclined.

  2. Pingback: How To Push To Github And | Code, Sleep, Shred.

  3. Brandon C

    Sweet man! Great adaptation of benbalters script. Worked like a charm ( except I had to install ack ) Thanks Evan I’ll be using this daily.

    1. evan Post author

      Oops, I forgot to mention that it uses ack. It could just as easily use grep, so I should probably change that, but you’ll be happy you installed ack anyway.

  4. Ken

    I am having trouble implementing this script. I keep getting this error:

    “The system cannot find the path specified.

    Scatter requires Git if you want it to find projects automatically’

    I’ve tried adding git to my path, I’ve got ack installed, when I give a command like ‘scatter version’ or ‘scatter help’ I get the appropriate response. But when I try to deploy or anything else I get the above error.

    I have also noticed that the ‘.deploys’ folder was not created. I tried several installs and it didn’t happen. I’m on Windows vista.

    any ideas?



    1. evan Post author

      I’ve tried adding git to my path

      It you’re getting that Git message it means that this command is failing. On OSX/Linux that means there’s not a git executable in your path. I assume it means the same on Windows, but i’m not 100% sure. What happens if you just run a Git command, does it work? If so, maybe your shell doesn’t have a which command? I have only barely tested Scatter on Windows, so it’s not out of the question that I’m doing something wrong. If you know of a better way to check for an executable on Windows let me know (or better yet, make a pull request).

      I have also noticed that the ‘.deploys’ folder was not created. I tried several installs and it didn’t happen.

      It won’t get created automatically. I have an example repo that you can use, but it’s not really possible to automatically create a deploys directory for you because I have no way of knowing what projects you want to deploy or where.

  5. Ken

    Thanks Evan,

    yeah I found that line in the code that was triggering the error. ‘which git’ works in my git bash, but the rest of the statement triggers the error. It must be a windows thing and I can’t quite navigate through. If I figure it out I will do a pull request.

    I didn’t realise I had to manually create the deploys folder. I guess I didn’t read it carefully enough.

    thanks for your help.


    1. evan Post author

      ‘which git’ works in my git bash, but the rest of the statement triggers the error

      Ah, that makes sense. /dev/null doesn’t exist on Windows.

      I’m not sure if this will fix it, but I tried one idea that you can see on this branch on GitHub. If you could test that and let me know if it works, that would be cool. Here’s what you need to do to test it.

      gem uninstall scatter_deploy
      git clone --branch check-windows-git
      cd scatter
      gem build scatter_deploy.gemspec
      gem install scatter_deploy-0.2.4.gem

      At this point you’ll have a local install of Scatter (you may need to open a new tab/terminal session before it takes effect). Try running it again and let me know if you get the same error.

  6. Pingback: How to: Pushing an existing git repository to SVN | SevenNet

  7. Pingback: Fixed Pushing an existing git repository to SVN #dev #it #asnwer | Good Answer

  8. Pingback: Answer: Pushing an existing git repository to SVN #it #dev #fix | IT Info

Comments are closed.