From 1e28a5400fa7666e9e296ad4f1444195e055da79 Mon Sep 17 00:00:00 2001 From: Josef Glatz Date: Wed, 4 Nov 2020 07:42:15 +0100 Subject: [PATCH] Composer v2 support * Support composer v2: add missing methods * [TASK] update license parts, change vendor name until initial vendor answers about the future work on his repository Related: #1 --- .github/PULL_REQUEST_TEMPLATE.md | 5 - .gitignore | 2 + LICENSE | 3 + README.md | 11 +- composer.json | 16 +- composer.lock | 419 ------------------------------- src/DiffPlugin.php | 41 ++- src/IO.php | 27 +- 8 files changed, 82 insertions(+), 442 deletions(-) delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 composer.lock diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index c53900c..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,5 +0,0 @@ -Please read the CLA carefully before submitting your contribution to Mercari. -Under any circumstances, by submitting your contribution, you are deemed to accept and agree to be bound by the terms and conditions of the CLA. - -https://www.mercari.com/cla/ - diff --git a/.gitignore b/.gitignore index 57872d0..8f4a2b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /vendor/ +/composer.lock +/.idea diff --git a/LICENSE b/LICENSE index 581e8ce..e06475e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,9 @@ The MIT License (MIT) Copyright (c) 2016 Mercari, Inc +Copyright (c) 2020 Josef Glatz, supseven.at + +Copyright for portions of project Foo are held by Mercari, Inc, 2016 as part of project composer-diff-plugin. All other copyright for project composer-diff-plugin are held by Josef Glatz, supseven.at, 2020. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 5a93b93..a9d14bd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ composer-diff-plugin -================== +==================== composer plugin to show library version diff at "composer update". @@ -9,27 +9,28 @@ feature ----------------- * print upgrade/downgrade/add/remove of libraries. -* output `composer.list` file +* output `composer.list` file which can be added to project's GIT repository. Install ----------------- ```bash -$ composer global require mercari/composer-diff-plugin +$ composer global require josefglatz/composer-diff-plugin ``` Uninstall ---------------- ```bash -$ composer global remove mercari/composer-diff-plugin +$ composer global remove josefglatz/composer-diff-plugin ``` License --------------- Copyright 2016 Mercari, Inc. +Copyright 2020 Josef Glatz, supseven.at Licensed under the MIT License @@ -38,6 +39,6 @@ Contribution Fork the project, create a feature branch, and send us a pull request. -Please read the CLA carefully before submitting your contribution to Mercari. +Please read the CLA carefully before submitting your contribution to Mercari repository. https://www.mercari.com/cla/ diff --git a/composer.json b/composer.json index 6751963..7aa9f8a 100644 --- a/composer.json +++ b/composer.json @@ -1,26 +1,30 @@ { - "name": "mercari/composer-diff-plugin", - "description": "composer plugin to show library version diff at \"composer update\"", + "name": "josefglatz/composer-diff-plugin", + "description": "composer plugin which creates a composer.list file and shows library version diff at \"composer update\"", "type": "composer-plugin", "license": "MIT", "authors": [ { "name": "Hiraku NAKANO", "email": "hiraku@mercari.com" + }, + { + "name": "Josef Glatz", + "email": "j.glatz@supseven.at" } ], "require": { - "composer-plugin-api": ">=1.0.0-alpha10" + "composer-runtime-api": "^2" }, "require-dev": { - "composer/composer": "1.0.0-alpha10" + "composer/composer": "^2.0" }, "autoload": { "psr-4": { - "Mercari\\ComposerDiffPlugin\\": "src/" + "JosefGlatz\\ComposerDiffPlugin\\": "src/" } }, "extra": { - "class": "Mercari\\ComposerDiffPlugin\\DiffPlugin" + "class": "JosefGlatz\\ComposerDiffPlugin\\DiffPlugin" } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 363cdb5..0000000 --- a/composer.lock +++ /dev/null @@ -1,419 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "dc34ca1049e690532f851699385bf351", - "content-hash": "6255cbcd06460c5cfa83ef5776a612b1", - "packages": [], - "packages-dev": [ - { - "name": "composer/composer", - "version": "1.0.0-alpha10", - "source": { - "type": "git", - "url": "https://github.com/composer/composer.git", - "reference": "775f6cd5c633facf2e7b99611fdcaa900b58ddb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/775f6cd5c633facf2e7b99611fdcaa900b58ddb7", - "reference": "775f6cd5c633facf2e7b99611fdcaa900b58ddb7", - "shasum": "" - }, - "require": { - "justinrainbow/json-schema": "~1.4", - "php": ">=5.3.2", - "seld/jsonlint": "~1.0", - "symfony/console": "~2.5", - "symfony/finder": "~2.2", - "symfony/process": "~2.1" - }, - "require-dev": { - "phpunit/phpunit": "~4.5" - }, - "suggest": { - "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", - "ext-zip": "Enabling the zip extension allows you to unzip archives, and allows gzip compression of all internet traffic" - }, - "bin": [ - "bin/composer" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "Composer": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.", - "homepage": "http://getcomposer.org/", - "keywords": [ - "autoload", - "dependency", - "package" - ], - "time": "2015-04-14 21:18:51" - }, - { - "name": "justinrainbow/json-schema", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "cc84765fb7317f6b07bd8ac78364747f95b86341" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/cc84765fb7317f6b07bd8ac78364747f95b86341", - "reference": "cc84765fb7317f6b07bd8ac78364747f95b86341", - "shasum": "" - }, - "require": { - "php": ">=5.3.29" - }, - "require-dev": { - "json-schema/json-schema-test-suite": "1.1.0", - "phpdocumentor/phpdocumentor": "~2", - "phpunit/phpunit": "~3.7" - }, - "bin": [ - "bin/validate-json" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" - } - ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", - "keywords": [ - "json", - "schema" - ], - "time": "2016-01-25 15:43:01" - }, - { - "name": "seld/jsonlint", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "66834d3e3566bb5798db7294619388786ae99394" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/66834d3e3566bb5798db7294619388786ae99394", - "reference": "66834d3e3566bb5798db7294619388786ae99394", - "shasum": "" - }, - "require": { - "php": "^5.3 || ^7.0" - }, - "bin": [ - "bin/jsonlint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Seld\\JsonLint\\": "src/Seld/JsonLint/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "JSON Linter", - "keywords": [ - "json", - "linter", - "parser", - "validator" - ], - "time": "2015-11-21 02:21:41" - }, - { - "name": "symfony/console", - "version": "v2.8.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "d0239fb42f98dd02e7d342f793c5d2cdee0c478d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/d0239fb42f98dd02e7d342f793c5d2cdee0c478d", - "reference": "d0239fb42f98dd02e7d342f793c5d2cdee0c478d", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2016-01-14 08:33:16" - }, - { - "name": "symfony/finder", - "version": "v2.8.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "c90fabdd97e431ee19b6383999cf35334dff27da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/c90fabdd97e431ee19b6383999cf35334dff27da", - "reference": "c90fabdd97e431ee19b6383999cf35334dff27da", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2016-01-14 08:26:52" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "1289d16209491b584839022f29257ad859b8532d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d", - "reference": "1289d16209491b584839022f29257ad859b8532d", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2016-01-20 09:13:37" - }, - { - "name": "symfony/process", - "version": "v2.8.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "6f1979c3b0f4c22c77a8a8971afaa7dd07f082ac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/6f1979c3b0f4c22c77a8a8971afaa7dd07f082ac", - "reference": "6f1979c3b0f4c22c77a8a8971afaa7dd07f082ac", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2016-01-06 09:59:23" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": { - "composer-plugin-api": 15, - "composer/composer": 15 - }, - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/src/DiffPlugin.php b/src/DiffPlugin.php index ccd22b8..e218620 100644 --- a/src/DiffPlugin.php +++ b/src/DiffPlugin.php @@ -1,9 +1,30 @@ io = $io; } + public function uninstall(Composer $composer, IOInterface $io) + { + $this->composer = $composer; + $this->io = $io; + } + + public function deactivate(Composer $composer, IOInterface $io) + { + $this->composer = $composer; + $this->io = $io; + } + public static function getSubscribedEvents() { return array( @@ -60,7 +93,7 @@ public function onPostUpdate(Event $arg) $io->write("\n" . '[[[ library version information ]]]'); if ($before == $after) { - $io->write('no change!'); + $io->write('no change!'); return; } $output = IO::getSymfonyOutput($io); diff --git a/src/IO.php b/src/IO.php index 7ba5a75..70704f2 100644 --- a/src/IO.php +++ b/src/IO.php @@ -1,9 +1,30 @@