Compare commits
No commits in common. "master" and "1.0.1" have entirely different histories.
|
@ -1,9 +1,5 @@
|
|||
/docs/*.py export-ignore
|
||||
/docs/*.txt export-ignore
|
||||
/docs/_* export-ignore
|
||||
/sandbox export-ignore
|
||||
/tests export-ignore
|
||||
/.git* export-ignore
|
||||
/*.yml export-ignore
|
||||
/*.xml export-ignore
|
||||
/*.xml.dist export-ignore
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/.idea
|
||||
/reports
|
||||
/docs/build
|
||||
/docs/venv
|
||||
/docs/html
|
||||
vendor
|
||||
composer.lock
|
||||
/.phpunit.result.cache
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
version: 2
|
||||
|
||||
build:
|
||||
os: 'ubuntu-22.04'
|
||||
tools:
|
||||
python: '3.11'
|
||||
|
||||
sphinx:
|
||||
configuration: 'docs/conf.py'
|
||||
|
||||
python:
|
||||
install:
|
||||
- requirements: 'docs/requirements.txt'
|
|
@ -1,11 +1,5 @@
|
|||
# Changelog
|
||||
|
||||
## 1.1.0
|
||||
|
||||
*Jun 7, 2022*
|
||||
|
||||
* Shortcut config for `liceneses.allowed` and `packages.allowed`
|
||||
|
||||
## 1.0.1
|
||||
|
||||
*Jun 7, 2022*
|
||||
|
|
14
README.md
14
README.md
|
@ -6,12 +6,6 @@
|
|||
|
||||
License management plugin for Composer.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
composer require 'arokettu/composer-license-manager'
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
The plugin is configured in the ``extras`` section of the ``composer.json`` file.
|
||||
|
@ -42,6 +36,12 @@ Run ``composer licenses:scan`` to check installed packages for undesired license
|
|||
|
||||
With `"enforced": true` (default setting) the plugin will prevent installation of packages with undesired licenses during `composer install` and `composer update`.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
composer require 'arokettu/composer-license-manager'
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
Read full documentation here: <https://sandfox.dev/php/composer-license-manager.html>
|
||||
|
@ -52,8 +52,6 @@ Also on Read the Docs: <https://composer-license-manager.readthedocs.io/>
|
|||
|
||||
Please file issues on our main repo at GitLab: <https://gitlab.com/sandfox/composer-license-manager/-/issues>
|
||||
|
||||
Feel free to ask any questions in our room on Gitter: <https://gitter.im/arokettu/community>
|
||||
|
||||
## License
|
||||
|
||||
The library is available as open source under the terms of the [MIT License].
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
"require-dev": {
|
||||
"composer/composer": "^2.0",
|
||||
"phpunit/phpunit": "^7.5 || ^9.5",
|
||||
"sandfox.dev/code-standard": "^1",
|
||||
"sandfox.dev/code-standard": "^10@dev",
|
||||
"squizlabs/php_codesniffer": "*",
|
||||
"vimeo/psalm": "^4.23"
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
{%- if current_version -%}
|
||||
<div class="sidebar-brand">{{ current_version }}</div>
|
||||
{%- endif -%}
|
|
@ -0,0 +1,22 @@
|
|||
<a class="sidebar-brand{% if logo %} centered{% endif %}" href="{{ pathto(master_doc) }}">
|
||||
{% block brand_content %}
|
||||
{%- if logo_url %}
|
||||
<div class="sidebar-logo-container">
|
||||
<img class="sidebar-logo" src="{{ logo_url }}" alt="Logo"/>
|
||||
</div>
|
||||
{%- endif %}
|
||||
{%- if theme_light_logo and theme_dark_logo %}
|
||||
<div class="sidebar-logo-container">
|
||||
<img class="sidebar-logo only-light" src="{{ pathto('_static/' + theme_light_logo, 1) }}" alt="Light Logo"/>
|
||||
<img class="sidebar-logo only-dark" src="{{ pathto('_static/' + theme_dark_logo, 1) }}" alt="Dark Logo"/>
|
||||
</div>
|
||||
{%- endif %}
|
||||
{% if not theme_sidebar_hide_name %}
|
||||
<span class="sidebar-brand-text">{{ docstitle if docstitle else project }}</span>
|
||||
{%- endif %}
|
||||
{% endblock brand_content %}
|
||||
</a>
|
||||
|
||||
{%- if current_version -%}
|
||||
<div class="sidebar-brand">{{ current_version }}</div>
|
||||
{%- endif -%}
|
18
docs/conf.py
18
docs/conf.py
|
@ -1,10 +1,6 @@
|
|||
from datetime import datetime
|
||||
|
||||
# import specific project config
|
||||
import os, sys
|
||||
sys.path.append(os.curdir)
|
||||
from conf_project import *
|
||||
|
||||
project = 'Composer License Manager'
|
||||
author = 'Anton Smirnov'
|
||||
copyright = '{} {}'.format(datetime.now().year, author)
|
||||
language = 'en'
|
||||
|
@ -12,15 +8,3 @@ language = 'en'
|
|||
html_title = project
|
||||
html_theme = 'furo'
|
||||
templates_path = ["_templates"]
|
||||
html_sidebars = {
|
||||
"**": [
|
||||
"sidebar/brand.html",
|
||||
"rtd-version.html",
|
||||
"sidebar/search.html",
|
||||
"sidebar/scroll-start.html",
|
||||
"sidebar/navigation.html",
|
||||
"sidebar/ethical-ads.html",
|
||||
"sidebar/scroll-end.html",
|
||||
"sidebar/variant-selector.html",
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
project = 'Composer License Manager'
|
|
@ -29,8 +29,6 @@ Licenses
|
|||
|
||||
Licenses section configures desired and undesired licenses.
|
||||
|
||||
.. versionadded:: 1.1 ``{ "licenses": [...] }`` is a shortcut for ``{ "licenses": { "allowed": [...] } }``
|
||||
|
||||
``"allowed"``
|
||||
Whitelisted licenses. Allows globs in prefix form (``*`` as the last character).
|
||||
Default: ``["*"]``
|
||||
|
@ -47,6 +45,7 @@ Licenses section configures desired and undesired licenses.
|
|||
``BSD-Protection`` (non GPL-compatible),
|
||||
``BSD-3-Clause-No-Nuclear-License`` and ``BSD-3-Clause-No-Military-License`` (both non-free)
|
||||
|
||||
|
||||
Check order:
|
||||
|
||||
#. exact forbidden licenses
|
||||
|
@ -65,8 +64,6 @@ Packages
|
|||
|
||||
Package exceptions to the policy enforcement.
|
||||
|
||||
.. versionadded:: 1.1 ``{ "packages": [...] }`` is a shortcut for ``{ "packages": { "allowed": [...] } }``
|
||||
|
||||
``"allowed"``
|
||||
Whitelisted packages. Allows globs in prefix form (``*`` as the last character).
|
||||
Default: ``[]``
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
sphinx>=7
|
||||
furo
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.5/phpunit.xsd"
|
||||
convertDeprecationsToExceptions="true"
|
||||
executionOrder="random"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd">
|
||||
executionOrder="random">
|
||||
<testsuites>
|
||||
<testsuite name="all">
|
||||
<directory>tests</directory>
|
||||
|
|
|
@ -38,21 +38,11 @@ final class Config
|
|||
|
||||
public static function fromArray(array $config): self
|
||||
{
|
||||
$licenses = $config['licenses'] ?? [];
|
||||
if ($licenses !== [] && array_is_list($licenses)) {
|
||||
$licenses = ['allowed' => $licenses];
|
||||
}
|
||||
|
||||
$packages = $config['packages'] ?? [];
|
||||
if ($packages !== [] && array_is_list($packages)) {
|
||||
$packages = ['allowed' => $packages];
|
||||
}
|
||||
|
||||
return new self(
|
||||
ConfigHelper::valueToArray($licenses['allowed'] ?? ['*']),
|
||||
$licenses['allow-empty'] ?? false,
|
||||
ConfigHelper::valueToArray($licenses['forbidden'] ?? []),
|
||||
ConfigHelper::valueToArray($packages['allowed'] ?? []),
|
||||
ConfigHelper::valueToArray($config['licenses']['allowed'] ?? ['*']),
|
||||
$config['licenses']['allow-empty'] ?? false,
|
||||
ConfigHelper::valueToArray($config['licenses']['forbidden'] ?? []),
|
||||
ConfigHelper::valueToArray($config['packages']['allowed'] ?? []),
|
||||
$config['enforced'] ?? true
|
||||
);
|
||||
}
|
||||
|
@ -118,6 +108,7 @@ final class Config
|
|||
return $this->allowEmptyLicense;
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function isEnforced(): bool
|
||||
{
|
||||
return $this->enforced;
|
||||
|
|
|
@ -16,7 +16,7 @@ use Composer\Plugin\PrePoolCreateEvent;
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class PrePoolCreateEventHandler
|
||||
class PrePoolCreateEventHandler
|
||||
{
|
||||
/** @var Composer */
|
||||
private $composer;
|
||||
|
|
|
@ -10,7 +10,7 @@ use Composer\Package\CompletePackageInterface;
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class LicenseHelper
|
||||
class LicenseHelper
|
||||
{
|
||||
public static function isPermitted(CompletePackageInterface $package, Config $config): bool
|
||||
{
|
||||
|
|
|
@ -44,20 +44,4 @@ class ConfigTest extends TestCase
|
|||
|
||||
Config::fromArray(['licenses' => ['allowed' => ['MIT' => 'MIT', 123 => 123]]]);
|
||||
}
|
||||
|
||||
public function testLicenseShortcutsEquivalence(): void
|
||||
{
|
||||
$config1 = Config::fromArray(['licenses' => ['allowed' => ['MIT', 'BSD-2-Clause', 'GPL-*']]]);
|
||||
$config2 = Config::fromArray(['licenses' => ['MIT', 'BSD-2-Clause', 'GPL-*']]);
|
||||
|
||||
self::assertEquals($config1, $config2);
|
||||
}
|
||||
|
||||
public function testPackageShortcutsEquivalence(): void
|
||||
{
|
||||
$config1 = Config::fromArray(['packages' => ['allowed' => ['foo/bar', 'foo/baz', 'bar/*']]]);
|
||||
$config2 = Config::fromArray(['packages' => ['foo/bar', 'foo/baz', 'bar/*']]);
|
||||
|
||||
self::assertEquals($config1, $config2);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue