Skip to content

Commit a367dd3

Browse files
Adds rellu to task release-notes
1 parent 89154d1 commit a367dd3

File tree

2 files changed

+94
-4
lines changed

2 files changed

+94
-4
lines changed

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ setuptools
22
nose
33
mockito
44
invoke
5+
rellu
56
# Include also normal project requirements.
67
-r requirements.txt
78

tasks.py

Lines changed: 93 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,67 @@
2121
import re
2222
import shutil
2323
import tempfile
24+
from pathlib import Path
25+
from urllib.request import urlretrieve
26+
import tarfile
27+
import zipfile
28+
29+
assert Path.cwd().resolve() == Path(__file__).resolve().parent
30+
sys.path.insert(0, 'src')
31+
32+
from invoke import Exit, task
33+
from rellu import initialize_labels, ReleaseNotesGenerator, Version
34+
from rellu.tasks import clean
35+
36+
37+
REPOSITORY = 'robotframework/RIDE'
38+
VERSION_PATH = Path('src/robotide/version.py')
39+
VERSION_PATTERN = "VERSION = '(.*)'"
40+
RELEASE_NOTES_PATH = Path('doc/releasenotes/ride-{version}.rst')
41+
RELEASE_NOTES_TITLE = 'Robot Framework IDE {version}'
42+
RELEASE_NOTES_INTRO = '''
43+
`RIDE (Robot Framework IDE)`_ {version} is a new release with **UPDATE** enhancements
44+
and bug fixes. It contains some updates for `Robot Framework`_ version 3.1.1.
45+
**MORE intro stuff...**
46+
47+
**REMOVE reference to tracker if release notes contain all issues.**
48+
All issues targeted for RIDE {version.milestone} can be found
49+
from the `issue tracker milestone`_.
50+
51+
Questions and comments related to the release can be sent to the
52+
`robotframework-users`_ mailing list or to the channel #ride on
53+
`Robot Framework Slack`_, and possible bugs submitted to the `issue tracker`_.
54+
55+
**REMOVE ``--pre`` from the next command with final releases.**
56+
If you have pip_ installed, just run
57+
58+
::
59+
60+
pip install --pre --upgrade robotframework-ride
61+
62+
to install the latest available release or use
63+
64+
::
65+
66+
pip install robotframework-ride=={version}
67+
68+
to install exactly this version. Alternatively you can download the source
69+
distribution from PyPI_ and install it manually. For more details and other
70+
installation approaches, see the `installation instructions`_.
71+
72+
RIDE {version} was released on {date}.
73+
74+
.. _RIDE (Robot Framework IDE): https://github.com/robotframework/RIDE/
75+
.. _Robot Framework: http://robotframework.org
76+
.. _pip: http://pip-installer.org
77+
.. _PyPI: https://pypi.python.org/pypi/robotframework-ride
78+
.. _issue tracker milestone: https://github.com/robotframework/RIDE/issues?q=milestone%3A{version.milestone}
79+
.. _issue tracker: https://github.com/robotframework/RIDE/issues
80+
.. _robotframework-users: http://groups.google.com/group/robotframework-users
81+
.. _Robot Framework Slack: https://robotframework-slack-invite.herokuapp.com
82+
.. _installation instructions: ../../INSTALL.rst
83+
'''
84+
2485

2586
try:
2687
from StringIO import StringIO
@@ -242,6 +303,7 @@ def wininst(ctx):
242303
_run_setup(ctx, 'bdist_wininst')
243304
_after_distribution()
244305

306+
'''
245307
@task
246308
def release_notes(ctx):
247309
"""Download and format issues in markdown format."""
@@ -252,6 +314,32 @@ def release_notes(ctx):
252314
parts = ('#{}'.format(i.number), _find_type(i), _find_priority(i),
253315
i.title)
254316
_log(' | '.join(parts))
317+
'''
318+
319+
@task
320+
def release_notes(ctx, version=None, username=None, password=None, write=False):
321+
"""Generate release notes based on issues in the issue tracker.
322+
323+
Args:
324+
version: Generate release notes for this version. If not given,
325+
generated them for the current version.
326+
username: GitHub username.
327+
password: GitHub password.
328+
write: When set to True, write release notes to a file overwriting
329+
possible existing file. Otherwise just print them to the
330+
terminal.
331+
332+
Username and password can also be specified using ``GITHUB_USERNAME`` and
333+
``GITHUB_PASSWORD`` environment variable, respectively. If they aren't
334+
specified at all, communication with GitHub is anonymous and typically
335+
pretty slow.
336+
"""
337+
version = Version(version, VERSION_PATH, VERSION_PATTERN)
338+
file = RELEASE_NOTES_PATH if write else sys.stdout
339+
generator = ReleaseNotesGenerator(REPOSITORY, RELEASE_NOTES_TITLE,
340+
RELEASE_NOTES_INTRO)
341+
generator.generate(version, username, password, file)
342+
255343

256344
@task
257345
def tags_test(ctx):
@@ -345,23 +433,24 @@ def _get_issues():
345433
_log('milestone not found')
346434
sys.exit(1)
347435
issues = list(repo.issues(milestone=milestone_number, state='closed'))
348-
issues.sort(cmp=_issue_sorter)
436+
# issues.sort(cmp=_issue_sorter)
349437
return issues
350438

351439
def _issue_sorter(i1, i2):
352440
prio_mapping = {
353441
'critical': 0,
354442
'high': 1,
355443
'medium': 2,
356-
'low': 3
444+
'low': 3,
445+
'none':50
357446
}
358447
prio1, prio2 = _find_priority(i1), _find_priority(i2)
359448
return cmp(prio_mapping[prio1], prio_mapping[prio2])
360449

361450
def _find_type(issue):
362451
type_labels = [l.name for l in issue.labels()
363-
if l.name in ['enhancement', 'bug', 'task']]
364-
return type_labels[0] if type_labels else 'Unknown type'
452+
if l.name in ['enhancement', 'bug', 'task', 'none']]
453+
return type_labels[0] if type_labels else 'none' # 'Unknown type'
365454

366455
def _find_priority(issue):
367456
prio_labels = [l.name for l in issue.labels()

0 commit comments

Comments
 (0)