Skip to content

Commit

Permalink
✨ Release beta
Browse files Browse the repository at this point in the history
  • Loading branch information
aashutoshrathi committed Feb 10, 2020
0 parents commit 975778d
Show file tree
Hide file tree
Showing 6 changed files with 386 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.json
.vscode/
dist/
build/
15 changes: 15 additions & 0 deletions Pipfile
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"
251 changes: 251 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions README.md
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`
61 changes: 61 additions & 0 deletions app.py
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()
18 changes: 18 additions & 0 deletions setup.py
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'],
)

0 comments on commit 975778d

Please sign in to comment.