Skip to content
This repository has been archived by the owner on Nov 23, 2020. It is now read-only.

Commit

Permalink
release app fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lsbardel committed Nov 27, 2015
1 parent d261b1f commit 91796b0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 26 deletions.
20 changes: 11 additions & 9 deletions pulsar/apps/release/__init__.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions pulsar/apps/release/git.py
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pulsar/apps/release/utils.py
Expand Up @@ -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:
Expand Down
15 changes: 1 addition & 14 deletions 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

0 comments on commit 91796b0

Please sign in to comment.