Skip to content

Commit

Permalink
Fixes and better output
Browse files Browse the repository at this point in the history
  • Loading branch information
nilportugues committed Nov 1, 2015
1 parent c39dda4 commit 28052ab
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 33 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/vendor
/composer.lock
/build
/bin
/build_test
.*/
clean-build.sh
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,29 @@ PHAR tool to add all PHP internal functions to its namespace by adding backslash

## Installation

### As a dependency using Composer
Use [Composer](https://getcomposer.org) to install the package:

```json
$ composer require nilportugues/php_backslasher
```

### As a PHAR file

You can also use already last built `.phar`.

``` bash
$ git clone git@github.com:nilportugues/php_backslasher.git
$ cd php_backslasher
$ php build/php_backslasher.phar
```

You can copy the `.phar` file as a global script

``` bash
$ cp build/php_backslasher.phar /usr/local/bin/php_backslasher
```


### Build PHAR:

Expand All @@ -26,7 +43,5 @@ $ php -d phar.readonly=false box.phar build
You may also like to make it runnable by just giving it permissions to be used as an executable file and hide its extension.

```
$ chmod 755 bin/php_backslasher.phar
$ mv bin/php_backslasher.phar bin/php_backslasher
$ chmod 755 bin/php_backslasher.phar && mv bin/php_backslasher.phar bin/php_backslasher
```
12 changes: 12 additions & 0 deletions bin/php_backslasher
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env php
<?php
/**
* Author: Nil Portugués Calderó <contact@nilportugues.com>
* Date: 11/2/15
* Time: 12:13 AM
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

include __DIR__ . '/../src/bootstrap.php';
26 changes: 13 additions & 13 deletions box.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"alias": "php_backslasher.phar",
"chmod": "0755",
"directories": [
"src"
Expand All @@ -8,24 +9,23 @@
"name": "*.php",
"in": "vendor",
"exclude": [
"vendor/bin",
"vendor/doctrine",
"vendor/fabpot",
"vendor/justinrainbow",
"vendor/phpdocumentor",
"vendor/phpseclib",
"vendor/phpspec",
"vendor/phpunit",
"vendor/sebastian",
"vendor/seld",
"vendor/tedivm",
"vendor/twig",
"doctrine",
"fabpot",
"justinrainbow",
"phpdocumentor",
"phpseclib",
"phpspec",
"phpunit",
"sebastian",
"seld",
"tedivm",
"twig",
"tests"
]
}
],
"git-version": "package_version",
"main": "src/bootstrap.php",
"output": "bin/php_backslasher.phar",
"output": "build/php_backslasher.phar",
"stub": true
}
Binary file added build/php_backslasher.phar
Binary file not shown.
19 changes: 8 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
}
],
"require": {
"php": ">=5.4.0"
"php": ">=5.4.0",
"corneltek/cliframework": "~2.8",
"zendframework/zend-code": "~2"
},
"require-dev": {
"phpunit/phpunit": "^5.0",
"fabpot/php-cs-fixer": "^2.0@dev",
"corneltek/cliframework": "~2.8",
"zendframework/zend-code": "~2"
"fabpot/php-cs-fixer": "^2.0@dev"
},
"autoload": {
"psr-4": {
Expand All @@ -45,13 +45,10 @@
"NilPortugues\\Tests\\BackslashFixer\\": "tests/"
}
},
"config": {
"bin-dir": "bin/"
},
"scripts": {
"build": "php -d phar.readonly=false box.phar build && mv bin/php_backslasher.phar bin/php_backslasher"
},
"bin": [
"bin/php_backslasher"
]
],
"config": {
"bin-dir": "bin"
}
}
Binary file removed php_backslasher
Binary file not shown.
6 changes: 3 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
</filter>

<logging>
<log type="junit" target="build/logs/junit.xml"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-html" target="build/coverage"/>
<log type="junit" target="build_test/junit.xml"/>
<log type="coverage-clover" target="build_test/logs/clover.xml"/>
<log type="coverage-html" target="build_test/coverage"/>
</logging>
</phpunit>
23 changes: 22 additions & 1 deletion src/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
#!/usr/bin/env php
<?php

require __DIR__ . '/../vendor/autoload.php';
foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
if (file_exists($file)) {
define('COMPOSER_INSTALL', $file);

break;
}
}

unset($file);

if (!defined('COMPOSER_INSTALL')) {
fwrite(STDERR,
'You need to set up the project dependencies using the following commands:' . PHP_EOL .
'wget http://getcomposer.org/composer.phar' . PHP_EOL .
'php composer.phar install' . PHP_EOL
);

die(1);
}

require COMPOSER_INSTALL;

$app = new NilPortugues\BackslashFixer\Application;
$app->runWithTry($argv);

0 comments on commit 28052ab

Please sign in to comment.