Skip to content

Commit c177f2c

Browse files
authored
Merge pull request #14 from dcarbone/master
Interaction Modifications
2 parents 222e676 + da69704 commit c177f2c

18 files changed

Lines changed: 1464 additions & 465 deletions

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
language: php
2+
3+
dist: trusty
4+
5+
sudo: false
6+
7+
php:
8+
- 7.0
9+
10+
matrix:
11+
include:
12+
- php: 7.0
13+
env:
14+
- BUILD_PHAR=true
15+
16+
install:
17+
- composer install --no-interaction --no-dev --no-progress --no-suggest --optimize-autoloader
18+
19+
script:
20+
- if [[ $BUILD_PHAR == 'true' && $TRAVIS_TAG != '' ]]; then /usr/bin/env php ./bin/php-cs phpcs:build -vvv ; fi
21+
22+
deploy:
23+
provider: releases
24+
api_key: $GITHUB_API_TOKEN
25+
file: build/php-cs.phar
26+
skip_cleanup: true
27+
on:
28+
tags: true
29+
php: '7.0'

README.md

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,22 @@ This project combines these two tools into one project. The code generation is
1212

1313
The code generated is tagged for [phpdoc](https://github.com/phpDocumentor/phpDocumentor2).
1414

15+
## Installation
16+
17+
Simply download the latest `php-cs.phar` from the releases page and put it where you'd like. We recommend adding it to
18+
your path in whatever fashion you prefer.
19+
1520
## Code Generation
1621

17-
A quick example:
22+
### Define a configuration file:
1823

19-
```php
20-
$generator = new \MyENA\CloudStackClientGenerator\Generator(new \MyENA\CloudStackClientGenerator\Configuration(
21-
[
22-
'api_key' => '', // YOUR_API_KEY (required)
23-
'secret_key' => '', // YOUR_SECRET_KEY (required)
24-
'host' => 'localhost', // Your CloudStack host (required)
25-
'scheme' => 'http', // http or https (defaults to http)
26-
'port' => 8080, // api port (defaults to 8080)
27-
'path_prefix' => 'client', // url prefix (defaults to 'client')
28-
'api_path' => 'api', // admin api path (defaults to 'api')
29-
'console_path' => 'console', // console api path (defaults to 'console')
30-
'output_dir' => '', // Where you'd like the generated files to go (defaults to ./output)
31-
'namespace' => '', // The namespace that will be used in the generated files (optional)
32-
'http_client' => null, // GuzzleHttp\ClientInterface compatible client
33-
]
34-
));
24+
Please see [files/config_prototype.yml](./files/config_prototype.yml) for an example configuration file
3525

36-
$generator->generate();
37-
```
26+
### Execute build
3827

39-
If you do not specify anything for `output_dir`, all generated files will be placed under [output](./output)
28+
```php
29+
php-cs phpcs:build --config your_config_file.yml
30+
```
4031

4132
There are 3 directories of files created by this generated process, however you will only directly interact with 3:
4233

@@ -56,9 +47,8 @@ PHP Library Usage
5647
'host' => 'localhost', // Your CloudStack host (required)
5748
'scheme' => 'http', // http or https (defaults to http)
5849
'port' => 8080, // api port (defaults to 8080)
59-
'path_prefix' => 'client', // url prefix (defaults to 'client')
60-
'api_path' => 'api', // admin api path (defaults to 'api')
61-
'console_path' => 'console', // console api path (defaults to 'console')
50+
'api_path' => 'client/api', // admin api path (defaults to 'client/api')
51+
'console_path' => 'client/console', // console api path (defaults to 'client/console')
6252
'http_client' => null, // GuzzleHttp\ClientInterface compatible client
6353
]);
6454

bin/php-cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
if (PHP_SAPI !== 'cli') {
4+
echo 'PHP-CS should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
5+
}
6+
7+
require __DIR__.'/../vendor/autoload.php';
8+
9+
if (!(bool)getenv('PHPCS_PHAR')) {
10+
define('PHPCS_ROOT', realpath(__DIR__.'/../'));
11+
}
12+
13+
use MyENA\CloudStackClientGenerator\Application;
14+
use Symfony\Component\Console\Formatter\OutputFormatter;
15+
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
16+
use Symfony\Component\Console\Output\ConsoleOutput;
17+
18+
error_reporting(-1);
19+
20+
$application = new Application('PHP CloudStack', '3.0.0');
21+
$application->run();
File renamed without changes.

composer.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,26 @@
3636
},
3737

3838
"require": {
39-
"php": "^7.1",
40-
39+
"php": "^7.0",
40+
"symfony/console": "@stable",
41+
"symfony/yaml": "@stable",
4142
"twig/twig": "@stable",
4243
"twig/extensions": "@stable",
43-
4444
"psr/log": "@stable",
45-
4645
"guzzlehttp/psr7": "@stable",
4746
"guzzlehttp/guzzle": "@stable"
4847
},
4948
"require-dev": {
5049
"myena/default-logger": "@stable",
5150
"phpunit/phpunit": "@stable"
51+
},
52+
53+
"scripts": {
54+
"build": [
55+
"rm -rf vendor",
56+
"composer install --no-interaction --no-dev --no-progress --no-suggest --optimize-autoloader --profile",
57+
"/usr/bin/env php ./bin/php-cs phpcs:build -vvv",
58+
"chmod +x build/php-cs.phar"
59+
]
5260
}
5361
}

0 commit comments

Comments
 (0)