Skip to content

Commit 27ef64e

Browse files
committed
Add documentation, configure dev tools
1 parent 6445ef3 commit 27ef64e

File tree

13 files changed

+345
-3
lines changed

13 files changed

+345
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/composer.lock
22
/vendor
3+
/build
4+
/tests/infection-log.txt
35
.phpunit.result.cache
46
.idea

.phan/config.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/**
4+
* This configuration will be read and overlaid on top of the
5+
* default configuration. Command line arguments will be applied
6+
* after this file is read.
7+
*/
8+
return [
9+
10+
// A list of directories that should be parsed for class and
11+
// method information. After excluding the directories
12+
// defined in exclude_analysis_directory_list, the remaining
13+
// files will be statically analyzed for errors.
14+
//
15+
// Thus, both first-party and third-party code being used by
16+
// your application should be included in this list.
17+
'directory_list' => [
18+
'src',
19+
'vendor',
20+
],
21+
22+
// A directory list that defines files that will be excluded
23+
// from static analysis, but whose class and method
24+
// information should be included.
25+
//
26+
// Generally, you'll want to include the directories for
27+
// third-party code (such as "vendor/") in this list.
28+
//
29+
// n.b.: If you'd like to parse but not analyze 3rd
30+
// party code, directories containing that code
31+
// should be added to both the `directory_list`
32+
// and `exclude_analysis_directory_list` arrays.
33+
"exclude_analysis_directory_list" => [
34+
'vendor/'
35+
],
36+
];

