forked from naneau/php-project-versioner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from AngryBytes/feat/upgrade
Feat/upgrade
- Loading branch information
Showing
30 changed files
with
502 additions
and
639 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
on: [push] | ||
name: PHP checks | ||
jobs: | ||
composer-check: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-versions: ['7.2', '7.3', '7.4'] | ||
name: PHP ${{ matrix.php-versions }} tests | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
tools: cs2pr | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
|
||
- name: Run Composer install | ||
run: composer install --prefer-dist | ||
|
||
- name: Run PHP checks | ||
run: composer phpcheck | ||
|
||
- name: Run PHPUnit | ||
run: composer phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/vendor/ | ||
composer.lock | ||
.phpunit.result.cache |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Changelog | ||
|
||
## 1.1.0 | ||
|
||
### PHP support | ||
* Dropped support for PHP `7.1` and lower. | ||
* Added support for PHP `7.2`, `7.3` and `7.4`. | ||
|
||
### 3rd party updates | ||
* Updated `symfony/finder` to version `4.4`. | ||
|
||
## 1.0.4 | ||
* Updated `symfony/finder` to version `3.3`. | ||
|
||
## 1.0.3 | ||
* Re-added the missing `Naneau\ProjectVersioner\Versioner::has($directory)` method. | ||
|
||
## 1.0.2 | ||
* Added `Naneau\ProjectVersioner\Reader\ComposerJson` for reading versions from a composer.json file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,55 @@ | ||
{ | ||
"name": "naneau/project-versioner", | ||
"name": "angrybytes/project-versioner", | ||
"description": "A tool to maintain project/sub-project versions based on Composer, file mtimes, etc.", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Maurice Fonk", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Angry Bytes BV", | ||
"email": "[email protected]", | ||
"homepage": "https://angrybytes.com/" | ||
} | ||
], | ||
|
||
"support": { | ||
"email": "[email protected]" | ||
}, | ||
"autoload": { | ||
"psr-4": {"Naneau\\ProjectVersioner\\": "src/Naneau/ProjectVersioner/"} | ||
"psr-4": { | ||
"Naneau\\ProjectVersioner\\": "src/Naneau/ProjectVersioner/", | ||
"Naneau\\ProjectVersioner\\Test\\": "tests/Naneau/ProjectVersioner/Test" | ||
} | ||
}, | ||
"config": { | ||
"optimize-autoloader": true, | ||
"sort-packages": true | ||
}, | ||
"scripts": { | ||
"phpcheck": [ | ||
"./vendor/bin/parallel-lint src/", | ||
"./vendor/bin/phpstan analyse -l max --memory-limit=1G src/", | ||
"./vendor/bin/phpcs -p --standard=PSR2 --extensions=php src/" | ||
], | ||
"phpcbf":[ | ||
"./vendor/bin/phpcbf -p --standard=PSR2 --extensions=php src/" | ||
], | ||
"phpunit": [ | ||
"./vendor/bin/phpunit" | ||
] | ||
}, | ||
|
||
"minimum-stability": "stable", | ||
"require": { | ||
"symfony/finder": "~2.5" | ||
"ext-json": "*", | ||
"php": "7.2.* || 7.3.* || 7.4.*", | ||
"symfony/finder": "~4.4" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~4.2" | ||
"jakub-onderka/php-console-highlighter": "^0.4.0", | ||
"jakub-onderka/php-parallel-lint": "^1.0", | ||
"phpstan/phpstan": "0.12.34", | ||
"phpunit/phpunit": "~8.5", | ||
"squizlabs/php_codesniffer": "^3.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,38 @@ | ||
<?php | ||
/** | ||
* ComposerJson.php | ||
* | ||
* @package ProjectVersioner | ||
* @subpackage Reader | ||
*/ | ||
|
||
namespace Naneau\ProjectVersioner\Reader; | ||
|
||
use Naneau\ProjectVersioner\ReaderInterface; | ||
|
||
use \RuntimeException; | ||
use \stdClass; | ||
use stdClass; | ||
|
||
/** | ||
* Finds the "version" from the composer.json file | ||
* | ||
* @category Naneau | ||
* @package ProjectVersioner | ||
* @subpackage Reader | ||
*/ | ||
class ComposerJson implements ReaderInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
**/ | ||
public function canRead($directory) | ||
*/ | ||
public function canRead(string $directory): bool | ||
{ | ||
return is_readable($directory . '/composer.json'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
**/ | ||
public function read($directory) | ||
*/ | ||
public function read(string $directory) | ||
{ | ||
$json = @file_get_contents($directory . '/composer.json'); | ||
if ($json === false) { | ||
return false; | ||
if (!$json) { | ||
return null; | ||
} | ||
|
||
$json = json_decode($json); | ||
$json = json_decode($json, false); | ||
if (!($json instanceof stdClass) || empty($json->version)) { | ||
return false; | ||
} | ||
return null; | ||
} | ||
|
||
return trim($json->version); | ||
return trim($json->version); | ||
} | ||
} |
Oops, something went wrong.