From 91796b042c3a53f323aef77d22622beb676b36d7 Mon Sep 17 00:00:00 2001 From: Luca Sbardella Date: Fri, 27 Nov 2015 13:59:21 +0000 Subject: [PATCH] release app fixes --- pulsar/apps/release/__init__.py | 20 +++++++++++--------- pulsar/apps/release/git.py | 5 +++-- pulsar/apps/release/utils.py | 2 +- release/notes.rst | 15 +-------------- 4 files changed, 16 insertions(+), 26 deletions(-) diff --git a/pulsar/apps/release/__init__.py b/pulsar/apps/release/__init__.py index 60ea9f1b..7ed9fc88 100644 --- a/pulsar/apps/release/__init__.py +++ b/pulsar/apps/release/__init__.py @@ -5,7 +5,7 @@ from asyncio import async import pulsar -from pulsar import ImproperlyConfigured +from pulsar import ImproperlyConfigured, as_coroutine from .git import Git from .utils import passthrough, change_version, write_notes @@ -112,29 +112,31 @@ def _exit(self, exit_code): pulsar.arbiter().stop(exit_code=exit_code) def _release(self): - git = yield from Git.create(self.cfg) + self.git = git = yield from Git.create(self.cfg) path = yield from git.toplevel() self.logger.info('Repository directory %s', path) with open(os.path.join(path, 'release', 'release.json'), 'r') as file: release = json.load(file) + # Read the release note file + note_file = self.cfg.note_file + with open(os.path.join(path, 'release', note_file), 'r') as file: + release['body'] = file.read().strip() + + yield from as_coroutine(self.cfg.before_commit(self, release)) + # Validate new tag and write the new version tag_name = release['tag_name'] version = yield from git.validate_tag(tag_name) self.logger.info('Bump to version %s', version) self.cfg.change_version(self, tuple(version)) - # - note_file = self.cfg.note_file - with open(os.path.join(path, 'release', note_file), 'r') as file: - release['body'] = file.read().strip() - # if self.cfg.commit or self.cfg.push: # # Add release note to the changelog - self.cfg.before_commit(self, release) - self.cfg.write_notes(self, path, version, release) + yield from as_coroutine(self.cfg.write_notes(self, path, + version, release)) self.logger.info('Commit changes') result = yield from git.commit(msg='Release %s' % tag_name) self.logger.info(result) diff --git a/pulsar/apps/release/git.py b/pulsar/apps/release/git.py index a28c4524..7fad4df9 100644 --- a/pulsar/apps/release/git.py +++ b/pulsar/apps/release/git.py @@ -121,8 +121,9 @@ class Github(Git): def api_url(self): return 'https://api.github.com' - def latest_release(self): - url = '%s/repos/%s/releases/latest' % (self.api_url, self.repo_path) + def latest_release(self, repo_path=None): + repo_path = repo_path or self.repo_path + url = '%s/repos/%s/releases/latest' % (self.api_url, repo_path) self.logger.info('Check current Github release from %s', url) response = yield from self.http.get(url, auth=self.auth) if response.status_code == 200: diff --git a/pulsar/apps/release/utils.py b/pulsar/apps/release/utils.py index a2219fef..044cafd0 100644 --- a/pulsar/apps/release/utils.py +++ b/pulsar/apps/release/utils.py @@ -37,7 +37,7 @@ def write_notes(manager, path, version, release): if os.path.isfile(filename): with open(filename, 'r') as file: - body.append('\n\n') + body.append('\n') body.append(file.read()) with open(filename, 'w') as file: diff --git a/release/notes.rst b/release/notes.rst index 6496232e..0490f6ed 100644 --- a/release/notes.rst +++ b/release/notes.rst @@ -1,16 +1,3 @@ Api ------------- -* Pulsar Protocol requires loop as first parameter during initialisation -* Actor uses event loop ``set_debug`` method when running with the ``--debug`` flag -* ``GreenWSGI`` handler moved to ``pulsar.apps.greenio.wsgi`` -* Added the release application for making releases. Used by pulsar and other packages. - -Internals -------------- -* Use ``actor_stop`` rather than ``loop.stop`` when handling OS signals which kill an actor. -* Better ``close`` method for ``TCPServer`` -* sudoless testing in travis - -Bug Fixes -------------- -* Bug fix in ``HttpRedirect.location`` attribute +* Improvements in the ``release`` application