From 4c7a721096d257f7e5d785da6aea70e135bc9976 Mon Sep 17 00:00:00 2001 From: Luis Montealegre Date: Fri, 27 Apr 2018 11:50:01 -0500 Subject: [PATCH] docs: Add contributing and code of conduct files --- CODE-OF-CONDUCT.md | 73 +++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 100 +++++++++++++++++++++++++++++++++++++++++++++ Makefile | 10 +++++ README.md | 25 ++++++++---- index.md | 9 ++-- 5 files changed, 204 insertions(+), 13 deletions(-) create mode 100644 CODE-OF-CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 Makefile diff --git a/CODE-OF-CONDUCT.md b/CODE-OF-CONDUCT.md new file mode 100644 index 0000000..720b8ce --- /dev/null +++ b/CODE-OF-CONDUCT.md @@ -0,0 +1,73 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at montealegreluis@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9a7637f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,100 @@ +# Contributing to DBAL fixtures + +## Code of Conduct + +This project is released with a [Contributor Code of Conduct][conduct]. +By participating in this project you agree to abide by its terms. + +## Workflow + +* Fork the project. +* Make your bug fix or feature addition. +* Add tests for it. This is important so we don't break it in a future version unintentionally. +* Send a pull request. Bonus points for topic branches. + +Pull requests for bug fixes must be based on the current stable branch whereas pull requests for new features must be based on the `master` branch. + +## Coding Guidelines + +This project follows the coding standards proposed in [PSR-2][psr2] + +You can use [PHP CS fixer][fixer] to (re)format your sourcecode for compliance with this project's coding guidelines: + +Run the following command to install the fixer. + +```bash +$ composer global require friendsofphp/php-cs-fixer +``` + +Run the following command if you modified either production or test code. +It will fix any coding standard issue automatically. + +```bash +$ make fix +``` + +[Make][make] will run the fixer in both folders `src` and `tests`. + +## Using phUML from a Git checkout + +The following commands can be used to perform the initial checkout of DBAL fixtures: + +```bash +$ git clone git@github.com:ComPHPPuebla/dbal-fixtures.git + +$ cd dbal-fixtures +``` + +Retrieve DBAL fixture's dependencies using [Composer][composer]: + +```bash +$ composer install +``` + +## Running DBAL fixture's test suite + +Currently the test suite runs against [SQLite][sqlite] and [MySQL][mysql] only. +Please make sure you have both of them installed. + +There's a `phpunit.xml.dist` file customized for [Travis][travis]. +You'll want to create a `phpunit.xml` file with your local MySQL username and password. + +There is no special configuration for SQLite, it should run out of the box. + +Use this command to run the test suite + +``` +$ make test +``` + +## Contributing to the documentation + +The documentation of this package is generated by [Couscous][couscous]. +You can install Couscous globally with the following commands. + +``` +$ curl -OS http://couscous.io/couscous.phar +$ chmod +x couscous.phar +$ sudo mv couscous.phar /usr/local/bin/couscous +``` + +Run the following command to preview your changes: + +``` +$ couscous preview +``` + +## Reporting issues + +Before opening a new ticket, please search through the [existing issues][issues]. + +[psr2]: http://www.php-fig.org/psr/psr-2/ +[fixer]: https://github.com/FriendsOfPHP/PHP-CS-Fixer +[issues]: https://github.com/ComPHPPuebla/dbal-fixtures/issues +[travis]: https://travis-ci.org/ +[make]: https://en.wikipedia.org/wiki/Make_(software) +[couscous]: http://couscous.io/ +[conduct]: https://github.com/ComPHPPuebla/dbal-fixtures/blob/master/CODE-OF-CONDUCT.md +[composer]: https://getcomposer.org/ +[sqlite]: https://www.sqlite.org/download.html +[mysql]: https://dev.mysql.com/doc/refman/5.6/en/installing.html diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e022fba --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +SHELL = /bin/bash + +.PHONY: test fix + +test: + @php bin/phpunit + +fix: + @php-cs-fixer fix src --rules=@PSR2,no_unused_imports + @php-cs-fixer fix tests --rules=no_unused_imports diff --git a/README.md b/README.md index 961d8ee..39d741a 100644 --- a/README.md +++ b/README.md @@ -19,16 +19,25 @@ $ composer require comphppuebla/dbal-fixtures ## Documentation -The documentation is available at -[https://comphppuebla.github.io/dbal-fixtures/][docs] +The following `yml` file will insert 3 rows into the table `stations` +using random values generated by [Faker][faker] for all the columns + +```yml +stations: + station_[1..3]: + name: "${company}" + address_line_1: "${streetAddress}" + location: "${city}" + coordinates: "`PointFromText('POINT(${latitude} ${longitude})')`" + created_at: "${date('Y-m-d H:i:s', 'yesterday')}" + last_updated_at: "${date('Y-m-d H:i:s')}" +``` -## Tests +Please visit the [documentation page][docs] for more details. -Run the test suite using PHPUnit: +## Contribute -```bash -$ bin/phpunit --testdox -``` +Please refer to [CONTRIBUTING](CONTRIBUTING) for information on how to contribute to this package. ## License @@ -44,3 +53,5 @@ Released under the [MIT License](LICENSE). [license]: LICENSE [sensiolabs-badge]: https://insight.sensiolabs.com/projects/d876000d-611d-473f-b58c-64582903f7a9/mini.png [sensiolabs]: https://insight.sensiolabs.com/projects/d876000d-611d-473f-b58c-64582903f7a9 +[faker]: https://github.com/fzaninotto/Faker +[docs]: https://comphppuebla.github.io/dbal-fixtures/ diff --git a/index.md b/index.md index ba282ff..e9800a1 100644 --- a/index.md +++ b/index.md @@ -16,13 +16,9 @@ Install this package using composer $ composer require comphppuebla/dbal-fixtures ``` -## Tests +## Contribute -Run the test suite using PHPUnit: - -```bash -$ bin/phpunit --testdox -``` +Please refer to [CONTRIBUTING][contribute] for information on how to contribute to this package. ## License @@ -37,3 +33,4 @@ Released under the [MIT License][license]. [license]: https://github.com/ComPHPPuebla/dbal-fixtures/blob/master/LICENSE [sensiolabs-badge]: https://insight.sensiolabs.com/projects/d876000d-611d-473f-b58c-64582903f7a9/mini.png [sensiolabs]: https://insight.sensiolabs.com/projects/d876000d-611d-473f-b58c-64582903f7a9 +[contribute]: https://github.com/ComPHPPuebla/dbal-fixtures/blob/master/CONTRIBUTING.md