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 | from flask import Flask, url_for, render_template, request, Response, make_response | 1 | from flask import Flask, url_for, render_template, request, Response, make_response |
2 | import hashlib,webbrowser | 2 | import hashlib,webbrowser |
3 | +from sys import argv | ||
3 | app = Flask(__name__) | 4 | app = Flask(__name__) |
4 | 5 | ||
5 | @app.route('/') | 6 | @app.route('/') |
@@ -14,7 +15,7 @@ def pagina_teste(): | @@ -14,7 +15,7 @@ def pagina_teste(): | ||
14 | return make_response("<h1>403 Forbidden</h1>", 403) | 15 | return make_response("<h1>403 Forbidden</h1>", 403) |
15 | 16 | ||
16 | @app.route('/barra.js') | 17 | @app.route('/barra.js') |
17 | -def barra(profile='copa2014'): | 18 | +def barra(): |
18 | with app.open_resource('templates/%s/barra-brasil.js' % profile) as f: | 19 | with app.open_resource('templates/%s/barra-brasil.js' % profile) as f: |
19 | conteudo = f.read().decode('utf-8') | 20 | conteudo = f.read().decode('utf-8') |
20 | etag = hashlib.sha1(conteudo.encode('utf-8')).hexdigest() | 21 | etag = hashlib.sha1(conteudo.encode('utf-8')).hexdigest() |
@@ -36,3 +37,4 @@ if __name__ == '__main__': | @@ -36,3 +37,4 @@ if __name__ == '__main__': | ||
36 | profile = 'default' | 37 | profile = 'default' |
37 | webbrowser.open("http://127.0.0.1:5000/",new=2) | 38 | webbrowser.open("http://127.0.0.1:5000/",new=2) |
38 | app.run(debug=False) | 39 | app.run(debug=False) |
40 | + |
build.sh
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | echo "" | 2 | echo "" |
3 | -if [ -n "$1" ] && test -d "recipes/$1" | 3 | +if [ -n "$1" ] |
4 | then | 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 | sh ./compile.sh | 13 | sh ./compile.sh |
7 | - python ../../app/barrabrasil.py $1 | 14 | + python ../../app/barrabrasil.py $profile |
8 | else | 15 | else |
9 | echo "Error. Profile $1 does not exist." | 16 | echo "Error. Profile $1 does not exist." |
10 | fi | 17 | fi |