Skip to content

Commit

Permalink
Initial CLI checkin
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Koenig <[email protected]>
  • Loading branch information
Josh Koenig committed Feb 25, 2014
0 parents commit ab4c3a8
Show file tree
Hide file tree
Showing 82 changed files with 7,879 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
composer.lock
/vendor
/*.phar
/phpunit.xml

/builds
53 changes: 53 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
language: php

php:
- 5.3
- 5.5

env:
global:
- TERMINUS_BIN_DIR=/tmp/terminus-phar
# Encripted deploy key. See https://gist.github.com/scribu/6241271
- secure: "U8gOPW2m9fkJW8omnPjFHFZutGIqAAfVs0H1izpSKJhclUfYAGjAGl1Cb6ZiUp3jZE11iWa+fAZ5mmmLAQ5L9ijta40igfFw0s+o/Vt3WBM4a3Vdqpg6civ0rDi9tJYuwtMaEi/kF/yuhKzUT80EAMqVix5xPnf963iIUPyarfY="
- secure: "W9t7pG5h/Khoi+TrxplpSeTWxaTr7r6cYRVJBsXgghZLDXsU/qn/OhGDdY+IMfSgzO49wjFyLh2EOs8zZSujY75fgFffK2+jd/882NUlpvpXoW9C3yEfZhLJVQZI/1idnpDe9f6zA0XlpBn3bQ2QeS3i2a/JwOGCD8BQjNobk1M="
- secure: "YsVv3AKeHyr6nwkjhB+VingCdWIzfNP2VYMMHf841rnH6HsAXNw8PJcinnVYeMd15kgjA3Yk8PbITOmzZkf9yjAmbgJTvNempEElF/KG42FkoCACtZ2Wc/jIL9zEi5o47qUicwiS6LLWYx1uQa6vActpE4KdrcDLJ6pQHp/s7ss="
- secure: "Qsx9+R7VBSdk3st1yVyRMYgAHV58lUUSqXJjvxAkUFXsumCEVFiNpuKepvA5+EZHHnpo7zQOK6EzrIDgUBHGfwEvVumI5eur8G1RKdHnvotuz4D7YCdoRnnrzbhJkAPnVcGrIBIHd5GlDHPTVBij77JwMq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="
- secure: "OqbgLy6Rn+NvhjpYygNZDWf6rj8sVejRZJBmssNi5fHRXopEtfIHids2FjSXZUVPs3ShqNuczo1jzgt7N3JHbcSaiedHlc7ONqDK0SyyOcsv1oKOR81bvYcL/KIoGiMRvkQI5IW01YWfSZlS0wgL2NYdJvYanCnSUUv6nNZAF7E="
matrix:
- WP_VERSION=latest
- WP_VERSION=3.5.2 DEPLOY_BRANCH=master

matrix:
exclude:
- php: 5.5
env: WP_VERSION=3.5.2 DEPLOY_BRANCH=master

before_script:
- ./scripts/prepare.sh
- ./scripts/build.sh

script: ./scripts/test.sh

after_success: ./scripts/package.sh

notifications:
email:
on_success: never
70 changes: 70 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Contribute
==========

Setting up
----------

1. Clone this git repository on your local machine.
2. Install [Composer](https://getcomposer.org/) if you don't already have it.
2. Run `composer install` to fetch all the dependencies.
3. Run `./bin/wp --info` to test if everything was installed properly.
4. Download PHPUnit: `curl -L https://phar.phpunit.de/phpunit.phar > phpunit.phar`
5. Download Behat: `curl -L http://behat.org/downloads/behat.phar > behat.phar`

Submitting patches
------------------

Whether you want to fix a bug or implement a new feature, the process is pretty much the same:

0. [Search existing issues](https://github.com/terminus/terminus/issues); if you can't find anything related to what you want to work on, open a new issue so that you can get some initial feedback.
1. [Fork](https://github.com/terminus/terminus/fork) the repository.
2. Push the code changes from your local clone to your fork.
3. Open a pull request.

It doesn't matter if the code isn't perfect. The idea is to get it reviewed early and iterate on it.

If you're adding a new feature, please add one or more functional tests for it in the `features/` directory. See below.

Lastly, please follow the [WordPress Coding Standards](http://make.wordpress.org/core/handbook/coding-standards/).

Running and writing tests
-------------------------

There are two types of automated tests:

* unit tests, implemented using [PHPUnit](http://phpunit.de/)
* functional tests, implemented using [Behat](http://behat.org)

### Unit tests

The unit test files are in the `tests/` directory.

To run the unit tests, just execute:

php phpunit.phar

### Functional tests

The functional test files are in the `features/` directory.

Before running the functional tests, you'll need a MySQL user called `wp_cli_test` with the
password `password1` that has full privileges on the MySQL database `wp_cli_test`.
Running the following as root in MySQL should do the trick:

GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"localhost" IDENTIFIED BY "password1";

Then, to run the entire test suite:

php behat.phar --expand

Or to test a single feature:

php behat.phar features/core.feature

More info can be found from `php behat.phar --help`.

Finally...
----------

Thanks! Hacking on WP-CLI should be fun. If you find any of this hard to figure
out, let us know so we can improve our process or documentation!
24 changes: 24 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
=========================================================================================================
All code in this repository, unless otherwise specified, is hereby licensed under the MIT Public License:
=========================================================================================================

Copyright (C) 2014 Pantheon Systems (https://getpantheon.com)
Copyright (C) 2011-2013 WP-CLI Development Group (https://github.com/wp-cli/wp-cli/graphs/contributors)

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.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Pantheon CLI
============

The Pantheon Command Line Interface is a successor to the "Terminus" project, which provides access to the Pantheon Platform via Drush. While Terminus has provided great value (and we're going to keep the name in the product), we felt that it was important to have a first-class standalone CLI toolkit:

- That we could distribute as an independent executable.
- Which could "wrap" other commands that run on the platform.

If you would like to contribute, pull requests are welcome!

Installation
------------

Currently the quickest way to install the project is to grab the .phar file from github. We are currently in pre-release, and so instructions will change, but for now something like this should work:

```
curl https://github.com/pantheon-systems/cli/releases/download/0.0.1-alpha/terminus.phar -L -o /usr/local/bin/terminus
chmod +x /usr/local/bin/terminus
```

Stay tuned for updated installation instructions as the project matures.

Usage
-----

Currently the command-set exposed by the Pantheon CLI is limited:

- Authentication to the platform.
- List your sites.
- Perform remote actions on sites using the ```drush``` or ```wp-cli``` utilities.

**Example**

```
terminus auth login
Your email address?: [email protected]
Your dashboard password (input will not be shown):
Logging in as [email protected]
Success!
terminus sites show
+--------------------+-----------+---------------+--------------------------------------+
| Site | Framework | Service Level | UUID |
+--------------------+-----------+---------------+--------------------------------------+
| outlandish-josh | | personal | 3ecd4d40-bdf2-4e52-a519-7e697ecdfe20 |
| multidev-sneakpeak | | business | 0706939a-fd1f-42fb-bd46-a5ce89ac5789 |
| sftp-mode-ftw | | free | 100486f7-3488-eb11-10c4-9fbfab1996af |
| new-wp-spinup | wordpress | free | c33df3d3-deae-48ac-b4e1-97e36ea1ba34 |
+--------------------+-----------+---------------+--------------------------------------+
terminus wp --site=c33df3d3-deae-48ac-b4e1-97e36ea1ba34
Credits
-------
We have leaned heavily on the work of [wp-cli](http://wp-cli.org/) in architecting this command line utility with an object-oriented structure. We've also (obviously) been greatly inspired by[Drush](http://drush.ws/).
46 changes: 46 additions & 0 deletions bin/terminus
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env sh
#
# This wrapper script has been adapted from the equivalent drush wrapper
# and 99.9% of all credit should go to the authors of that project:
# http://drupal.org/project/drush
# And 0.09% to the author of this project:
# https://github.com/88mph/wpadmin/blob/master/wpadmin.php

# Get the absolute path of this executable
ORIGDIR="$(pwd)"
SELF_PATH="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" && SELF_PATH="$SELF_PATH/$(basename -- "$0")"

# Resolve symlinks - this is the equivalent of "readlink -f", but also works with non-standard OS X readlink.
while [ -h "$SELF_PATH" ]; do
# 1) cd to directory of the symlink
# 2) cd to the directory of where the symlink points
# 3) Get the pwd
# 4) Append the basename
DIR="$(dirname -- "$SELF_PATH")"
SYM="$(readlink "$SELF_PATH")"
SELF_PATH="$(cd "$DIR" && cd "$(dirname -- "$SYM")" && pwd)/$(basename -- "$SYM")"
done
cd "$ORIGDIR"

# Build the path to the root PHP file
SCRIPT_PATH="$(dirname "$SELF_PATH")/../php/boot-fs.php"

case $(uname -a) in
CYGWIN*)
SCRIPT_PATH="$(cygpath -w -a -- "$SCRIPT_PATH")" ;;
esac

if [ ! -z "$TERMINUS_PHP" ] ; then
# Use the TERMINUS_PHP environment variable if it is available.
php="$TERMINUS_PHP"
else
# Default to using the php that we find on the PATH.
# Note that we need the full path to php here for Dreamhost, which behaves oddly. See http://drupal.org/node/662926
php="`which php`"
fi

# Pass in the path to php so that terminus knows which one
# to use if it re-launches itself to run other commands.
export TERMINUS_PHP_USED="$php"

exec "$php" $TERMINUS_PHP_ARGS "$SCRIPT_PATH" "$@"
2 changes: 2 additions & 0 deletions bin/terminus.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@ECHO OFF
php "%~dp0../php/boot-fs.php" %*
27 changes: 27 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "terminus/terminus",
"description": "A command line interface for WordPress",
"keywords": [ "cli", "wordpress" ],
"homepage": "http://terminus.org",
"license": "MIT",
"bin": [
"bin/wp.bat", "bin/wp"
],
"require": {
"php": ">=5.3.2",
"jlogsdon/cli": "~0.9.4",
"mustache/mustache": "~2.4",
"rhumsaa/array_column": "~1.1",
"rmccue/requests": "~1.6",
"symfony/finder": "~2.3",
"nb/oxymel": "0.1.0"
},
"suggest": {
"psy/psysh": "Enhanced `wp shell` functionality"
},
"autoload": {
"psr-0": { "Terminus": "php" },
"files": [ "php/Spyc.php" ],
"classmap": [ "php/export" ]
}
}
Loading

0 comments on commit ab4c3a8

Please sign in to comment.