Skip to content

Commit 2a6f5c9

Browse files
committed
complete refactor and add webapp code
1 parent dfc0a60 commit 2a6f5c9

File tree

14 files changed

+98
-5
lines changed

14 files changed

+98
-5
lines changed

tests/test_generate.py renamed to gitlab_release_notes/tests/test_generate.py

File renamed without changes.

tests/test_scripts.py renamed to gitlab_release_notes/tests/test_scripts.py

File renamed without changes.

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def read(*paths, **kwargs):
88
"""Read the contents of a text file safely.
9-
>>> read("gitlabrng", "VERSION")
9+
>>> read("gitlab_release_notes", "VERSION")
1010
'0.1.0'
1111
>>> read("README.md")
1212
...
@@ -29,17 +29,17 @@ def read_requirements(path):
2929

3030

3131
setup(
32-
name="gitlabrng",
33-
version=read("gitlabrng", "VERSION"),
32+
name="gitlab_release_notes",
33+
version=read("gitlab_release_notes", "VERSION"),
3434
description="Generate release notes for a gitlab project",
3535
url="https://github.com/vuillaut/GitlabReleaseNotesGenerator/",
3636
long_description=read("README.md"),
3737
long_description_content_type="text/markdown",
3838
author="vuillaut",
39-
packages=find_packages(exclude=["gitlabrng/tests", ".github"]),
39+
packages=find_packages(exclude=["gitlab_release_notes/tests", ".github"]),
4040
install_requires=read_requirements("requirements.txt"),
4141
entry_points={
42-
"console_scripts": ["gitlab-release-notes = gitlabrng.generate:main"]
42+
"console_scripts": ["gitlab-release-notes = gitlab_release_notes.generate:main"]
4343
},
4444
extras_require={"test": read_requirements("requirements-test.txt")},
4545
)

webapp/Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn run:app

webapp/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# gitlab-release-notes webapp
2+
3+
Flask app deployed on heroku at https://gitlab-release-notes.herokuapp.com/
4+
5+
6+
## Instructions
7+
8+
The flask app can be run and tested separately by running
9+
```bash
10+
python run.py
11+
```
12+
13+
### Install Heroku
14+
15+
https://devcenter.heroku.com/articles/getting-started-with-python#set-up
16+
17+
18+
### Build and test locally:
19+
20+
Install requirements:
21+
```
22+
pip install -r requirements.txt
23+
```
24+
25+
Start app:
26+
```
27+
heroku local
28+
```
29+
30+
### Push changes
31+
32+
```
33+
git remote add herokuhttps://git.heroku.com/gitlab-release-notes.git
34+
```
35+
36+
```
37+
git add
38+
git commit -m " "
39+
git push heroku master
40+
heroku open
41+
```

webapp/grnapp/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .app import app

webapp/grnapp/app.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from flask import Flask, render_template, request
2+
from gitlab_release_notes import generate_release_notes
3+
4+
app = Flask(__name__)
5+
6+
@app.route('/')
7+
def my_form():
8+
return render_template('form.html')
9+
10+
11+
@app.route('/', methods=['POST'])
12+
def release_notes():
13+
project_id = request.form['project_id']
14+
url = request.form['url']
15+
private_token = request.form['private_token']
16+
17+
changelog = generate_release_notes(project_id, url=url, private_token=private_token)
18+
19+
return changelog
20+
21+
22+
if __name__ == '__main__':
23+
app.run(debug=False)

0 commit comments

Comments
 (0)