Skip to content

Commit

Permalink
Merge pull request #13 from blazarecki/generate-phar
Browse files Browse the repository at this point in the history
Generate phar
  • Loading branch information
iamluc committed Jan 5, 2016
2 parents 77ce245 + 2cd15f6 commit b8c8a03
Show file tree
Hide file tree
Showing 12 changed files with 1,342 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/vendor/
/bin/docker-hostmanager.phar
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: php
sudo: false
php: 5.6

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

install: composer install --prefer-source

script: vendor/bin/phpunit --configuration phpunit.xml.dist

before_deploy:
- curl -LSs http://box-project.github.io/box2/installer.php | php
- php box.phar build

deploy:
provider: releases
skip_cleanup: true
api_key:
secure: NuHZx1ORZGojbPuY2ZZrB1BNfe2UUmO5wBv4dM6Qu2WluU0zp96LmKlOsbNml6k167cKj4R1AHgbVsbBARjtUeoYNBYti1G5/m2iXjRRqfPGNkuhG7A2THnYtrLqRb2jCI3hypsZSpOtj//4N+Q3CEKT9nd69HeV90/cAFd+YgDN5ldk9mhHbMnFAJ5hAFzYzUg2zukExVWObWkQ9Y3nP/zJ8jQvmvfiS2yLO+DjPEDH63rQorCbFh9SI0hSWXUQxTtbUk8Jj1H46Mrp9RAZlNhfEL2HiUt4S6lKciCQxkZ3P9yXp8ebjYPqH7fPPhn8G3ewYQqGFG/AYQGX463eyh0VAIt4PbJyIeqtEoPKC1h16b7a9tVt2kroQMImkYV1pwKg/aNZ0x9T3PXBjaCU8Mb5qrUvYpIoxjONI2qxi6lDV0kikumzhFnbfayFTA004ybl+yL1Ag3LxXyqo2jeu3vzX0e9kSDbQD1Cf4lp0riDkbKIDrJ8Ptqv67QV+dcAPyynDkRYDvPoSRKnraVKtHeRu1P5XHH7gpL/xdU8UnvO83ofDaLu923fkDE/dlGNhR/MU8P4EMWC4U/y0ROp1Wx27+qatrzCFZBlJVjtq6urTZ5Z6fMrD9f/Nelu8UR4CI8hnWMFl+UQVoQpSDYYVh71DHPU1QK+A/TpGI4GYm8=
file: bin/docker-hostmanager.phar
on:
tags: true
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ THIS PROJECT IS IN ALPHA STATE

### USAGE

#### Docker image
#### Docker image (Recommended)

The easiest way is to use the docker image

Expand All @@ -33,6 +33,20 @@ i.e.
$ docker run -d -e DOMAIN_NAME=test.com,www.test.com my_image
```

#### PHAR

If you don't want to use the docker image you can download a PHAR executable here : https://github.com/iamluc/docker-hostmanager/releases

And then run it:

```console
$ php docker-hostmanager.phar synchronize-hosts
```

### Tests

To run test, execute the following command : `vendor/bin/phpunit`

### LICENSE

[MIT](https://opensource.org/licenses/MIT)
14 changes: 7 additions & 7 deletions bin/docker-hostmanager
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<?php

if (PHP_SAPI !== 'cli') {
die('Warning: buse must be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL);
die('Warning: docker-hostmanager must be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL);
}

require_once __DIR__.'/../vendor/autoload.php';
require __DIR__.'/../vendor/autoload.php';

$entrypoint = getenv('DOCKER_ENTRYPOINT') ?: 'unix:///var/run/docker.sock';
$hostsFile = getenv('HOSTS_FILE') ?: '/etc/hosts';
$tld = getenv('TLD') ?: '.docker';
use DockerHostManager\Command\RunCommand;
use Symfony\Component\Console\Application;

$app = new DockerHostManager\Application($entrypoint, $hostsFile, $tld);
$app->run();
$application = new Application('DockerHostManager', '@package_version@');
$application->add(new RunCommand());
$application->run();
14 changes: 14 additions & 0 deletions box.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"main": "bin/docker-hostmanager",
"output": "bin/docker-hostmanager.phar",
"finder": [
{
"name": ["*.php"],
"exclude": ["Tests", "tests"],
"in": ["src", "vendor"]
}
],
"chmod": "0755",
"stub": true,
"git-version": "package_version"
}
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
"description": "Update /etc/hosts to access running containers",
"keywords": ["docker", "hosts", "registry"],
"require": {
"stage1/docker-php": "@dev"
"stage1/docker-php": "@dev",
"symfony/console": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^5.1"
},
"authors": [
{
Expand All @@ -14,6 +18,6 @@
}
],
"autoload": {
"psr-4": {"DockerHostManager\\": "src/"}
"psr-4": {"DockerHostManager\\": "src/", "Test\\": "tests"}
}
}
Loading

0 comments on commit b8c8a03

Please sign in to comment.