Skip to content

Commit

Permalink
Merge branch '2.0' of https://github.com/cyberhouse/Magallanes into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Pichler committed Mar 17, 2016
2 parents 171112c + 50b8827 commit 85ab69f
Show file tree
Hide file tree
Showing 103 changed files with 1,617 additions and 970 deletions.
7 changes: 4 additions & 3 deletions .gitignore
@@ -1,14 +1,15 @@
vendor
mage.phar
bin
!bin/mage
!bin/mage2

.php_cs.cache
mage.phar
.mage

composer.phar

# OS generated files # // GitHub Recommendation
######################
._*
.DS_Store*
ehthumbs.db
Icon?
Expand Down
47 changes: 41 additions & 6 deletions .php_cs
@@ -1,29 +1,60 @@
<?php

/*
* (c) 2016 by Cyberhouse GmbH
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the MIT License
* modify it under the terms of the MIT License (MIT)
*
* For the full copyright and license information see
* <https://opensource.org/licenses/MIT>
*/

use \Symfony\CS\Finder\DefaultFinder;
use \Symfony\CS\Config\Config;
use Cyberhouse\Phpstyle\Fixer\LowerHeaderCommentFixer;
use Cyberhouse\Phpstyle\Fixer\NamespaceFirstFixer;
use Cyberhouse\Phpstyle\Fixer\SingleEmptyLineFixer;
use Symfony\CS\Config\Config;
use Symfony\CS\Finder\DefaultFinder;
use Symfony\CS\FixerInterface;

if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
die('Nope');
}

$cstart = 2016;
$cend = (int) date('Y');

$cline = (string) $cstart;

if ($cend > $cstart) {
$cline = $cstart . '-' . $cend;
}

$header = '(c) 2011-2015 Andrés Montañez <andres@andresmontanez.com>
(c) ' . $cline . ' by Cyberhouse GmbH <office@cyberhouse.at>
This is free software; you can redistribute it and/or
modify it under the terms of the MIT License (MIT)
For the full copyright and license information see
<https://opensource.org/licenses/MIT>';

LowerHeaderCommentFixer::setHeader($header);

$finder = DefaultFinder::create()
->in(array(__DIR__ . '/src', __DIR__ . '/tests'));
->exclude('docs')
->exclude('tests/Fixtures')
->name('/\.php$/')
->in(__DIR__);

return Config::create()
->setUsingCache(true)
->level(FixerInterface::PSR2_LEVEL)
->fixers([
'-psr0',
'encoding',
'lower_header_comment',
'namespace_first',
'remove_leading_slash_use',
'single_array_no_trailing_comma',
'ereg_to_preg',
Expand All @@ -43,7 +74,7 @@ return Config::create()
'standardize_not_equal',
'align_double_arrow',
'align_equals',
'long_array_syntax',
'short_array_syntax',
'single_quote',
'extra_empty_lines',
'hash_to_slash_comment',
Expand All @@ -52,5 +83,9 @@ return Config::create()
'duplicate_semicolon',
'phpdoc_no_package',
'phpdoc_scalar',
'phpdoc_order',
])
->addCustomFixer(new LowerHeaderCommentFixer())
->addCustomFixer(new NamespaceFirstFixer())
->addCustomFixer(new SingleEmptyLineFixer())
->finder($finder);
33 changes: 33 additions & 0 deletions Makefile
@@ -0,0 +1,33 @@
default: vendor/autoload.php

test: vendor/autoload.php
./bin/phpcs --encoding=utf-8 --colors -p --standard=ruleset.xml --extensions=php --severity=1 src/
./bin/phpcs --encoding=utf-8 --colors -p --standard=ruleset.xml --extensions=php --severity=1 tests/
./bin/phpunit -c phpunit.xml.dist tests/

fix: composer.phar
./bin/php-cs-fixer fix --config-file=.php_cs

phar: mage.phar

install: /usr/local/bin/mage

clean:
rm -rf vendor
cd bin && rm -f coveralls php*
rm -f *.phar
rm -f .php_cs.cache composer.lock

.PHONY: test fix default clean phar install

vendor/autoload.php: composer.phar
php composer.phar install -o

composer.phar:
php -r "readfile('https://getcomposer.org/installer');" | php

mage.phar: test
php phar.php

/usr/local/bin/mage: mage.phar
cp mage.phar /usr/local/bin/mage && chmod +x /usr/local/bin/mage
13 changes: 7 additions & 6 deletions composer.json
Expand Up @@ -35,15 +35,16 @@
"require": {
"php": ">=5.5",
"symfony/console": "^2.8.3",
"symfony/yaml": "2.6.1",
"symfony/yaml": "^2.6.1",
"pimple/pimple": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "^0.6",
"fabpot/php-cs-fixer": "^1.11",
"squizlabs/php_codesniffer": "^2.5",
"php-mock/php-mock": "^1.0"
"phpunit/phpunit": "~4.8",
"satooshi/php-coveralls": "~0.6",
"fabpot/php-cs-fixer": "~1.11",
"squizlabs/php_codesniffer": "~2.5",
"php-mock/php-mock": "~1.0",
"cyberhouse/phpstyle": "~0.1"
},
"suggest": {
"ext-yaml": "*"
Expand Down

0 comments on commit 85ab69f

Please sign in to comment.