diff --git a/plugin/packages/wakatime/HISTORY.rst b/plugin/packages/wakatime/HISTORY.rst index 45d8389..7974b82 100644 --- a/plugin/packages/wakatime/HISTORY.rst +++ b/plugin/packages/wakatime/HISTORY.rst @@ -3,6 +3,12 @@ History ------- +0.5.1 (2013-12-13) +++++++++++++++++++ + +- second line in .wakatime-project file now sets branch name + + 0.5.0 (2013-12-13) ++++++++++++++++++ diff --git a/plugin/packages/wakatime/README.rst b/plugin/packages/wakatime/README.rst index 854cc85..3219972 100644 --- a/plugin/packages/wakatime/README.rst +++ b/plugin/packages/wakatime/README.rst @@ -1,8 +1,9 @@ WakaTime ======== -Automatic time tracking for your text editor. This is the common interface -for the WakaTime api. You shouldn't need to directly use this package. +Automatic time tracking for your text editor. + +This is the common interface for the WakaTime api. You shouldn't need to directly use this package. Go to http://wakatime.com to install the plugin for your text editor. diff --git a/plugin/packages/wakatime/wakatime/__init__.py b/plugin/packages/wakatime/wakatime/__init__.py index e072fc4..c46bd46 100644 --- a/plugin/packages/wakatime/wakatime/__init__.py +++ b/plugin/packages/wakatime/wakatime/__init__.py @@ -14,7 +14,7 @@ from __future__ import print_function __title__ = 'wakatime' -__version__ = '0.5.0' +__version__ = '0.5.1' __author__ = 'Alan Hamlett' __license__ = 'BSD' __copyright__ = 'Copyright 2013 Alan Hamlett' diff --git a/plugin/packages/wakatime/wakatime/projects/wakatime.py b/plugin/packages/wakatime/wakatime/projects/wakatime.py index c558467..db9ed56 100644 --- a/plugin/packages/wakatime/wakatime/projects/wakatime.py +++ b/plugin/packages/wakatime/wakatime/projects/wakatime.py @@ -4,7 +4,8 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~ Information from a .wakatime-project file about the project for - a given file. + a given file. First line of .wakatime-project sets the project + name. Second line sets the current branch name. :copyright: (c) 2013 Alan Hamlett. :license: BSD, see LICENSE for more details. @@ -23,20 +24,26 @@ class WakaTime(BaseProject): def process(self): self.config = self._find_config(self.path) + self._project_name = None + self._project_branch = None + if self.config: + + try: + with open(self.config) as fh: + self._project_name = unicode(fh.readline().strip()) + self._project_branch = unicode(fh.readline().strip()) + except IOError as e: + log.exception("Exception:") + return True return False def name(self): - try: - with open(self.config) as fh: - return unicode(fh.readline().strip()) - except IOError as e: - log.exception("Exception:") - return None + return self._project_name def branch(self): - return None + return self._project_branch def _find_config(self, path): path = os.path.realpath(path)