.scrutinizer.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
filter:
2+
excluded_paths: [tests/*]
3+
4+
checks:
5+
php:
6+
remove_extra_empty_lines: true
7+
remove_php_closing_tag: true
8+
remove_trailing_whitespace: true
9+
fix_use_statements:
10+
remove_unused: true
11+
preserve_multiple: false
12+
preserve_blanklines: true
13+
order_alphabetically: true
14+
fix_php_opening_tag: true
15+
fix_linefeed: true
16+
fix_line_ending: true
17+
fix_identation_4spaces: true
18+
fix_doc_comments: true
19+
excluded_dependencies:
20+
- phan/phan
21+
22+
tools:
23+
external_code_coverage:
24+
timeout: 600
25+
runs: 3

.travis.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
dist: trusty
2+
language: php
3+
4+
php:
5+
- 7.1
6+
- 7.2
7+
- 7.3
8+
9+
# This triggers builds to run on the new TravisCI infrastructure.
10+
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
11+
sudo: false
12+
13+
## Cache composer
14+
cache:
15+
directories:
16+
- $HOME/.composer/cache
17+
18+
matrix:
19+
include:
20+
- php: 7.1
21+
env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"'
22+
allow_failures:
23+
- env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"'
24+
25+
before_script:
26+
- pecl install ast
27+
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist
28+
29+
script:
30+
- vendor/bin/phpcs --standard=psr2 src/
31+
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
32+
33+
after_script:
34+
- |
35+
wget https://scrutinizer-ci.com/ocular.phar
36+
php ocular.phar code-coverage:upload --format=php-clover coverage.clover

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
### Initial version
9+
- collect task durations in CSV file

CONTRIBUTING.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Contributing to Deployer Timer
2+
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
3+
4+
- Reporting a bug
5+
- Discussing the current state of the code
6+
- Submitting a fix
7+
- Proposing new features
8+
- Becoming a maintainer
9+
10+
## We Develop with Github
11+
We use github to host code, to track issues and feature requests, as well as accept pull requests.
12+
13+
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
14+
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
15+
16+
1. Fork the repo and create your branch from `master`.
17+
2. If you've added code that should be tested, add tests.
18+
3. If you've changed APIs, update the documentation.
19+
4. Ensure the test suite passes.
20+
5. Make sure your code lints.
21+
6. Issue that pull request!
22+
23+
## Any contributions you make will be under the MIT Software License
24+
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
25+
26+
## Report bugs using Github's [issues](https://github.com/integer-net/deployer-timer/issues)
27+
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](); it's that easy!
28+
29+
## Write bug reports with detail, background, and sample code
30+
[This is an example](http://stackoverflow.com/q/12488905/180626) of a bug report I wrote, and I think it's not a bad model. Here's [another example from Craig Hockenberry](http://www.openradar.me/11905408), an app developer whom I greatly respect.
31+
32+
**Great Bug Reports** tend to have:
33+
34+
- A quick summary and/or background
35+
- Steps to reproduce
36+
- Be specific!
37+
- Give sample code if you can. [My stackoverflow question](http://stackoverflow.com/q/12488905/180626) includes sample code that *anyone* with a base R setup can run to reproduce what I was seeing
38+
- What you expected would happen
39+
- What actually happens
40+
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
41+
42+
People *love* thorough bug reports. I'm not even kidding.
43+
44+
## Pull Requests
45+
46+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - Check the code style with ``$ composer check-style`` and fix it with ``$ composer fix-style``.
47+
48+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
49+
50+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
51+
52+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
53+
54+
- **Create feature branches** - Don't ask us to pull from your master branch.
55+
56+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
57+
58+
- **Send 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](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
59+
60+
## License
61+
By contributing, you agree that your contributions will be licensed under its MIT License.
62+
63+
## References
64+
This document was adapted from the open-source contribution guidelines for [Facebook's Draft](https://github.com/facebook/draft-js/blob/a9316a723f9e918afde44dea68b5f9f39b7d9b00/CONTRIBUTING.md) with additions from [ThePhpLeague Template](https://github.com/thephpleague/skeleton)

LICENSE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2019 integer_net GmbH
2+
3+
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:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
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.

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Integer_Net Deployer Timer
2+
3+
[![Latest Version on Packagist][ico-version]][link-packagist]
4+
[![Software License][ico-license]](LICENSE.md)
5+
[![Build Status][ico-travis]][link-travis]
6+
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
7+
[![Quality Score][ico-code-quality]][link-code-quality]
8+
[![Total Downloads][ico-downloads]][link-downloads]
9+
10+
11+
This is a recipe for [Deployer](https://deployer.org/) that lets you track the duration of all tasks
12+
13+
It can create a CSV file in the form of
14+
```
15+
BEGIN,deploy,1553682974.4,0
16+
BEGIN,build,1553682974.4,0
17+
END,build,1553682975,0.6
18+
BEGIN,copy,1553682975,0
19+
END,copy,1553682978.5,3.5
20+
BEGIN,release,1553682978.5,0
21+
END,release,1553682979.3,0.8
22+
END,deploy,1553682979.3,4.9
23+
```
24+
25+
## Installation
26+
27+
1. Require via composer
28+
```
29+
composer require integer-net/deployer-timer
30+
```
31+
32+
## Usage
33+
34+
In your `deploy.php` file:
35+
36+
1. Include the recipe:
37+
```
38+
require __DIR__ . '/vendor/integer-net/deployer-timer/recipe/timer.php';
39+
```
40+
2. Configure the timer **at the end**:
41+
```
42+
after('deploy', timer()->createCsvResultTask('path/to/file.csv'));
43+
44+
```
45+
46+
`timer()` must be called after all other tasks are defined. The generated task to create a CSV result file should be added at the end of the task/group that should be timed (e.g. `deploy`)
47+
48+
## Change log
49+
50+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
51+
52+
## Testing
53+
54+
``` bash
55+
composer test
56+
```
57+
58+
Runs unit tests, mutation tests and static analysis
59+
60+
## Contributing
61+
62+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
63+
64+
## Security
65+
66+
If you discover any security related issues, please email fs@integer-net.de instead of using the issue tracker.
67+
68+
## Credits
69+
70+
- [Fabian Schmengler][link-author]
71+
- [All Contributors][link-contributors]
72+
73+
## License
74+
75+
The MIT License (MIT). Please see [License File](LICENSE.txt) for more information.
76+
77+
[ico-version]: https://img.shields.io/packagist/v/integer-net/deployer-timer.svg?style=flat-square
78+
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
79+
[ico-travis]: https://img.shields.io/travis/integer-net/deployer-timer/master.svg?style=flat-square
80+
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/integer-net/deployer-timer.svg?style=flat-square
81+
[ico-code-quality]: https://img.shields.io/scrutinizer/g/integer-net/deployer-timer.svg?style=flat-square
82+
[ico-downloads]: https://img.shields.io/packagist/dt/integer-net/deployer-timer.svg?style=flat-square
83+
84+
[link-packagist]: https://packagist.org/packages/integer-net/deployer-timer
85+
[link-travis]: https://travis-ci.org/integer-net/deployer-timer
86+
[link-scrutinizer]: https://scrutinizer-ci.com/g/integer-net/deployer-timer/code-structure
87+
[link-code-quality]: https://scrutinizer-ci.com/g/integer-net/deployer-timer
88+
[link-downloads]: https://packagist.org/packages/integer-net/deployer-timer
89+
[link-author]: https://github.com/schmengler
90+
[link-contributors]: ../../contributors

composer.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,33 @@
1010
}
1111
],
1212
"require": {
13+
"php": "^7.1.0|^7.2.0|^7.3.0",
1314
"roave/security-advisories": "dev-master",
14-
"deployer/deployer": "v6.4.3"
15+
"deployer/deployer": "^6.4"
1516
},
1617
"require-dev": {
17-
"phpunit/phpunit": "8.0.5"
18+
"pds/skeleton": "^1.0",
19+
"phpunit/phpunit": "^8.0.5",
20+
"phpro/grumphp": "^0.15.0",
21+
"squizlabs/php_codesniffer": "^3.4",
22+
"maglnet/composer-require-checker": "^2.0",
23+
"phan/phan": "^1.2",
24+
"phpmd/phpmd": "^2.6",
25+
"phpstan/phpstan": "^0.11.5",
26+
"infection/infection": "^0.12.2",
27+
"jakub-onderka/php-parallel-lint": "^1.0"
1828
},
1929
"autoload": {
2030
"psr-4": {
2131
"IntegerNet\\DeployerTimer\\": "src/"
2232
}
33+
},
34+
"autoload-dev": {
35+
"psr-4": {
36+
"IntegerNet\\DeployerTimer\\": "tests/"
37+
}
38+
},
39+
"scripts": {
40+
"test": "phpunit && infection && phpstan analyze --level 7 src tests && phan"
2341
}
2442
}

grumphp.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
parameters:
2+
git_dir: .
3+
bin_dir: vendor/bin
4+
tasks:
5+
composer: []
6+
phplint: []
7+
phpstan:
8+
level: 7
9+
composer_require_checker: []
10+
phpcs:
11+
standard: PSR2
12+
phpmd:
13+
ruleset: ['cleancode', 'codesize', 'design', 'unusedcode', 'naming']
14+
phpunit: []
15+
infection:
16+
threads: 4

0 commit comments

Comments
 (0)