├── LICENSE ├── composer.json ├── config └── envoyer.php ├── readme.md └── src ├── Commands └── EnvoyerDeployCommand.php └── ServiceProviders └── EnvoyerServiceProvider.php /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) <2015> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "justpark/envoyer-deploy", 3 | "description": "JustPark Envoyer Deploy Command", 4 | "keywords": ["justpark", "envoyer", "envoyer.io", "deploy", "framework", "laravel"], 5 | "license": "MIT", 6 | "type": "project", 7 | "homepage": "http://www.justpark.com", 8 | "authors": [ 9 | { 10 | "name": "Dayle Rees", 11 | "email": "me@daylerees.com", 12 | "homepage": "http://daylerees.com", 13 | "role": "Developer" 14 | } 15 | ], 16 | "require": { 17 | "laravel/framework": "5.*" 18 | }, 19 | "autoload": { 20 | "psr-4": { 21 | "JustPark\\Deploy\\": "src" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /config/envoyer.php: -------------------------------------------------------------------------------- 1 | 'example-project', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Envoyer.io Projects 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This array contains Envoyer.io projects paired with their webhook 24 | | deployment keys. You'll find these keys on the 'Deployment Hooks' tab 25 | | under your Envoyer.io projects. 26 | | 27 | | It is recommended to specify project names in a "slug" format, since 28 | | they can be used as a parameter to the artisan command. 29 | | 30 | */ 31 | 32 | 'projects' => [ 33 | 34 | 'example-project' => 'webhook_key_here' 35 | 36 | ] 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Just Park 2 | 3 | ![Downloads](https://img.shields.io/packagist/dt/justpark/envoyer-deploy.svg) 4 | ![Release](https://img.shields.io/github/release/justpark/envoyer-deploy.svg) 5 | ![License](https://img.shields.io/github/license/justpark/envoyer-deploy.svg) 6 | 7 | # Envoyer Deploy Command 8 | 9 | Hi there! 10 | 11 | Are you looking for a simple way to deploy your [Envoyer.io](http://envoyer.io) project from the command line? So was I, until I found the Envoyer Deploy Command from [JustPark](http://justpark.com)! 12 | 13 | With this Artisan command, deploying to Envoyer.io is as simple as 1...2... well... more like this: 14 | 15 | ➜ php artisan envoyer:deploy 16 | Deployment request successful! 17 | 18 | You can even deploy different projects (although, there's a default option)! 19 | 20 | ➜ php artisan envoyer:deploy --project awesomecake 21 | Deployment request successful! 22 | 23 | Shortcuts are awesome! 24 | 25 | ➜ php artisan envoyer:deploy -p awesomecake 26 | Deployment request successful! 27 | 28 | ## Installation 29 | 30 | First you'll need to install the [Composer package](https://packagist.org/packages/justpark/envoyer-deploy) from Packagist. 31 | 32 | Simply add the following to the `"require-dev"` section of your `composer.json` file, and `composer update`. 33 | 34 | ```json 35 | "justpark/envoyer-deploy": "~1.0" 36 | ``` 37 | 38 | Next, you'll need to add the `ServiceProvider` for this command to the `providers` array within your `config/app.php` file. 39 | 40 | ```php 41 | 'providers' => [ 42 | 43 | /* 44 | * Loads of other providers here... 45 | */ 46 | 47 | 'JustPark\Deploy\ServiceProviders\EnvoyerServiceProvider', 48 | 49 | ], 50 | ``` 51 | 52 | Finally, you'll want to copy [this config file](config/envoyer.php) into your config directory. The `default` config key contains handle of the project you want to deploy by default, and should match up to a project in the `projects` config key. The name of the project doesn't matter, since it's only used within the command. You'll want to pair it with the webook deployment key that you'll find under the 'Deployment Hooks' tab of your Envoyer.io project. 53 | 54 | ```bash 55 | php artisan vendor:publish 56 | ``` 57 | 58 | It's the bit after the `deploy/` here: 59 | 60 | > https://envoyer.io/deploy/4aLDdfsfsd4s6fSzeKGNfakekey75R45wOwTQULEDJNrj 61 | 62 | Well, now you're good to go! Check the section at the top of this page for usage examples. 63 | 64 | Happy deploying! 65 | 66 | Love, 67 | 68 | JustPark. 69 | 70 | ## Who are you? 71 | 72 | [JustPark](http://justpark.com) is a London based startup solving the problem of parking for people all over the world! We've got affordable parking spaces in major cities, and we even allow property owners to earn some extra cash by renting out their extra space for parking. 73 | 74 | We're huge fans of Laravel within the company, and we've even got Laravel evangelist, contributor and best-selling author [Dayle Rees](https://twitter.com/daylerees) on the team. 75 | 76 | If you're interested in working with us, why not check out our [jobs page](https://www.justpark.com/jobs/). 77 | 78 | ![Panda](http://i.imgur.com/HkoUPMk.jpg) 79 | 80 | ## License 81 | 82 | Envoyer Deploy Command is licensed under [The MIT License (MIT)](LICENSE). 83 | -------------------------------------------------------------------------------- /src/Commands/EnvoyerDeployCommand.php: -------------------------------------------------------------------------------- 1 | config = $config; 58 | 59 | parent::__construct(); 60 | } 61 | 62 | /** 63 | * Execute the console command. 64 | * 65 | * @return mixed 66 | */ 67 | public function fire() 68 | { 69 | // Get the project to deploy. 70 | $project = $this->getProjectToDeploy(); 71 | 72 | // Trigger the deployment. 73 | $this->triggerDeploy($project); 74 | } 75 | 76 | /** 77 | * Retrieve hook from supplied project option or default. 78 | * 79 | * @return string 80 | */ 81 | protected function getProjectToDeploy() 82 | { 83 | // Determine project to deploy. 84 | if (!$project = $this->option('project')) { 85 | $project = $this->getDefaultProjectHook(); 86 | } 87 | 88 | return $project; 89 | } 90 | 91 | /** 92 | * Retrieve the default project hook. 93 | * 94 | * @return string 95 | */ 96 | protected function getDefaultProjectHook() 97 | { 98 | // Get default project handle. 99 | $default = $this->config->get(self::CONFIG_DEFAULT); 100 | 101 | // Return project hook value. 102 | return $this->config->get(sprintf(self::CONFIG_PROJECT, $default)); 103 | } 104 | 105 | /** 106 | * Trigger a deployment by project hook. 107 | * 108 | * @param string $project 109 | * @return void 110 | */ 111 | protected function triggerDeploy($project) 112 | { 113 | // Ensure we have a project hook. 114 | if (!$project) { 115 | throw new InvalidArgumentException('Incorrect project hook.'); 116 | } 117 | 118 | // Trigger the deploy hook. 119 | file_get_contents(sprintf(self::DEPLOY_URL, $project)); 120 | 121 | // Output message. 122 | $this->info('Deployment request successful!'); 123 | } 124 | 125 | /** 126 | * Get the console command options. 127 | * 128 | * @return array 129 | */ 130 | protected function getOptions() 131 | { 132 | return [ 133 | [ 134 | 'project', 135 | 'p', 136 | InputOption::VALUE_OPTIONAL, 137 | 'The project that will be deployed.', 138 | false 139 | ] 140 | ]; 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /src/ServiceProviders/EnvoyerServiceProvider.php: -------------------------------------------------------------------------------- 1 | setupConfig(); 17 | } 18 | 19 | /** 20 | * Setup the config. 21 | * 22 | * @return void 23 | */ 24 | protected function setupConfig() 25 | { 26 | $source = realpath(__DIR__.'/../../config/envoyer.php'); 27 | 28 | $this->publishes([$source => config_path('envoyer.php')]); 29 | 30 | $this->mergeConfigFrom($source, 'envoyer'); 31 | } 32 | 33 | /** 34 | * Register the service provider. 35 | * 36 | * @return void 37 | */ 38 | public function register() 39 | { 40 | // Register deploy command. 41 | $this->commands(['JustPark\Deploy\Commands\EnvoyerDeployCommand']); 42 | } 43 | } 44 | --------------------------------------------------------------------------------