mirror of
https://github.com/lilydjwg/nvchecker
synced 2024-12-27 00:52:12 +00:00
add support for RubyGems
This commit is contained in:
parent
b258adfc13
commit
2c3ba193e3
@ -122,6 +122,13 @@ Check `PyPI <https://pypi.python.org/>`_ for updates.
|
||||
pypi
|
||||
The name used on PyPI, e.g. ``PySide``.
|
||||
|
||||
Check RubyGems
|
||||
--------------
|
||||
Check `RubyGems <https://rubygems.org/>`_ for updates.
|
||||
|
||||
gems
|
||||
The name used on RubyGems, e.g. ``sass``.
|
||||
|
||||
Check Local Pacman Database
|
||||
---------------------------
|
||||
This is used when you run ``nvchecker`` on an Arch Linux system and the program always keeps up with a package in your configured repositories for `Pacman <https://wiki.archlinux.org/index.php/Pacman>`_.
|
||||
|
@ -3,7 +3,7 @@ from importlib import import_module
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
handler_precedence = (
|
||||
'github', 'aur', 'pypi', 'archpkg', 'pacman',
|
||||
'github', 'aur', 'pypi', 'archpkg', 'gems', 'pacman',
|
||||
'cmd', 'gcode_hg', 'regex', 'manual',
|
||||
)
|
||||
|
||||
|
17
nvchecker/source/gems.py
Normal file
17
nvchecker/source/gems.py
Normal file
@ -0,0 +1,17 @@
|
||||
import json
|
||||
from functools import partial
|
||||
|
||||
from tornado.httpclient import AsyncHTTPClient
|
||||
|
||||
GEMS_URL = 'https://rubygems.org/api/v1/versions/%s.json'
|
||||
|
||||
def get_version(name, conf, callback):
|
||||
repo = conf.get('gems') or name
|
||||
url = GEMS_URL % repo
|
||||
AsyncHTTPClient().fetch(url, user_agent='lilydjwg/nvchecker',
|
||||
callback=partial(_gems_done, name, callback))
|
||||
|
||||
def _gems_done(name, callback, res):
|
||||
data = json.loads(res.body.decode('utf-8'))
|
||||
version = data[0]['number']
|
||||
callback(name, version)
|
Loading…
Reference in New Issue
Block a user