Skip to content

Commit

Permalink
Clean up auto-updating and notify on version updates
Browse files Browse the repository at this point in the history
Update to 1.2.0, and prepare release
  • Loading branch information
lukewaite committed Oct 20, 2017
1 parent 512cd0b commit 0f4712f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

git stat
## [v1.2.0] (2017-10-20)

### Feature
* Notify if alfred-workflow detects a new version of alfred-gitlab

### Fixed
* Refresh after background updating of GitLab projects list

## [v1.1.0] (2017-10-20)
* Enable background updating of GitLab projects list

## [v1.0.2] (2017-10-20)
* Bump alfred-workflow to 1.28.1 to fix issues
Expand All @@ -17,8 +26,9 @@ git stat

* Initial implementaiton of alfred-gitlab workflow

[Unreleased]: https://github.com/lukewaite/alfred-gitlab/compare/v1.1.0...HEAD
[v1.1.2]: https://github.com/lukewaite/alfred-gitlab/compare/v1.0.2...v1.1.0
[Unreleased]: https://github.com/lukewaite/alfred-gitlab/compare/v1.2.0...HEAD
[v1.2.0]: https://github.com/lukewaite/alfred-gitlab/compare/v1.1.0...v1.2.0
[v1.1.0]: https://github.com/lukewaite/alfred-gitlab/compare/v1.0.2...v1.1.0
[v1.0.2]: https://github.com/lukewaite/alfred-gitlab/compare/v1.0.1...v1.0.2
[v1.0.1]: https://github.com/lukewaite/alfred-gitlab/compare/v1.0.0...v1.0.1
[v1.0.0]: https://github.com/lukewaite/alfred-gitlab/compare/90b63639ac1d06f9a52c37afd3f9c1da37d6ebd2...v1.0.0
Binary file not shown.
24 changes: 18 additions & 6 deletions src/gitlab.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# encoding: utf-8
import sys
import argparse
from workflow import Workflow, ICON_WEB, ICON_WARNING, ICON_INFO, web, PasswordNotFound
from workflow import Workflow3, ICON_WEB, ICON_WARNING, ICON_INFO, web, PasswordNotFound
from workflow.background import run_in_background, is_running

__version__ = '1.1.0'
__version__ = '1.2.0'

log = None

Expand Down Expand Up @@ -77,14 +77,22 @@ def main(wf):

projects = wf.cached_data('projects', None, max_age=0)

if wf.update_available:
# Add a notification to top of Script Filter results
wf.add_item('New version available',
'Action this item to install the update',
autocomplete='workflow:update',
icon=ICON_INFO)

# Start update script if cached data is too old (or doesn't exist)
if not wf.cached_data_fresh('projects', max_age=600):
if not wf.cached_data_fresh('projects', max_age=3600):
cmd = ['/usr/bin/python', wf.workflowfile('update.py')]
run_in_background('update', cmd)

# Notify the user if the cache is being updated
if is_running('update'):
wf.add_item('Updating project list via GitLab',
wf.rerun = 1
wf.add_item('Updating project list via GitLab...',
valid=False,
icon=ICON_INFO)

Expand All @@ -104,13 +112,17 @@ def main(wf):
subtitle=project['path_with_namespace'],
arg=project['web_url'],
valid=True,
icon=ICON_WEB)
icon=None)

# Send the results to Alfred as XML
wf.send_feedback()


if __name__ == u"__main__":
wf = Workflow()
wf = Workflow3(update_settings={
'github_slug': 'lukewaite/alfred-gitlab',
'version': __version__,
'frequency': 1
})
log = wf.logger
sys.exit(wf.run(main))
2 changes: 1 addition & 1 deletion src/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@
</dict>
</dict>
<key>version</key>
<string>1.1.0</string>
<string>1.2.0</string>
<key>webaddress</key>
<string>https://lukewaite.ca</string>
</dict>
Expand Down

0 comments on commit 0f4712f

Please sign in to comment.