Add the checkdependencies command
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -268,6 +268,7 @@
|
||||
* The document link URL when mailed is now composed of the
|
||||
COMMON_PROJECT_URL + document URL instead of the Site
|
||||
domain.
|
||||
* Add the checkdependencies command.
|
||||
|
||||
3.1.11 (2019-04-XX)
|
||||
===================
|
||||
|
||||
@@ -578,6 +578,7 @@ Other changes
|
||||
* The document link URL when mailed is now composed of the
|
||||
COMMON_PROJECT_URL + document URL instead of the Site
|
||||
domain.
|
||||
* Add the checkdependencies command.
|
||||
|
||||
|
||||
Removals
|
||||
|
||||
@@ -18,7 +18,7 @@ from django.utils.encoding import (
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.module_loading import import_string
|
||||
from django.utils.six import PY3
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ugettext_lazy as _, ugettext
|
||||
|
||||
from mayan.apps.common.compat import FileNotFoundErrorException
|
||||
from mayan.apps.common.utils import resolve_attribute
|
||||
@@ -150,6 +150,34 @@ class Dependency(object):
|
||||
def return_sorted(dependencies):
|
||||
return sorted(dependencies, key=lambda x: x.get_label())
|
||||
|
||||
@classmethod
|
||||
def check_all(cls):
|
||||
template = '{:<35}{:<10} {:<15} {:<20} {:<15} {:<30} {:<10}'
|
||||
|
||||
print('\n ', end='')
|
||||
print(
|
||||
template.format(
|
||||
ugettext('Name'), ugettext('Type'), ugettext('Version'),
|
||||
ugettext('App'), ugettext('Environment'),
|
||||
ugettext('Other data'), ugettext('Check')
|
||||
)
|
||||
)
|
||||
print('-' * 140)
|
||||
|
||||
for dependency in cls.get_all():
|
||||
print('* ', end='')
|
||||
print(template.format(
|
||||
dependency.name,
|
||||
force_text(dependency.class_name_verbose_name),
|
||||
force_text(dependency.get_version_string()),
|
||||
force_text(dependency.app_label_verbose_name()),
|
||||
force_text(dependency.get_environment_verbose_name()),
|
||||
force_text(dependency.get_other_data()),
|
||||
force_text(dependency.check()),
|
||||
)
|
||||
)
|
||||
sys.stdout.flush()
|
||||
|
||||
@classmethod
|
||||
def get(cls, pk):
|
||||
return cls._registry[pk]
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.core import management
|
||||
|
||||
from ...classes import Dependency
|
||||
|
||||
|
||||
class Command(management.BaseCommand):
|
||||
help = 'Output the status of the defined dependencies.'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
Dependency.check_all()
|
||||
Reference in New Issue
Block a user