Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
Initail commit
Browse files Browse the repository at this point in the history
  • Loading branch information
michalbundyra committed Oct 11, 2017
0 parents commit 6c7607c
Show file tree
Hide file tree
Showing 12 changed files with 3,649 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/test export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/composer.lock export-ignore
/phpcs.xml export-ignore
/phpunit.xml.dist export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
78 changes: 78 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
sudo: false

language: php

cache:
directories:
- $HOME/.composer/cache

env:
global:
- COMPOSER_ARGS="--no-interaction"
- COVERAGE_DEPS="satooshi/php-coveralls"
- LEGACY_DEPS="phpunit/phpunit"

matrix:
include:
- php: 5.6
env:
- DEPS=lowest
- php: 5.6
env:
- DEPS=locked
- php: 5.6
env:
- DEPS=latest
- php: 7
env:
- DEPS=lowest
- php: 7
env:
- DEPS=locked
- CS_CHECK=true
- TEST_COVERAGE=true
- php: 7
env:
- DEPS=latest
- php: 7.1
env:
- DEPS=lowest
- php: 7.1
env:
- DEPS=locked
- php: 7.1
env:
- DEPS=latest
- php: 7.2
env:
- DEPS=lowest
- php: 7.2
env:
- DEPS=locked
- php: 7.2
env:
- DEPS=latest
allow_failures:
- php: 7.2

before_install:
- if [[ $TEST_COVERAGE != 'true' && "$(php --version | grep xdebug -ci)" -ge 1 ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
- travis_retry composer self-update

install:
- travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs
- if [[ $TRAVIS_PHP_VERSION =~ ^5.6 || $TRAVIS_PHP_VERSION =~ ^7.0 ]]; then travis_retry composer update $COMPOSER_ARGS --with-dependencies $LEGACY_DEPS ; fi
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi
- stty cols 120 && composer show

script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi

after_script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi

notifications:
email: false
43 changes: 43 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Contributor Code of Conduct

This project adheres to [The Code Manifesto](http://codemanifesto.com)
as its guidelines for contributor interactions.

## The Code Manifesto

We want to work in an ecosystem that empowers developers to reach their
potential — one that encourages growth and effective collaboration. A space that
is safe for all.

A space such as this benefits everyone that participates in it. It encourages
new developers to enter our field. It is through discussion and collaboration
that we grow, and through growth that we improve.

In the effort to create such a place, we hold to these values:

1. **Discrimination limits us.** This includes discrimination on the basis of
race, gender, sexual orientation, gender identity, age, nationality, technology
and any other arbitrary exclusion of a group of people.
2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort
levels. Remember that, and if brought to your attention, heed it.
3. **We are our biggest assets.** None of us were born masters of our trade.
Each of us has been helped along the way. Return that favor, when and where
you can.
4. **We are resources for the future.** As an extension of #3, share what you
know. Make yourself a resource to help those that come after you.
5. **Respect defines us.** Treat others as you wish to be treated. Make your
discussions, criticisms and debates from a position of respectfulness. Ask
yourself, is it true? Is it necessary? Is it constructive? Anything less is
unacceptable.
6. **Reactions require grace.** Angry responses are valid, but abusive language
and vindictive actions are toxic. When something happens that offends you,
handle it assertively, but be respectful. Escalate reasonably, and try to
allow the offender an opportunity to explain themselves, and possibly correct
the issue.
7. **Opinions are just that: opinions.** Each and every one of us, due to our
background and upbringing, have varying opinions. The fact of the matter, is
that is perfectly acceptable. Remember this: if you respect your own
opinions, you should respect the opinions of others.
8. **To err is human.** You might not intend it, but mistakes do happen and
contribute to build experience. Tolerate honest mistakes, and don't hesitate
to apologize if you make one yourself.
23 changes: 23 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright (c) 2017, Michał Bundyra
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# composer-extra-dependency

[![Build Status](https://travis-ci.org/webimpress/composer-extra-dependency.svg?branch=master)](https://travis-ci.org/webimpress/composer-extra-dependency)
[![Coverage Status](https://coveralls.io/repos/github/webimpress/composer-extra-dependency/badge.svg?branch=master)](https://coveralls.io/github/webimpress/composer-extra-dependency?branch=master)

This composer plugin allows you to require composer dependencies in version
specified by user during the installation. It modifies the `composer.json` file
and add required package in `require` section.

This can be useful when your library supports multiple version of some
dependencies and you'd like to force user to use an explicit dependency instead
of depending on implicit dependencies from your library.

## Usage

Require the package in your library:
```console
# composer require webimpress/composer-extra-dependency
```

Update your `composer.json` file: in section `extra.dependency` add package(s)
you'd like to install with your library:

```json
{
"name": "my/package",
"description": "This is my package",
"extra": {
"dependency": [
"package/to-require",
...
]
},
"require": {
"php": "^5.6 || ^7.0",
"webimpress/composer-extra-dependency": "^0.1 || ^1.0",
...
}
...
}
```

Then, during installation of your library, user will be prompted:
```bash
# Enter the version of package/to-require to require (or leave blank to use the latest version):
```

After providing the version, `composer.json` of the user will be update
(package will be added in `require` section with version provided by user).

If user does not provide the version, plugin will try to find package in the
latest version matching platform requirements and other dependencies.
Here also `composer.json` will be updated and package will be installed.

Plugin runs always on post update/install package to check if there are some
dependencies to require explicitly in user `composer.json` file.

> If dependency is already provided in user `composer.json` the plugin is not
> going to do anything.
53 changes: 53 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "webimpress/composer-extra-dependency",
"description": "Composer plugin to require extra dependencies",
"type": "composer-plugin",
"homepage": "https://github.com/webimpress/composer-extra-dependency",
"license": "BSD-2-Clause",
"keywords": [
"webimpress",
"composer",
"dependency"
],
"support": {
"issues": "https://github.com/webimpress/composer-extra-dependency/issues",
"source": "https://github.com/webimpress/composer-extra-dependency"
},
"config": {
"sort-packages": true
},
"extra": {
"class": "Webimpress\\ComposerExtraDependency\\Plugin"
},
"require": {
"php": "^5.6 || ^7.0",
"composer-plugin-api": "^1.1"
},
"require-dev": {
"composer/composer": "^1.5.2",
"mikey179/vfsStream": "^1.6.5",
"phpunit/phpunit": "^5.7.22 || ^6.4.1",
"zendframework/zend-coding-standard": "~1.0.0"
},
"autoload": {
"psr-4": {
"Webimpress\\ComposerExtraDependency\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"WebimpressTest\\ComposerExtraDependency\\": "test/"
}
},
"scripts": {
"check": [
"@cs-check",
"@test"
],
"upload-coverage": "coveralls -v",
"cs-check": "phpcs --colors",
"cs-fix": "phpcbf --colors",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --coverage-clover clover.xml"
}
}
Loading

0 comments on commit 6c7607c

Please sign in to comment.