-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 975778d
Showing
6 changed files
with
386 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.json | ||
.vscode/ | ||
dist/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
|
||
[dev-packages] | ||
autopep8 = "*" | ||
|
||
[packages] | ||
rumps = "*" | ||
py2app = "*" | ||
jira = "*" | ||
|
||
[requires] | ||
python_version = "3.7" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Jira Issues Menu Bar App | ||
|
||
A simple menu bar app which helps you in keeping track of your Jira tickets 🎟. | ||
|
||
## Configuration | ||
|
||
Create a `todo-app.json` file in your home directory. | ||
|
||
```sh | ||
cd ~ | ||
touch todo-app.json | ||
nano todo-app.json | ||
``` | ||
|
||
and make an object similar to this | ||
|
||
```json | ||
{ | ||
"user": "you@company.com", | ||
"apikey": "YOUR-API-KEY", | ||
"server": "https://<COMPANY>.atlassian.net" | ||
} | ||
``` | ||
|
||
Get your API key from [Manage API Keys](https://id.atlassian.com/manage/api-tokens) | ||
|
||
## Download | ||
|
||
Get the latest app from [release section](/releases) | ||
|
||
## Developement Setup | ||
|
||
- Install pipenv using `pip install -U pipenv` | ||
- Create new Virtual Env using `pipenv shell` | ||
- Install dependencies using `pipenv install` | ||
- Change the `app.py` to tweak with app. | ||
- Build using `python3 setup.py py2app` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import json | ||
import os | ||
import subprocess | ||
import sys | ||
import webbrowser | ||
|
||
import rumps | ||
from jira import JIRA | ||
|
||
config = json.load(open(os.path.expanduser("~") + '/todo-app.json')) | ||
|
||
|
||
class JiraTodoApp(object): | ||
def __init__(self): | ||
self.config = { | ||
"app_name": "My Todos", | ||
} | ||
self.app = rumps.App(self.config["app_name"]) | ||
self.set_up_menu() | ||
self.refresh = rumps.MenuItem(title="Refresh", callback=self.get_issues) | ||
self.app.menu = [self.refresh] | ||
|
||
def set_up_menu(self): | ||
self.app.title = "💻" | ||
self.get_issues() | ||
|
||
def open_url(self, item): | ||
id = item.title.split(':')[0] | ||
url = '{}/browse/{}'.format(server, id) | ||
if sys.platform == 'darwin': | ||
subprocess.Popen(['open', url]) | ||
else: | ||
webbrowser.open_new_tab(url) | ||
|
||
def get_issues(self): | ||
options = { | ||
'server': server | ||
} | ||
|
||
jira = JIRA(options, basic_auth=(user, apikey)) | ||
issues = jira.search_issues( | ||
'assignee = currentUser() AND status="TO DO"') | ||
for issue in issues: | ||
fields = jira.issue(issue.key).fields | ||
|
||
issue_string = '{}:{} - {}'.format(issue.key, | ||
fields.summary, fields.reporter) | ||
button = rumps.MenuItem( | ||
title=issue_string, callback=self.open_url) | ||
self.app.menu.update(button) | ||
|
||
def run(self): | ||
self.app.run() | ||
|
||
|
||
if __name__ == '__main__': | ||
user = config['user'] | ||
server = config['server'] | ||
apikey = config['apikey'] | ||
app = JiraTodoApp() | ||
app.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from setuptools import setup | ||
|
||
APP = ['app.py'] | ||
DATA_FILES = [] | ||
OPTIONS = { | ||
'argv_emulation': True, | ||
'plist': { | ||
'LSUIElement': True, | ||
}, | ||
'packages': ['rumps', 'jira'], | ||
} | ||
|
||
setup( | ||
app=APP, | ||
data_files=DATA_FILES, | ||
options={'py2app': OPTIONS}, | ||
setup_requires=['py2app'], | ||
) |