Skip to content

Setting up the boilerplate in UNIX

Giustino Borzacchiello edited this page Jul 11, 2015 · 6 revisions

Setting up the boilerplate for the first time might take a while, here are the steps I used in order to get it up and running in a repeatable and generic manner using the UNIX terminal, should work in most Linux distros as well as OSX. I'll assume you work in ~/workspace but you must replace this part with your actual workplace.

We'll do the following things:

  • Clone the repository
  • Rename it and remove the git repository
  • Create a soft link to our plugin trunk folder
  • Rename all files
  • Replace most of the "Plugin Name" occurrences inside our plugin files
  • Create a new clean git repository for our plugin

Let's start!

$ cd ~/workspace
$ git clone https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate.git
$ mv WordPress-Plugin-Boilerplate my-plugin
$ rm -rf my-plugin/.git

Now we need a name for our plugin, in this example, I'll name it my-plugin, the idea is to easily replace plugin-name everywhere inside the plugin repo.

$ cd ~/workspace/my-wordpress/wp-content/plugins
$ ln -s ~/workspace/my-plugin/plugin-name/trunk my-plugin

Let's now, let's update the plugin name:

$ cd my-plugin
# Update file names
$ mv plugin-name.php my-plugin.php
$ rename 's/plugin-name/my-plugin/' **/**/*
# Update reference inside all .php files
$ find . -name "*.php" -exec sed -i 's/plugin-name/my-plugin/g' {} \;
$ find . -name "*.php" -exec sed -i 's/Plugin_Name/My_Plugin/g' {} \;

And that's it! Now we set up our git repo and we're done.

$ git init
$ git add --all
$ git commit -m "Initial commit"

Note that there are still some function names and comments that you'll want to manually update, but at least this takes care of the biggest burden.

Clone this wiki locally