Skip to content

Commit

Permalink
Merge pull request #14 from dcarbone/master
Browse files Browse the repository at this point in the history
Interaction Modifications
  • Loading branch information
dcarbone authored Oct 18, 2017
2 parents 222e676 + da69704 commit c177f2c
Show file tree
Hide file tree
Showing 18 changed files with 1,464 additions and 465 deletions.
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
language: php

dist: trusty

sudo: false

php:
- 7.0

matrix:
include:
- php: 7.0
env:
- BUILD_PHAR=true

install:
- composer install --no-interaction --no-dev --no-progress --no-suggest --optimize-autoloader

script:
- if [[ $BUILD_PHAR == 'true' && $TRAVIS_TAG != '' ]]; then /usr/bin/env php ./bin/php-cs phpcs:build -vvv ; fi

deploy:
provider: releases
api_key: $GITHUB_API_TOKEN
file: build/php-cs.phar
skip_cleanup: true
on:
tags: true
php: '7.0'
36 changes: 13 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,22 @@ This project combines these two tools into one project. The code generation is

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

## Installation

Simply download the latest `php-cs.phar` from the releases page and put it where you'd like. We recommend adding it to
your path in whatever fashion you prefer.

## Code Generation

A quick example:
### Define a configuration file:

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

$generator->generate();
```
### Execute build

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

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

Expand All @@ -56,9 +47,8 @@ PHP Library Usage
'host' => 'localhost', // Your CloudStack host (required)
'scheme' => 'http', // http or https (defaults to http)
'port' => 8080, // api port (defaults to 8080)
'path_prefix' => 'client', // url prefix (defaults to 'client')
'api_path' => 'api', // admin api path (defaults to 'api')
'console_path' => 'console', // console api path (defaults to 'console')
'api_path' => 'client/api', // admin api path (defaults to 'client/api')
'console_path' => 'client/console', // console api path (defaults to 'client/console')
'http_client' => null, // GuzzleHttp\ClientInterface compatible client
]);

Expand Down
21 changes: 21 additions & 0 deletions bin/php-cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

if (PHP_SAPI !== 'cli') {
echo 'PHP-CS should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
}

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

if (!(bool)getenv('PHPCS_PHAR')) {
define('PHPCS_ROOT', realpath(__DIR__.'/../'));
}

use MyENA\CloudStackClientGenerator\Application;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Output\ConsoleOutput;

error_reporting(-1);

$application = new Application('PHP CloudStack', '3.0.0');
$application->run();
File renamed without changes.
16 changes: 12 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,26 @@
},

"require": {
"php": "^7.1",

"php": "^7.0",
"symfony/console": "@stable",
"symfony/yaml": "@stable",
"twig/twig": "@stable",
"twig/extensions": "@stable",

"psr/log": "@stable",

"guzzlehttp/psr7": "@stable",
"guzzlehttp/guzzle": "@stable"
},
"require-dev": {
"myena/default-logger": "@stable",
"phpunit/phpunit": "@stable"
},

"scripts": {
"build": [
"rm -rf vendor",
"composer install --no-interaction --no-dev --no-progress --no-suggest --optimize-autoloader --profile",
"/usr/bin/env php ./bin/php-cs phpcs:build -vvv",
"chmod +x build/php-cs.phar"
]
}
}
Loading

0 comments on commit c177f2c

Please sign in to comment.