Skip to content

Commit 00bd01e

Browse files
committed
Update from package template, refactor and remove unnecessary code, and add tests.
1 parent 0de01ea commit 00bd01e

19 files changed

+267
-128
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at https://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.yml]
18+
indent_size = 2

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.travis.yml export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/.scrutinizer.yml export-ignore
10+
/tests export-ignore
11+
/.editorconfig export-ignore

.gitignore

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
composer.phar
2-
/vendor
2+
composer.lock
3+
auth.json
4+
vendor
35

4-
/node_modules
56
package-lock.json
7+
node_modules
68

79
phpunit.xml
810
.phpunit.*
9-
phpdox.xml
11+
build
1012

11-
/.idea
13+
.idea
1214

1315
.DS_Store
1416
Thumbs.db
1517

16-
composer.lock
17-
auth.json
18+
mix-manifest.json

.styleci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
preset: laravel
2+
3+
disabled:
4+
- self_accessor

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: php
2+
3+
php:
4+
- 7.3
5+
6+
env:
7+
matrix:
8+
- COMPOSER_FLAGS="--prefer-lowest"
9+
- COMPOSER_FLAGS=""
10+
11+
before_script:
12+
- travis_retry composer self-update
13+
- composer config http-basic.nova.laravel.com ${NOVA_USERNAME} ${NOVA_PASSWORD}
14+
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source
15+
16+
script:
17+
- vendor/bin/phpunit

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Changelog
2+
3+
All notable changes to `nova-enum-field` will be documented in this file.
4+
5+
## 1.0.0 - 2019-09-07
6+
7+
- Initial release.
8+
9+
## 1.0.1 - 2019-09-07
10+
11+
- Push to packagist.
12+
13+
## 1.0.2 - 2019-09-07
14+
15+
- Fix version number.
16+
17+
## 1.0.3 - 2019-09-27
18+
19+
- Cleanup codebase.
20+
- Fix casting.
21+
22+
## 1.0.4 - 2019-09-27
23+
24+
- Add documentation.
25+
- Refactor field code.
26+
27+
## 1.1.0 - 2019-09-30
28+
29+
- Update from package template.
30+
- Refactor and remove unnecessary code.
31+
- Add tests.

CONTRIBUTING.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
# Contributing
22

3-
Contributions via Pull Requests are welcome and will be fully credited.
3+
Contributions are welcome and will be fully credited.
44

5-
## Pull Requests
5+
Please read and understand the contribution guide before creating an issue or pull request.
66

7-
1. Fork the project.
7+
## Procedure
88

9-
1. `git clone` it and `composer install` the dependencies.
9+
Before creating an issue:
1010

11-
1. Create a feature branch.
11+
- Attempt to replicate the problem to ensure that it wasn't something coincidental.
12+
- Check to make sure your feature suggestion isn't already present within the project.
13+
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
14+
- Check the pull requests tab to ensure that the feature isn't already in progress.
1215

13-
1. Make the changes you are proposing.
16+
Before submitting a pull request:
1417

15-
1. Make sure the `README.md` and any other relevant documentation is kept up to date.
18+
- Check the codebase to ensure that your feature doesn't already exist.
19+
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
1620

17-
1. Make sure each individual commit in your pull request is meaningful. If you made multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
18-
19-
1. Push to your fork.
21+
## Requirements
2022

21-
1. Open a pull request detailing your changes. **NB: One pull request per feature.**
23+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)**: The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
2224

23-
## Testing
25+
- **Tests, tests, tests!**: Your pull request won't be accepted if it doesn't have tests.
2426

25-
``` bash
26-
$ phpunit
27-
```
27+
- **Document behaviour changes**: Make sure the `README.md` and any other relevant documentation are kept up-to-date.
28+
29+
- **One pull request per feature**: If you want to do more than one thing, send multiple pull requests.
30+
31+
- **Coherent history**: Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
MIT License
1+
The MIT License (MIT)
22

