<commit_before>**Current Build Status**

[![Build Status](http://ci.rebelinblue.com/build-status/image/3?branch=master)](http://ci.rebelinblue.com/build-status/view/3?branch=master)
[Code Coverage](http://ci.rebelinblue.com/coverage/deployer/index.html)

**Tests**

The code is written to follow PSR-2 standards, this can be tested using PHP_CodeSniffer

    $ phpcs --standard=PSR2 app/*

Code style can be checked with

    $ phpmd app/ text design,unusedcode,naming

PHP Docblocks can be checked with

    $ phpdoccheck --directory="app"
<commit_msg>Writing a brief README file<commit_after># Introduction

Deployer is a application for managing the deployment of PHP applications

**Current Build Status**

[![Build Status](http://ci.rebelinblue.com/build-status/image/3?branch=master)](http://ci.rebelinblue.com/build-status/view/3?branch=master)

##What it does:
* Deploys applications to multiple servers accessible via SSH
* Clones your projects git repository
* Installs composer dependencies
* Runs arbitrary commands
* Gracefully handles failure in any of these steps
* Keeps a number of previous deployments, allowing for easy rollback should something go wrong

##What it doesn't do:
* Provision VMs
* Install system packages
* Configure the web server, database or other services

# Why?

Deployer was heavily inspired by [Envoyer.io](https://envoyer.io), if you want a reliable deployment system I suggest you give Envoyer a try.

Deployer came about as I needed a deployment system for deploying updates for a PHP application to a large number of clients. Although Envoyer was almost perfect it was missing 2 key things I needed

Firstly, I was unable to use a hosted service as it would not be able to connect to the servers I needed to deploy to without a lot of network configuration changes.

Secondly, the code for the application I was deploying was hosted on a Gitlab server, and Envoyer only supports Github & Bitbucket.

For these reasons I decided to make a clone of Envoyer which suited my needs, at the same time using it as an excuse to learn Laravel 5.

# Installation

#### Prerequisites 

* PHP >= 5.4
* PHP Mcrypt extension
* PHP SQLite extension
* PHP OpenSSL extension
* PHP Mbstring extension
* PHP Tokenizer extension
* PHP Json extension (normally built in)
* beanstalkd
* composer
* NPM
* gulp

**Clone the repository**

    $ git clone http://repository.url/repo.git
 
**Setup config**
    
    $ cp .env.example .env
    $ editor .env
    
An example of the config

	APP_ENV=local
	APP_URL=http://deploy.app
	APP_DEBUG=false
	APP_KEY=<KEY>
	QUEUE_DRIVER=beanstalkd


**Install dependencies**

    $ composer install
    $ npm install
    $ bower install
    
**Seed the database**

    $ touch storage/database.sqlite
    $ php artisan migrate:install
    $ php artisan migrate:refresh --seed
    
**Compile the assets**

    $ gulp --production
    $ gulp copy # This is needed to get the fonts needed by bootstrap in the correct place
    
# Development

The code is written to follow PSR-2 standards, this can be tested using PHP_CodeSniffer

    $ phpcs --standard=PSR2 app

Code style can be checked with

    $ phpmd app text design,unusedcode,naming

PHP Docblocks can be checked with

    $ phpdoccheck --directory="app"

{'fraction_non_alphanumeric': 0.0764525993883792, 'fraction_numerical': 0.003669724770642202, 'mean_word_length': 4.0015290519877675, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '587464', 'n_tokens_mistral': 964, 'n_tokens_neox': 920, 'n_words': 392}