Skip to content

Commit

Permalink
massive refactoring for cleaner usage
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalkaoz committed Jun 11, 2014
1 parent 7b56b64 commit e2cda5d
Show file tree
Hide file tree
Showing 57 changed files with 927 additions and 1,542 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Expand Up @@ -4,6 +4,11 @@ php:
- 5.3
- 5.4
- 5.5
- hhvm

matrix:
allow_failures:
php: hhvm

before_script:
- php bin/vendors.php
Expand Down
27 changes: 10 additions & 17 deletions README.md
Expand Up @@ -6,32 +6,28 @@ a `php adapater` for [http://yuml.me](http://yuml.me)
Installation
------------

## Dependencies

* [`Buzz`](https://github.com/kriswallsmith/Buzz)
* [`Symfony Finder`](https://github.com/symfony/Finder)
* [`Symfony Console`](https://github.com/symfony/Console)
* [`Composer`](https://github.com/composer/composer) (for tests or self containing library only)

## Installation with [`composer`](https://github.com/composer/composer.git)

``` json
"require"{
"digitalkaoz/yuml-php": ">=0.3"
"digitalkaoz/yuml-php": "@stable"
}
```

## Installation with `PHAR`

wget http://digitalkaoz.github.io/yuml-php/yuml-php.phar

Usage
-----

### the `classes` command generates a class diagram from all classes in the given folder

Usage:
classes [--console] [--debug] [--properties] [--methods] folder basepath
classes [--console] [--debug] [--properties] [--methods] folder

Arguments:
folder the folder to scan for classes
basepath the basepath for the autoloader

Options:
--console log to console
Expand All @@ -44,13 +40,6 @@ Usage
yuml-php classes src/
```

**if it fails cause of `Class Not Found` use the `basepath` Parameter**

```sh
yuml-php classes vendor/symfony/src/Symfony/Component/Process vendor/symfony/src/
```


### the `activity` command generates an activity diagram from a given file

Usage:
Expand Down Expand Up @@ -84,14 +73,18 @@ yuml-php activity activities.txt
```sh
yuml-php use-case use-cases.txt
```
Building the PHAR
-----------------

php vendor/bin/box build

Tests
-----

php/bin/vendors.php
phpunit


TODO
----

Expand Down
121 changes: 0 additions & 121 deletions bin/build-phar.php

This file was deleted.

7 changes: 4 additions & 3 deletions bin/yuml-php
@@ -1,14 +1,15 @@
#!/usr/bin/env php
<?php

if ((!@include __DIR__.'/../../../autoload.php') && (!@include __DIR__.'/../vendor/autoload.php')) {
if (!@include __DIR__.'/../vendor/autoload.php') {
die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
'php composer.phar install'.PHP_EOL);
}

use YumlPhp\Console\Application;
use YumlPhp\Application;
use YumlPhp\Container;

// run the command application
$application = new Application();
$application = new Application(new Container());
$application->run();
29 changes: 29 additions & 0 deletions box.json
@@ -0,0 +1,29 @@
{
"alias": "yuml-php.phar",
"chmod": "0755",
"compactors": [
"Herrera\\Box\\Compactor\\Json",
"Herrera\\Box\\Compactor\\Php"
],
"directories": [
"src"
],
"extract": true,
"files": [
"LICENSE"
],
"finder": [
{
"name": "*.php",
"exclude": [
"tests", "Tests"
],
"in": "vendor"
}
],
"git-commit": "git-commit",
"git-version": "git-version",
"main": "bin/yuml-php",
"output": "yuml-php-@git-version@.phar",
"stub": true
}
41 changes: 27 additions & 14 deletions composer.json
@@ -1,29 +1,42 @@
{
"name" : "digitalkaoz/yuml-php",
"homepage" : "https://github.com/digitalkaoz/yuml-php",
"description" : "a PHP Adapter for http://yuml.me",
"type": "library",
"license": "MIT",
"name": "digitalkaoz/yuml-php",
"homepage": "https://github.com/digitalkaoz/yuml-php",
"description": "a PHP Adapter for http://yuml.me",
"type": "library",
"license": "MIT",

"authors": [
{
"name": "Robert Schönthal",
"email": "seroscho@googlemail.com",
"name": "Robert Schönthal",
"email": "seroscho@googlemail.com",
"homepage": "http://digitalkaoz.net"
}
],

"require": {
"ext-tokenizer": "*",
"symfony/finder": "@stable",
"symfony/console": "@stable",
"kriswallsmith/buzz": "@stable",
"andrewsville/php-token-reflection": "@stable"
"ext-tokenizer": "*",
"symfony/finder": "@stable",
"pimple/pimple": "@stable",
"symfony/console": "@stable",
"kriswallsmith/buzz": "@stable",
"andrewsville/php-token-reflection": "@stable"
},

"require-dev" : {
"kherge/box": "@stable"
},

"autoload": {
"psr-0": {
"YumlPhp": "src/"
"psr-4": {
"YumlPhp\\": "src/YumlPhp"
}
},
"autoload-dev": {
"psr-4": {
"YumlPhp\\Tests\\": "tests/YumlPhp/Tests",
"YumlPhp\\Tests\\Integration\\": "tests/Integration"
}
},

"bin": ["bin/yuml-php"]
}
9 changes: 3 additions & 6 deletions phpunit.xml.dist
Expand Up @@ -9,20 +9,17 @@
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="yuml-php Test Suite">
<directory>./tests/YumlPhp</directory>
<directory>./tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/YumlPhp/</directory>
<exclude>
<file>./src/YumlPhp/Analyzer/File.php</file>
</exclude>
<directory>./src</directory>
</whitelist>
</filter>
</phpunit>
60 changes: 60 additions & 0 deletions src/YumlPhp/Application.php
@@ -0,0 +1,60 @@
<?php

/*
* This file is part of yuml-php
*
* (c) Robert Schönthal <seroscho@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace YumlPhp;

use Symfony\Component\Console\Application as BaseApplication;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\ConsoleOutput;

/**
* The console application that handles the commands
*
* @author Robert Schönthal <seroscho@googlemail.com>
*/
class Application extends BaseApplication
{
/**
* @var \Pimple
*/
private $container;

/**
* @param \Pimple $container
*/
public function __construct(\Pimple $container)
{
parent::__construct('yuml-php', '@package_version@');

$this->container = $container;
}

/**
* {@inheritDoc}
*/
public function doRun(InputInterface $input = null, OutputInterface $output)
{
$this->registerCommands();

return parent::doRun($input, $output);
}

/**
* Initializes the commands
*/
private function registerCommands()
{
$this->add($this->container['command.classes']);
$this->add($this->container['command.activity']);
$this->add($this->container['command.use_case']);
}
}

0 comments on commit e2cda5d

Please sign in to comment.