-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show version url on project page #663
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,23 @@ def get_version(cls, project): | |
''' | ||
return cls.get_ordered_versions(project)[-1] | ||
|
||
@classmethod | ||
def get_version_url(cls, project): | ||
''' Method called to retrieve the url used to check for new version | ||
of the project provided, project that relies on the backend of this plugin. | ||
|
||
Attributes: | ||
project (:obj:`anitya.db.models.Project`): Project object whose backend | ||
corresponds to the current plugin. | ||
|
||
Returns: | ||
str: url used for version checking | ||
''' | ||
url = 'https://metacpan.org/release/%(name)s/' % { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be nice to have some consistency in the use of the |
||
'name': project.name} | ||
|
||
return url | ||
|
||
@classmethod | ||
def get_versions(cls, project): | ||
''' Method called to retrieve all the versions (that can be found) | ||
|
@@ -63,8 +80,7 @@ def get_versions(cls, project): | |
when the versions cannot be retrieved correctly | ||
|
||
''' | ||
url = 'https://metacpan.org/release/%(name)s/' % { | ||
'name': project.name} | ||
url = cls.get_version_url(project) | ||
|
||
regex = REGEX % {'name': project.name} | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -49,6 +49,22 @@ def get_version(cls, project): | |||||
''' | ||||||
return cls.get_ordered_versions(project)[-1] | ||||||
|
||||||
@classmethod | ||||||
def get_version_url(cls, project): | ||||||
''' Method called to retrieve the url used to check for new version | ||||||
of the project provided, project that relies on the backend of this plugin. | ||||||
|
||||||
Attributes: | ||||||
project (:obj:`anitya.db.models.Project`): Project object whose backend | ||||||
corresponds to the current plugin. | ||||||
|
||||||
Returns: | ||||||
str: url used for version checking | ||||||
''' | ||||||
url = project.version_url | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
return url | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
@classmethod | ||||||
def get_versions(cls, project): | ||||||
''' Method called to retrieve all the versions (that can be found) | ||||||
|
@@ -64,7 +80,7 @@ def get_versions(cls, project): | |||||
when the versions cannot be retrieved correctly | ||||||
|
||||||
''' | ||||||
url = project.version_url | ||||||
url = cls.get_version_url(project) | ||||||
|
||||||
regex = REGEX_ALIASES['DEFAULT'] | ||||||
if project.regex: | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use
url.strip("/")
here instead of the if logic