3-
Copyright (c) 2019 Simple Squid (Pty) Ltd
3+
Copyright (c) Simple Squid (Pty) Ltd <info@simplesquid.co.za>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
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 THE
21-
SOFTWARE.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# An enum field for Laravel Nova applications
2-
[![Latest Version](https://img.shields.io/github/release/simplesquid/nova-enum-field.svg?style=flat-square)](https://github.com/simplesquid/nova-enum-field/releases)
3-
[![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
4-
[![Total Downloads](https://img.shields.io/packagist/dt/simplesquid/nova-enum-field.svg?style=flat-square)](https://packagist.org/packages/simplesquid/nova-vend)
52

6-
A Laravel Nova field to add enums to resources. This field uses the [BenSampo/laravel-enum](https://github.com/BenSampo/laravel-enum) package, so make sure to check out the installation instructions there first.
3+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/simplesquid/nova-enum-field.svg?style=flat-square)](https://packagist.org/packages/simplesquid/nova-enum-field)
4+
[![Build Status](https://img.shields.io/travis/simplesquid/nova-enum-field/master.svg?style=flat-square)](https://travis-ci.org/simplesquid/nova-enum-field)
5+
[![MIT License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
6+
[![Total Downloads](https://img.shields.io/packagist/dt/simplesquid/nova-enum-field.svg?style=flat-square)](https://packagist.org/packages/simplesquid/nova-enum-field)
77

8-
![Screenshot of the enum field](https://github.com/simplesquid/nova-enum-field/raw/master/img/screenshot.png)
8+
Laravel Nova field to add enums to resources. This field uses the [BenSampo/laravel-enum](https://github.com/BenSampo/laravel-enum) package, so make sure to check out the installation instructions there first.
99

10-
Contributions, issues and suggestions are very much welcome.
10+
![Screenshot of the enum field](https://github.com/simplesquid/nova-enum-field/raw/master/docs/screenshot.png)
1111

1212
## Installation
1313

14-
You can install this package in a Laravel app that uses [Nova](https://nova.laravel.com) via composer:
14+
You can install this package in a Laravel app that uses [Nova](https://nova.laravel.com) via composer:
1515

1616
```bash
1717
composer require simplesquid/nova-enum-field
@@ -44,14 +44,35 @@ class User extends Resource
4444
}
4545
```
4646

47+
### Testing
48+
49+
``` bash
50+
composer test
51+
```
52+
53+
### Changelog
54+
55+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
56+
4757
## Contributing
4858

49-
Please see [CONTRIBUTING](CONTRIBUTING.md).
59+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
60+
61+
### Security
62+
63+
If you discover any security related issues, please email security@simplesquid.co.za instead of using the issue tracker.
5064

5165
## Credits
5266

5367
- [Matthew Poulter](https://github.com/mdpoulter)
68+
- [All Contributors](../../contributors)
69+
70+
Package skeleton based on [spatie/skeleton-php](https://github.com/spatie/skeleton-php).
71+
72+
## About us
73+
74+
SimpleSquid is a small web development and design company based in Cape Town, South Africa.
5475

5576
## License
5677

57-
The MIT License (MIT). Please see [License File](LICENSE) for more information.
78+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

composer.json

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,55 @@
11
{
22
"name": "simplesquid/nova-enum-field",
3-
"license": "MIT",
4-
"description": "A Laravel Nova field for Enums extending on bensampo/laravel-enum.",
3+
"description": "A Laravel Nova field to add enums to resources.",
54
"keywords": [
5+
"simplesquid",
66
"laravel",
77
"nova",
88
"field",
9-
"enum"
9+
"enum",
10+
"nova-enum-field"
1011
],
12+
"homepage": "https://github.com/simplesquid/nova-enum-field",
13+
"license": "MIT",
1114
"authors": [
1215
{
1316
"name": "Matthew Poulter",
1417
"email": "matthew.poulter@simplesquid.co.za",
18+
"homepage": "https://simplesquid.co.za/",
1519
"role": "Developer"
1620
}
1721
],
22+
"repositories": [
23+
{
24+
"type": "composer",
25+
"url": "https://nova.laravel.com"
26+
}
27+
],
1828
"require": {
1929
"php": "^7.3",
2030
"laravel/nova": "^2.0",
2131
"illuminate/support": "^5.8|^6.0",
2232
"bensampo/laravel-enum": "^1.26"
2333
},
2434
"require-dev": {
25-
"orchestra/testbench": "^3.8|^4.0"
35+
"symfony/var-dumper": "^4.3",
36+
"orchestra/testbench": "^3.8|^4.0",
37+
"phpunit/phpunit": "^8.2"
2638
},
27-
"repositories": [
28-
{
29-
"type": "composer",
30-
"url": "https://nova.laravel.com"
31-
}
32-
],
3339
"autoload": {
3440
"psr-4": {
35-
"SimpleSquid\\Nova\\Fields\\Enum\\": "src/"
41+
"SimpleSquid\\Nova\\Fields\\Enum\\": "src"
3642
}
3743
},
38-
"extra": {
39-
"laravel": {
40-
"providers": [
41-
"SimpleSquid\\Nova\\Fields\\Enum\\FieldServiceProvider"
42-
]
44+
"autoload-dev": {
45+
"psr-4": {
46+
"SimpleSquid\\Nova\\Fields\\Enum\\Tests\\": "tests"
4347
}
4448
},
49+
"scripts": {
50+
"test": "vendor/bin/phpunit"
51+
},
4552
"config": {
4653
"sort-packages": true
47-
},
48-
"minimum-stability": "dev",
49-
"prefer-stable": true
54+
}
5055
}

0 commit comments

Comments
 (0)