Commit b8bb88c8cb065ac3e5b0a63aaa1992e11e5d50f3
1 parent
ead32c1f
Exists in
master
build.sh: Chamando o build para o default se nenhum profile ? especificado. barr…
…abrasil.py: agora chama o profile conforme parametro passado.
Showing
2 changed files
with
13 additions
and
4 deletions
Show diff stats
app/barrabrasil.py
1 | 1 | from flask import Flask, url_for, render_template, request, Response, make_response |
2 | 2 | import hashlib,webbrowser |
3 | +from sys import argv | |
3 | 4 | app = Flask(__name__) |
4 | 5 | |
5 | 6 | @app.route('/') |
... | ... | @@ -14,7 +15,7 @@ def pagina_teste(): |
14 | 15 | return make_response("<h1>403 Forbidden</h1>", 403) |
15 | 16 | |
16 | 17 | @app.route('/barra.js') |
17 | -def barra(profile='copa2014'): | |
18 | +def barra(): | |
18 | 19 | with app.open_resource('templates/%s/barra-brasil.js' % profile) as f: |
19 | 20 | conteudo = f.read().decode('utf-8') |
20 | 21 | etag = hashlib.sha1(conteudo.encode('utf-8')).hexdigest() |
... | ... | @@ -36,3 +37,4 @@ if __name__ == '__main__': |
36 | 37 | profile = 'default' |
37 | 38 | webbrowser.open("http://127.0.0.1:5000/",new=2) |
38 | 39 | app.run(debug=False) |
40 | + | ... | ... |
build.sh
1 | 1 | #!/bin/sh |
2 | 2 | echo "" |
3 | -if [ -n "$1" ] && test -d "recipes/$1" | |
3 | +if [ -n "$1" ] | |
4 | 4 | then |
5 | - cd recipes/$1 | |
5 | + profile=$1 | |
6 | +else | |
7 | + profile='default' | |
8 | +fi | |
9 | + | |
10 | +if test -d "recipes/$1" | |
11 | +then | |
12 | + cd recipes/$profile | |
6 | 13 | sh ./compile.sh |
7 | - python ../../app/barrabrasil.py $1 | |
14 | + python ../../app/barrabrasil.py $profile | |
8 | 15 | else |
9 | 16 | echo "Error. Profile $1 does not exist." |
10 | 17 | fi | ... | ... |