mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
Add OpenVSX source
This commit is contained in:
parent
46d724b465
commit
ad2dc19415
3 changed files with 34 additions and 0 deletions
|
@ -825,6 +825,17 @@ strip_release
|
|||
provided
|
||||
Instead of the package version, return the version this package provides. Its value is what the package provides, and ``strip_release`` takes effect too. This is best used with libraries.
|
||||
|
||||
Check Open Vsx
|
||||
~~~~~~~~~~~~~~~
|
||||
::
|
||||
|
||||
source = "openvsx"
|
||||
|
||||
Check `Open Vsx <https://open-vsx.org/>`_ for updates.
|
||||
|
||||
openvsx
|
||||
The extension's Unique Identifier on open-vsx.org, e.g. ``ritwickdey.LiveServer``.
|
||||
|
||||
Combine others' results
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
::
|
||||
|
|
13
nvchecker_source/openvsx.py
Normal file
13
nvchecker_source/openvsx.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
# MIT licensed
|
||||
# Copyright (c) 2013-2021 Th3Whit3Wolf <the.white.wolf.is.1337@gmail.com>, et al.
|
||||
|
||||
API_URL = 'https://open-vsx.org/api/%s/%s'
|
||||
|
||||
async def get_version(name, conf, *, cache, **kwargs):
|
||||
name = conf.get('openvsx') or name
|
||||
splitName = name.split('.')
|
||||
publisher = splitName[0]
|
||||
extension = splitName[1]
|
||||
data = await cache.get_json(API_URL % (publisher, extension))
|
||||
version = data['version']
|
||||
return version
|
10
tests/test_openvsx.py
Normal file
10
tests/test_openvsx.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
# MIT licensed
|
||||
# Copyright (c) 2013-2021 Th3Whit3Wolf <the.white.wolf.is.1337@gmail.com>, et al.
|
||||
|
||||
import pytest
|
||||
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
|
||||
|
||||
async def test_openvsx(get_version):
|
||||
assert await get_version("usernamehw.indent-one-space", {
|
||||
"source": "openvsx",
|
||||
}) == "0.2.6"
|
Loading…
Add table
Reference in a new issue