Skip to content
This repository was archived by the owner on Oct 26, 2019. It is now read-only.

Commit cbeb75e

Browse files
committed
Merge pull request #147 from stage1/1.x
Refactoring of Docker-PHP
2 parents 86a417b + 8caa275 commit cbeb75e

File tree

184 files changed

+18658
-4664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+18658
-4664
lines changed

.scrutinizer.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
checks:
2-
php: true
3-
41
filter:
5-
excluded_paths:
6-
- src/Docker/Tests/*
2+
paths: [src/*]
3+
checks:
4+
php:
5+
code_rating: true
6+
duplication: true
7+
tools:
8+
external_code_coverage: true
9+
php_code_sniffer:
10+
config:
11+
standard: "PSR2"

.travis.yml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,49 @@
1-
language: go
1+
language: php
22
sudo: required
33

44
services:
55
- docker
66

7+
cache:
8+
directories:
9+
- $HOME/.composer/cache
10+
11+
php:
12+
- 5.4
13+
- 5.5
14+
- 5.6
15+
- 7.0
16+
- hhvm
17+
718
env:
8-
matrix:
9-
- SYMFONY_VERSION="2.3.*"
10-
- SYMFONY_VERSION="2.7.*"
19+
global:
20+
- TEST_COMMAND="composer test"
21+
22+
matrix:
23+
allow_failures:
24+
- php: hhvm
25+
fast_finish: true
26+
include:
27+
- php: 5.4
28+
sudo: required
29+
services:
30+
- docker
31+
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci"
1132

1233
before_install:
13-
- sudo apt-get update
14-
- sudo apt-get install -y php5-cli
15-
- curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
34+
- travis_retry composer self-update
1635

1736
install:
18-
- COMPOSER_ROOT_VERSION=dev-master composer --prefer-source install
37+
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction
38+
- docker pull registry:latest
39+
- docker run -p 5000:5000 -d registry
1940

2041
script:
21-
- bin/phpunit
42+
- $TEST_COMMAND
43+
44+
after_success:
45+
- if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
46+
- if [[ "$COVERAGE" = true ]]; then php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml; fi
2247

2348
after_script:
2449
- sudo cat /var/log/upstart/docker.log

CONTRIBUTING.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Contributing
2+
3+
If you're here, you would like to contribute to this repository and you're really welcome!
4+
5+
6+
## Bug reports
7+
8+
If you find a bug or a documentation issue, please report it or even better: fix it :). If you report it,
9+
please be as precise as possible. Here is a little list of required information:
10+
11+
- Precise description of the bug
12+
- Details of your environment (for example: OS, PHP version, installed extensions)
13+
- Backtrace which might help identifing the bug
14+
15+
16+
## Feature requests
17+
18+
If you think a feature is missing, please report it or even better: implement it :). If you report it, describe the more
19+
precisely what you would like to see implemented and we will discuss what is the best approach for it. If you can do
20+
some research before submitting it and link the resources to your description, you're awesome! It will allow us to more
21+
easily understood/implement it.
22+
23+
24+
## Sending a Pull Request
25+
26+
If you're here, you are going to fix a bug or implement a feature and you're the best! To do it, first fork the repository, clone it and create a new branch with the following commands:
27+
28+
``` bash
29+
$ git clone git@github.com:your-name/docker-php.git
30+
$ git checkout -b feature-or-bug-fix-description
31+
```
32+
33+
Then install the dependencies through [Composer](https://getcomposer.org/):
34+
35+
``` bash
36+
$ composer install
37+
```
38+
39+
Write code and tests. When you are ready, run the tests. (This is usually [PHPUnit](http://phpunit.de/) or [PHPSpec](http://phpspec.net/))
40+
41+
``` bash
42+
$ composer test
43+
```
44+
45+
When you are ready with the code, tested it and documented it, you can commit and push it with the following commands:
46+
47+
``` bash
48+
$ git commit -m "Feature or bug fix description"
49+
$ git push origin feature-or-bug-fix-description
50+
```
51+
52+
**Note:** Please write your commit messages in the imperative and follow the [guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for clear and concise messages.
53+
54+
Then [create a pull request](https://help.github.com/articles/creating-a-pull-request/) on GitHub.
55+
56+
Please make sure that each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting with the following commands (here, we assume you would like to squash 3 commits in a single one):
57+
58+
``` bash
59+
$ git rebase -i HEAD~3
60+
```
61+
62+
If your branch conflicts with the master branch, you will need to rebase and repush it with the following commands:
63+
64+
``` bash
65+
$ git remote add upstream git@github.com:stage1/docker-php.git
66+
$ git pull --rebase upstream master
67+
$ git push -f origin feature-or-bug-fix-description
68+
```
69+
70+
71+
## Coding standard
72+
73+
This repository follows the [PSR-2 standard](http://www.php-fig.org/psr/psr-2/) and so, if you want to contribute,
74+
you must follow these rules.
75+
76+
77+
## Semver
78+
79+
We are trying to follow [semver](http://semver.org/). When you are making BC breaking changes, please let us know why you think it is important. In this case, your patch can only be included in the next major version.

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2013 Geoffrey Bachelet <geoffrey@stage1.io>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

Lines changed: 16 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,35 @@
11
Docker PHP
22
==========
33

4-
**Docker PHP** (for lack of a better name) is a [Docker](http://docker.com/) client written in PHP. This library is still a work in progress. Not much is supported yet, but the goal is to reach 100% API support.
4+
**Docker PHP** (for lack of a better name) is a [Docker](http://docker.com/) client written in PHP.
5+
This library aim to reach 100% API support of the Docker Engine.
56

6-
The test suite currently passes against the [Docker Remote API v1.20](http://docs.docker.com/reference/api/docker_remote_api_v1.20/).
7+
The test suite currently passes against the [Docker Remote API v1.21](http://docs.docker.com/reference/api/docker_remote_api_v1.21/).
78

8-
[![Documentation Status](https://readthedocs.org/projects/docker-php/badge/?version=latest)](http://docker-php.readthedocs.org/en/latest/) [![Travis-CI](https://travis-ci.org/stage1/docker-php.svg?branch=master)](https://travis-ci.org/stage1/docker-php) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/stage1/docker-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/stage1/docker-php/?branch=master)
9+
[![Documentation Status](https://readthedocs.org/projects/docker-php/badge/?version=latest)](http://docker-php.readthedocs.org/en/latest/)
10+
[![Latest Version](https://img.shields.io/github/release/stage1/docker-php.svg?style=flat-square)](https://github.com/stage1/docker-php/releases)
11+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
12+
[![Build Status](https://img.shields.io/travis/stage1/docker-php.svg?branch=master&style=flat-square)](https://travis-ci.org/stage1/docker-php)
13+
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/stage1/docker-php.svg?style=flat-square)](https://scrutinizer-ci.com/g/stage1/docker-php)
14+
[![Quality Score](https://img.shields.io/scrutinizer/g/stage1/docker-php.svg?style=flat-square)](https://scrutinizer-ci.com/g/stage1/docker-php)
15+
[![Total Downloads](https://img.shields.io/packagist/dt/stage1/docker-php.svg?style=flat-square)](https://packagist.org/packages/stage1/docker-php)
916

10-
Versioning
11-
----------
12-
13-
There is no *stable* version yet and the API is rapidly evolving, but we still try to semantically version the library according to [semver](http://semver.org/), but shifted a little bit:
14-
15-
* **MAJOR** version number stays to 0 until API freeze
16-
* **MINOR** version number is incremented when a backward incompatible change is made
17-
* **PATCH** version number is incremented when a new feature is added
1817

19-
So basically, if you want the `0.5` version set, use a version constraint of `~0.5.0` and you should be fine.
20-
21-
We are **NOT** documenting upgrade procedures until we reach a stable API, please read the code and PRs to keep up with what's going on. You can also ask us for help, we're nice people!
2218

2319
Installation
2420
------------
2521

2622
The recommended way to install Docker PHP is of course to use [Composer](http://getcomposer.org/):
2723

28-
```json
29-
{
30-
"require": {
31-
"stage1/docker-php": "@dev"
32-
}
33-
}
24+
```bash
25+
composer require stage1/docker-php
3426
```
3527

36-
**Note**: there is no stable version of Docker PHP yet.
37-
3828
Usage
3929
-----
4030

4131
See [the documentation](http://docker-php.readthedocs.org/en/latest/).
4232

43-
Using Vagrant
44-
-------------
45-
46-
The provisioning included does not run the `composer install` bit, so you'll have to do it yourself:
47-
48-
```
49-
$ vagrant up --provider=virtualbox
50-
$ vagrant ssh
51-
$ cd /vagrant; composer install --dev
52-
```
53-
5433
Unit Tests
5534
----------
5635

@@ -63,60 +42,23 @@ $ composer install --dev
6342
Run it using [PHPUnit](http://phpunit.de/):
6443

6544
```
66-
$ bin/phpunit
45+
$ composer test
6746
```
6847

48+
6949
Contributing
7050
------------
7151

72-
Here are a few rules to follow in order to ease code reviews, and discussions before maintainers accept and merge your work.
52+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
7353

74-
* You **MUST** follow the [PSR-1](http://www.php-fig.org/psr/1/) and [PSR-2](http://www.php-fig.org/psr/2/).
75-
* You **MUST** run the test suite.
76-
* You **MUST** write (or update) unit tests.
77-
* You **SHOULD** write documentation.
78-
79-
Please, write [commit messages that make sense](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), and [rebase your branch](http://git-scm.com/book/en/Git-Branching-Rebasing) before submitting your Pull Request.
80-
81-
One may ask you to [squash your commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) too. This is used to "clean" your Pull Request before merging it (we don't want commits such as `fix tests`, `fix 2`, `fix 3`, etc.).
82-
83-
Also, when creating your Pull Request on GitHub, you **MUST** write a description which gives the context and/or explains why you are creating it.
84-
85-
Thank you!
8654

8755
Credits
8856
-------
8957

9058
This README heavily inspired by [willdurand/Negotiation](https://github.com/willdurand/Negotiation) by @willdurand. This guy is pretty awesome.
9159

92-
Projects
93-
--------
94-
95-
Projects known to be using docker-php:
96-
97-
* [JoliCi](https://github.com/jolicode/JoliCi), Run your tests on different and isolated stacks
9860

9961
License
10062
-------
10163

102-
The MIT License (MIT)
103-
104-
Copyright (c) 2013 Geoffrey Bachelet <geoffrey@stage1.io>
105-
106-
Permission is hereby granted, free of charge, to any person obtaining a copy
107-
of this software and associated documentation files (the "Software"), to deal
108-
in the Software without restriction, including without limitation the rights
109-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
110-
copies of the Software, and to permit persons to whom the Software is
111-
furnished to do so, subject to the following conditions:
112-
113-
The above copyright notice and this permission notice shall be included in
114-
all copies or substantial portions of the Software.
115-
116-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
117-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
118-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
119-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
120-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
121-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
122-
THE SOFTWARE.
64+
The MIT License (MIT). Please see [License File](LICENSE) for more information.

composer.json

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@
44
"type": "library",
55
"description": "A Docker PHP client",
66
"autoload": {
7-
"psr-0": {
8-
"": "src/"
7+
"psr-4": {
8+
"Docker\\": "src/",
9+
"Docker\\API\\": "generated/"
10+
}
11+
},
12+
"autoload-dev": {
13+
"psr-4": {
14+
"Docker\\Tests\\": "tests/"
915
}
1016
},
1117
"require": {
1218
"php": ">=5.4",
1319
"symfony/filesystem": "~2.3",
1420
"symfony/process": "~2.3",
15-
"guzzlehttp/guzzle": "~4.1",
16-
"guzzlehttp/streams": "~1.3"
21+
"jane/swagger": "dev-master",
22+
"php-http/socket-client": "dev-master",
23+
"php-http/plugins": "dev-master",
24+
"php-http/message": "^0.2@dev",
25+
"guzzlehttp/psr7": "^1.2"
1726
},
1827
"require-dev": {
1928
"phpunit/phpunit": "~3.7"
2029
},
21-
"config": {
22-
"bin-dir": "bin"
30+
"scripts": {
31+
"test": "vendor/bin/phpunit",
32+
"test-ci": "vendor/bin/phpunit --coverage-clover build/coverage.xml"
2333
},
24-
"minimum-stability": "stable"
34+
"minimum-stability": "dev",
35+
"prefer-stable": true
2536
}

0 commit comments

Comments
 (0)