folioshell
Tools
Open Source
PHP
WordPress
FolioShell – WordPress Command Line Tools
This is a script developed by Foliolabs Team to ease the management of WordPress sites.
It is designed to work on Linux and MacOS. Windows users can use it in Nooku Vagrant box
Installation
- Download or clone this repository.
-
Make the
folioshell
command executable:
$ chmod u+x /path/to/folioshell/bin/folioshell
-
Configure your system to recognize where the executable resides. There are 3 options:
-
Create a symbolic link in a directory that is already in your PATH, e.g.:
$ ln -s /path/to/folioshell/bin/folioshell /usr/bin/folioshell
-
Explicitly add the executable to the PATH variable which is defined in the the shell configuration file called .profile, .bash_profile, .bash_aliases, or .bashrc that is located in your home folder, i.e.:
export PATH="$PATH:/path/to/folioshell/bin:/usr/local/bin"
-
Add an alias for the executable by adding this to you shell configuration file (see list in previous option):
$ alias folioshell=/path/to/folioshell/bin/folioshell
<p> For options 2 and 3 above, you should log out and then back in to apply your changes to your current session. </li> <li> Test that <code>folioshell</code> executable is found by your system:<br /> <code>$ which folioshell</code> </li> <li> From <code>folioshell</code> root (<code>/path/to/folioshell</code>), run Composer to fetch dependencies.<br /> <code>$ composer install</code> </li></ol> <p> For available options, try running: </p> <pre class="notranslate"><code>folioshell --list
<h2 dir="auto"> <a rel="nofollow noopener" target="_blank" id="user-content-usage" class="anchor" aria-hidden="true" href="#usage"></a>Usage </h2> <h3 dir="auto"> <a rel="nofollow noopener" target="_blank" id="user-content-create-sites" class="anchor" aria-hidden="true" href="#create-sites"></a>Create Sites </h3> <p> To create a site with the latest WordPress version, run: </p> <pre class="notranslate"><code>folioshell site:create testsite
<p> The newly installed site will be available at /var/www/testsite and testsite.dev after that. You can login into your fresh WordPress installation using these credentials: <code>admin</code> / <code>admin</code>.<br /> By default the web server root is set to /var/www. You can pass –www=/my/server/path to commands for custom values.<br /> You can choose the WordPress version to be installed: </p> <pre class="notranslate"><code>folioshell site:create testsite --wordpress=4.2
<p> You can pick any branch from the Git repository (e.g. master, staging) using this command.<br /> You can also add your projects into the new site by symlinking. See the Symlinking section below for detailed information. </p> <pre class="notranslate"><code>folioshell site:create testsite --symlink=project1,project2
<p> For more information and available options, try running: </p> <pre class="notranslate"><code>folioshell site:create --help
<h3 dir="auto"> <a rel="nofollow noopener" target="_blank" id="user-content-delete-sites" class="anchor" aria-hidden="true" href="#delete-sites"></a>Delete Sites </h3> <p> You can delete the sites you have created by running: </p> <pre class="notranslate"><code>folioshell site:delete testsite
<h3 dir="auto"> <a rel="nofollow noopener" target="_blank" id="user-content-symlink-plugins" class="anchor" aria-hidden="true" href="#symlink-plugins"></a>Symlink Plugins </h3> <p> Let’s say you are working on your own WordPress component called Awesome and want to develop it with the latest WordPress version.<br /> By default your code is assumed to be in ~/Projects. You can pass –projects-dir=/my/code/is/here to commands for custom values.<br /> Please note that your source code should resemble the WordPress <code>wp-content</code> folder structure for symlinking to work properly. For example, plugins folder should reside in ~/Projects/projectname/code/plugins/projectname.<br /> Now to create a new site, execute the site:create command and add a symlink option: </p> <pre class="notranslate"><code>folioshell site:create testsite --symlink=projectname
<p> Or to symlink your code into an existing site: </p> <pre class="notranslate"><code>folioshell extension:symlink testsite projectname
<p> This will symlink all the folders from the projectname folder into testsite.dev.<br /> Run discover install to make your component available to WordPress and you are good to go!<br /> For more information on the symlinker, run: </p> <pre class="notranslate"><code>folioshell extension:symlink --help
<h3 dir="auto"> <a rel="nofollow noopener" target="_blank" id="user-content-install-plugins" class="anchor" aria-hidden="true" href="#install-plugins"></a>Install Plugins </h3> <p> You can install plugins from WordPress’s Official Plugin Repository on command line to install plugins. </p> <pre class="notranslate"><code>folioshell extension:install testsite pluginslug
<p> You need to use the unique slug of the plugin.<br /> For more information, run: </p> <pre class="notranslate"><code>folioshell extension:install --help
<p> Alternatively, you can install plugins using packages or url using the <code>extension:installfile</code> command. Example: </p> <pre class="notranslate"><code>folioshell extension:installfile testsite /home/vagrant/pluginone.v1.x.zip /home/vagrant/plugintwo.v2.x.tar.gz
<p> And as URL </p> <pre class="notranslate"><code>folioshell extension:installfile testsite http://url.com/to/pluginone.v1.x.zip http://url.com/to/plugintwo.v2.x.tar.gz
<p> This will install both the pluginone.v1.x.zip and plugintwo.v2.x.tar.gz packages. </p> <h3 dir="auto"> <a rel="nofollow noopener" target="_blank" id="user-content-activate-plugins" class="anchor" aria-hidden="true" href="#activate-plugins"></a>Activate Plugins </h3> <p> <code>extension:install</code> and <code>extension:installfile</code> automatically activates the plugin. </p> <h2 dir="auto"> <a rel="nofollow noopener" target="_blank" id="user-content-extra-commands" class="anchor" aria-hidden="true" href="#extra-commands"></a>Extra commands </h2> <p> There a few other commands available for you to try out as well : </p> <ul dir="auto"> <li> <code>folioshell versions</code> : list the available WordPress versions. </li> <li> Use <code>folioshell versions --refresh</code> to get the latest tags and branches from the official WordPress repository. </li> <li> To purge the cache of all WordPress packages, add the <code>--clear-cache</code> flag to this command. </li> </ul> <h2 dir="auto"> <a rel="nofollow noopener" target="_blank" id="user-content-requirements" class="anchor" aria-hidden="true" href="#requirements"></a>Requirements </h2> <ul dir="auto"> <li> Composer </li> </ul> <h2 dir="auto"> <a rel="nofollow noopener" target="_blank" id="user-content-contributing" class="anchor" aria-hidden="true" href="#contributing"></a>Contributing </h2> <p> Fork the project, create a feature branch, and send us a pull request. </p> <h2 dir="auto"> <a rel="nofollow noopener" target="_blank" id="user-content-authors" class="anchor" aria-hidden="true" href="#authors"></a>Authors </h2> <p> See the list of contributors. </p> <h2 dir="auto"> <a rel="nofollow noopener" target="_blank" id="user-content-license" class="anchor" aria-hidden="true" href="#license"></a>License </h2> <p> The <code>foliolabs/folioshell</code> repository is licensed under the MPL v2 license – see the LICENSE file for details. </p>
-
Create a symbolic link in a directory that is already in your PATH, e.g.: