-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8b952e8
Showing
9 changed files
with
241 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
; This file is for unifying the coding style for different editors and IDEs. | ||
; More information at http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_size = 4 | ||
indent_style = space | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Path-based git attributes | ||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html | ||
|
||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.github export-ignore | ||
/.gitignore export-ignore | ||
/art export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/tests export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: "run-tests" | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: true | ||
matrix: | ||
php: [7.2, 7.3, 7.4] | ||
laravel: [5.7.*, 6.*, 7.*] | ||
include: | ||
- laravel: 7.* | ||
testbench: 5.* | ||
- laravel: 6.* | ||
testbench: 4.* | ||
- laravel: 5.7.* | ||
testbench: 3.7.* | ||
|
||
name: PHP ${{ matrix.php }} / L ${{ matrix.laravel }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.composer/cache/files | ||
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: xdebug | ||
|
||
- name: Install dependencies | ||
run: | | ||
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update | ||
composer update --prefer-dist --no-interaction --no-suggest | ||
- name: Execute tests | ||
run: vendor/bin/phpunit --coverage-clover clover.xml | ||
|
||
- name: Store coverage report | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage-report | ||
path: clover.xml | ||
|
||
coverage: | ||
runs-on: ubuntu-latest | ||
|
||
needs: [test] | ||
|
||
name: Code coverage | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
coverage: none | ||
|
||
- name: Download coverage report | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: coverage-report | ||
|
||
- name: Submit code coverage report | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
composer global require cedx/coveralls | ||
coveralls clover.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DS_Store | ||
.idea | ||
.vscode | ||
/vendor | ||
composer.lock | ||
composer.phar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2020, Wouter Peschier | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Fancy Console for Laravel | ||
|
||
[![Author](http://img.shields.io/badge/[email protected]?style=flat-square)](https://twitter.com/kielabokkie) | ||
[![Packagist Version](https://img.shields.io/packagist/v/kielabokkie/laravel-fancy-console.svg?style=flat-square)](https://packagist.org/packages/kielabokkie/laravel-fancy-console) | ||
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) | ||
|
||
Fancy Console for Laravel provides a `FancyConsole` trait that gives you a few extra fancy styled console outputs to compliment the already useful default Laravel ones. | ||
|
||
## Requirements | ||
|
||
* PHP >= 7.2 | ||
* Laravel 5.8 and up | ||
|
||
## Installation | ||
|
||
Install the package via composer: | ||
|
||
```bash | ||
composer require kielabokkie/laravel-fancy-console | ||
``` | ||
|
||
## Usage | ||
|
||
Firstly you'll have to add the `FancyConsole` trait to your command: | ||
|
||
```php | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Kielabokkie\FancyConsole\Traits\FancyConsole; | ||
|
||
class MyCommand extends Command | ||
{ | ||
use FancyConsole; | ||
} | ||
``` | ||
|
||
You then have access to the following extra methods: | ||
|
||
```php | ||
$this->success('Yes, it worked!'); | ||
|
||
$this->fail('Oh no, it did not work.'); | ||
|
||
$this->successBlock('This is a great success'); | ||
|
||
$this->errorBlock('This is a serious error'); | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "kielabokkie/laravel-fancy-console", | ||
"description": "A trait to give your console commands some extra fancy output", | ||
"type": "library", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "kielabokkie", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.1" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Kielabokkie\\FancyConsole\\": "src" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Kielabokkie\FancyConsole\Traits; | ||
|
||
trait FancyConsole | ||
{ | ||
/** | ||
* Success line that gets prepended with a colourful SUCCESS. | ||
* | ||
* @param string $string | ||
* @return string | ||
*/ | ||
public function success($string) | ||
{ | ||
return $this->info('<fg=black;bg=green> SUCCESS </> ' . $string); | ||
} | ||
|
||
/** | ||
* Fail line that gets prepended with a colourful FAIL. | ||
* | ||
* @param string $string | ||
* @return string | ||
*/ | ||
public function fail($string) | ||
{ | ||
return $this->info('<fg=white;bg=red> FAIL </> ' . $string); | ||
} | ||
|
||
/** | ||
* A green success block that's nicely padded. | ||
* | ||
* @param string $string | ||
* @return string | ||
*/ | ||
public function successBlock($string) | ||
{ | ||
return $this->output->success($string); | ||
} | ||
|
||
/** | ||
* A red error block that's nicely padded. | ||
* | ||
* @param string $string | ||
* @return string | ||
*/ | ||
public function errorBlock($string) | ||
{ | ||
return $this->output->error($string); | ||
} | ||
} |