Skip to content

Commit 7be8b89

Browse files
authored
Merge pull request #34 from jayvdb/badge-branch
branch support on badges
2 parents 7598077 + 4924e17 commit 7be8b89

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pypi-mobans
33
================================================================================
44

5-
.. image:: https://api.travis-ci.org/moremoban/pypi-mobans.svg?branch=master
5+
.. image:: https://api.travis-ci.org/moremoban/pypi-mobans.svg
66
:target: http://travis-ci.org/moremoban/pypi-mobans
77

88
.. image:: https://codecov.io/github/moremoban/pypi-mobans/coverage.png

templates/badges.rst.jj2

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
{% if not scm_host %}
22
{% set scm_host = 'github.com' %}
33
{% endif %}
4+
{% if branch and branch == 'master' %}
5+
{% set branch = False %}
6+
{% endif %}
7+
{% set slug = organisation + '/' + name %}
48
{% if scm_host == 'github.com' %}
5-
.. image:: https://api.travis-ci.org/{{organisation}}/{{name}}.svg?branch={{branch}}
6-
:target: http://travis-ci.org/{{organisation}}/{{name}}
9+
{% if branch %}
10+
.. image:: https://api.travis-ci.org/{{slug}}.svg?branch={{branch}}
11+
{% else %}
12+
.. image:: https://api.travis-ci.org/{{slug}}.svg
13+
{% endif %}
14+
:target: http://travis-ci.org/{{slug}}
715
{% endif %}
816

9-
{% if scm_host == 'github.com' %}
10-
.. image:: https://codecov.io/github/{{organisation}}/{{name}}/coverage.png
11-
:target: https://codecov.io/github/{{organisation}}/{{name}}
12-
{% elif scm_host == 'gitlab.com' %}
13-
.. image:: https://codecov.io/gitlab/{{organisation}}/{{name}}/coverage.png
14-
:target: https://codecov.io/gitlab/{{organisation}}/{{name}}
17+
{% set base_path = scm_host.split('.')[0] + '/' + slug %}
18+
{% if branch %}
19+
{% set suffix = '/branch/' + branch + '/graph/badge.svg' %}
20+
{% else %}
21+
{% set suffix = '/coverage.png' %}
1522
{% endif %}
23+
.. image:: https://codecov.io/{{base_path}}{{suffix}}
24+
:target: https://codecov.io/{{base_path}}
1625

1726
{% if gitter_room %}
1827
.. image:: https://img.shields.io/gitter/room/gitterHQ/gitter.svg

0 commit comments

Comments
 (0)