From 5f796a54776b52b9107dec3e4621d4512d307f90 Mon Sep 17 00:00:00 2001 From: Nate Iler Date: Wed, 14 Jun 2017 07:24:51 -0600 Subject: [PATCH] aligning package structure with standards --- .gitignore | 13 ++++++------- .scrutinizer.yml | 35 +++++++++++++++++++++++++++++++++++ .travis.yml | 23 +++++++++++++++++++++++ CONTRIBUTING.md | 42 ++++++++++++++++++++++++++++++++++++++++++ README.md | 11 +++++++---- composer.json | 38 ++++++++++++++++++++++++++++++-------- phpunit.xml | 43 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 186 insertions(+), 19 deletions(-) create mode 100644 .scrutinizer.yml create mode 100644 .travis.yml create mode 100644 CONTRIBUTING.md create mode 100644 phpunit.xml diff --git a/.gitignore b/.gitignore index f94817f..c70ec65 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ -*.idea/* -*.log -*.DS_Store -*Thumbs.db -tests/_output/* -vendor/ -/composer.lock \ No newline at end of file +/build +/vendor +composer.phar +composer.lock +.DS_Store +.idea \ No newline at end of file diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 0000000..a903494 --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,35 @@ +filter: + excluded_paths: [tests/*] +checks: + php: + code_rating: true + remove_extra_empty_lines: true + remove_php_closing_tag: true + remove_trailing_whitespace: true + fix_use_statements: + remove_unused: true + preserve_multiple: false + preserve_blanklines: true + order_alphabetically: true + fix_php_opening_tag: true + fix_linefeed: true + fix_line_ending: true + fix_identation_4spaces: true + fix_doc_comments: true +tools: + external_code_coverage: + timeout: 600 + runs: 2 + php_analyzer: true + php_code_coverage: false + php_code_sniffer: + config: + standard: PSR2 + filter: + paths: ['src'] + php_loc: + enabled: true + excluded_dirs: [vendor, tests] + php_cpd: + enabled: true + excluded_dirs: [vendor, tests] diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e4f7a2e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +language: php + +sudo: false + +php: + - 7.0 + - 7.1 + +## Cache composer +cache: + directories: + - $HOME/.composer/cache + +before_script: + - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist + +script: + - vendor/bin/phpcs --standard=psr2 src/ + - vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover + +after_script: + - wget https://scrutinizer-ci.com/ocular.phar + - php ocular.phar code-coverage:upload --format=php-clover coverage.clover diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..83861ac --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,42 @@ +# Contributing + +Contributions are **welcome** and will be fully **credited**. + +We accept contributions via Pull Requests on [Github](https://github.com/flipbox/postmark). + + +## Pull Requests + +- **[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](http://pear.php.net/package/PHP_CodeSniffer). + +- **Add tests!** - Your patch won't be accepted if it doesn't have tests. + +- **Document any change in behaviour** - Make sure the README and any other relevant documentation are kept up-to-date. + +- **Consider our release cycle** - We try to follow SemVer. Randomly breaking public APIs is not an option. + +- **Create topic branches** - Don't ask us to pull from your master branch. + +- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. + +- **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 before submitting. + +- **Ensure tests pass!** - Please run the tests (see below) before submitting your pull request, and make sure they pass. We won't accept a patch until all tests pass. + +- **Ensure no coding standards violations** - Please run PHP Code Sniffer using the PSR-2 standard (see below) before submitting your pull request. A violation will cause the build to fail, so please make sure there are no violations. We can't accept a patch if the build fails. + + +## Running Tests + +``` bash +$ ./vendor/bin/phpunit +``` + + +## Running PHP Code Sniffer + +``` bash +$ ./vendor/bin/phpcs src --standard=psr2 -sp +``` + +**Happy coding**! diff --git a/README.md b/README.md index 6c09f96..35ad2a4 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/flipbox/postmark/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/flipbox/postmark/?branch=master) - -Postmark for Craft CMS -===================== +# Postmark for Craft CMS +[![Latest Version](https://img.shields.io/github/release/flipbox/link.svg?style=flat-square)](https://github.com/flipbox/postmark/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) +[![Build Status](https://img.shields.io/travis/flipbox/postmark/master.svg?style=flat-square)](https://travis-ci.org/flipbox/postmark) +[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/flipbox/postmark.svg?style=flat-square)](https://scrutinizer-ci.com/g/flipbox/postmark/code-structure) +[![Quality Score](https://img.shields.io/scrutinizer/g/flipbox/postmark.svg?style=flat-square)](https://scrutinizer-ci.com/g/flipbox/postmark) +[![Total Downloads](https://img.shields.io/packagist/dt/flipboxdigital/postmark.svg?style=flat-square)](https://packagist.org/packages/flipboxdigital/postmark) This plugin provides a [Postmark](http://www.postmarkapp.com/) integration for [Craft CMS](https://craftcms.com/). diff --git a/composer.json b/composer.json index 8f6116c..28767c4 100644 --- a/composer.json +++ b/composer.json @@ -2,20 +2,30 @@ "name": "flipboxdigital/postmark", "description": "Postmark adapter", "version": "1.0.2", + "type": "craft-plugin", + "minimum-stability": "beta", + "prefer-stable": true, + "config": { + "optimize-autoloader": true + }, "require": { + "craftcms/cms": "~3.0.0-beta", "wildbit/swiftmailer-postmark": "^2.1" }, - "repositories": [ - { - "type": "composer", - "url": "https://asset-packagist.org" - } - ], + "require-dev": { + "phpunit/phpunit": "^5.0", + "squizlabs/php_codesniffer": "^2.0" + }, "autoload": { "psr-4": { "flipbox\\postmark\\": "src/" } }, + "autoload-dev": { + "psr-4": { + "flipbox\\postmark\\tests\\": "tests/src/" + } + }, "extra": { "name": "Postmark", "handle": "postmark", @@ -24,6 +34,18 @@ "changelogUrl": "https://raw.githubusercontent.com/flipbox/postmark/master/CHANGELOG.md", "downloadUrl": "https://github.com/flipbox/postmark/archive/master.zip", "class": "flipbox\\postmark\\Postmark", - "schemaVersion": "1.0.0" - } + "schemaVersion": "1.0.0", + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "repositories": [ + { + "type": "composer", + "url": "https://packagist.org" + },{ + "type": "composer", + "url": "https://asset-packagist.org" + } + ] } diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..75e5193 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + ./tests/ + + + + + ./ + + ./vendor + ./tests + + + +