mirror of
https://github.com/lilydjwg/nvchecker
synced 2024-12-23 23:22:56 +00:00
port more sources
This commit is contained in:
parent
6737400a4c
commit
870fb99182
@ -1,16 +0,0 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
from .simple_json import simple_json
|
||||
|
||||
# Using metacpan
|
||||
CPAN_URL = 'https://fastapi.metacpan.org/release/%s'
|
||||
|
||||
def _version_from_json(data):
|
||||
return str(data['version'])
|
||||
|
||||
get_version, get_cacheable_conf = simple_json(
|
||||
CPAN_URL,
|
||||
'cpan',
|
||||
_version_from_json,
|
||||
)
|
@ -1,15 +0,0 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
from .simple_json import simple_json
|
||||
|
||||
GEMS_URL = 'https://rubygems.org/api/v1/versions/%s.json'
|
||||
|
||||
def _version_from_json(data):
|
||||
return data[0]['number']
|
||||
|
||||
get_version, get_cacheable_conf = simple_json(
|
||||
GEMS_URL,
|
||||
'gems',
|
||||
_version_from_json,
|
||||
)
|
@ -1,15 +0,0 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
from .simple_json import simple_json
|
||||
|
||||
HACKAGE_URL = 'https://hackage.haskell.org/package/%s/preferred.json'
|
||||
|
||||
def _version_from_json(data):
|
||||
return data['normal-version'][0]
|
||||
|
||||
get_version, get_cacheable_conf = simple_json(
|
||||
HACKAGE_URL,
|
||||
'hackage',
|
||||
_version_from_json,
|
||||
)
|
@ -1,15 +0,0 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
from .simple_json import simple_json
|
||||
|
||||
NPM_URL = 'https://registry.npmjs.org/%s'
|
||||
|
||||
def _version_from_json(data):
|
||||
return data['dist-tags']['latest']
|
||||
|
||||
get_version, get_cacheable_conf = simple_json(
|
||||
NPM_URL,
|
||||
'npm',
|
||||
_version_from_json,
|
||||
)
|
@ -1,18 +0,0 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
from .simple_json import simple_json
|
||||
|
||||
PACKAGIST_URL = 'https://packagist.org/packages/%s.json'
|
||||
|
||||
def _version_from_json(data):
|
||||
data = {version: details for version, details in data["package"]['versions'].items() if version != "dev-master"}
|
||||
|
||||
if len(data):
|
||||
return max(data, key=lambda version: data[version]["time"])
|
||||
|
||||
get_version, get_cacheable_conf = simple_json(
|
||||
PACKAGIST_URL,
|
||||
'packagist',
|
||||
_version_from_json,
|
||||
)
|
11
nvchecker_source/cpan.py
Normal file
11
nvchecker_source/cpan.py
Normal file
@ -0,0 +1,11 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
# Using metacpan
|
||||
CPAN_URL = 'https://fastapi.metacpan.org/release/%s'
|
||||
|
||||
async def get_version(name, conf, *, cache, **kwargs):
|
||||
key = conf.get('cpan', name)
|
||||
data = await cache.get_json(CPAN_URL % key)
|
||||
return str(data['version'])
|
||||
|
9
nvchecker_source/gems.py
Normal file
9
nvchecker_source/gems.py
Normal file
@ -0,0 +1,9 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
GEMS_URL = 'https://rubygems.org/api/v1/versions/%s.json'
|
||||
|
||||
async def get_version(name, conf, *, cache, **kwargs):
|
||||
key = conf.get('gems', name)
|
||||
data = await cache.get_json(GEMS_URL % key)
|
||||
return data[0]['number']
|
10
nvchecker_source/hackage.py
Normal file
10
nvchecker_source/hackage.py
Normal file
@ -0,0 +1,10 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
HACKAGE_URL = 'https://hackage.haskell.org/package/%s/preferred.json'
|
||||
|
||||
async def get_version(name, conf, *, cache, **kwargs):
|
||||
key = conf.get('hackage', name)
|
||||
data = await cache.get_json(HACKAGE_URL % key)
|
||||
return data['normal-version'][0]
|
||||
|
9
nvchecker_source/npm.py
Normal file
9
nvchecker_source/npm.py
Normal file
@ -0,0 +1,9 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
NPM_URL = 'https://registry.npmjs.org/%s'
|
||||
|
||||
async def get_version(name, conf, *, cache, **kwargs):
|
||||
key = conf.get('npm', name)
|
||||
data = await cache.get_json(NPM_URL % key)
|
||||
return data['dist-tags']['latest']
|
17
nvchecker_source/packagist.py
Normal file
17
nvchecker_source/packagist.py
Normal file
@ -0,0 +1,17 @@
|
||||
# MIT licensed
|
||||
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
PACKAGIST_URL = 'https://packagist.org/packages/%s.json'
|
||||
|
||||
async def get_version(name, conf, *, cache, **kwargs):
|
||||
key = conf.get('packagist', name)
|
||||
data = await cache.get_json(PACKAGIST_URL % key)
|
||||
|
||||
versions = {
|
||||
version: details
|
||||
for version, details in data["package"]['versions'].items()
|
||||
if version != "dev-master"
|
||||
}
|
||||
|
||||
if len(data):
|
||||
return max(data, key=lambda version: versions[version]["time"])
|
Loading…
Reference in New Issue
Block a user