-
Notifications
You must be signed in to change notification settings - Fork 5
/
.env
181 lines (140 loc) · 3.89 KB
/
.env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/bin/bash
OPEN_PROJECT_NAME="hug_website"
if [ "$PROJECT_NAME" = "$OPEN_PROJECT_NAME" ]; then
return
fi
if [ ! -f ".env" ]; then
return
fi
export PROJECT_NAME=$OPEN_PROJECT_NAME
export PROJECT_DIR="$PWD"
if [ ! -d "venv" ]; then
if ! hash pyvenv 2>/dev/null; then
function pyvenv()
{
if hash pyvenv-3.6 2>/dev/null; then
pyvenv-3.6 $@
elif hash pyvenv-3.5 2>/dev/null; then
pyvenv-3.5 $@
elif hash pyvenv-3.4 2>/dev/null; then
pyvenv-3.4 $@
elif hash pyvenv-3.3 2>/dev/null; then
pyvenv-3.3 $@
elif hash pyvenv-3.2 2>/dev/null; then
pyvenv-3.2 $@
else
python3 -m venv $@
fi
}
fi
echo "Making venv for $PROJECT_NAME"
pyvenv venv
. venv/bin/activate
pip install -r requirements/development.txt
python setup.py install
fi
. venv/bin/activate
# Let's make sure this is a hubflow enabled repo
yes | git hf init >/dev/null 2>/dev/null
# Quick directory switching
alias root="cd $PROJECT_DIR"
alias project="root; cd $PROJECT_NAME"
alias tests="root; cd tests"
alias requirements="root; cd requirements"
alias test="_test"
function open {
(root
$CODE_EDITOR $PROJECT_NAME/*.py setup.py tests/*.py README.md tox.ini .gitignore CHANGELOG.md setup.cfg .editorconfig .env .coveragerc .travis.yml)
}
function clean {
(root
isort $PROJECT_NAME/*.py setup.py tests/*.py)
}
function check {
(root
frosted $PROJECT_NAME/*.py)
}
function _test {
(root
tox)
}
function coverage {
(root
$BROWSER htmlcov/index.html)
}
function load {
(root
python setup.py install)
}
function unload {
(root
pip uninstall $PROJECT_NAME)
}
function install {
(root
sudo python setup.py install)
}
function run {
(root
load
pull_latest
compile
hug -m hug_website.app)
}
function update {
(root
pip install -r requirements/development.txt -U)
}
function static()
{
project
cd static
}
function compile()
{
(static
compass compile
cd jiphy
jiphy *.py -od ../scripts/)
}
function pull_latest()
{
(project
wget -qO- https://raw.githubusercontent.com/hugapi/hug/develop/CONTRIBUTING.md | markdown_py -x codehilite > views/contribute.html
wget -qO- https://raw.githubusercontent.com/hugapi/hug/develop/ACKNOWLEDGEMENTS.md | markdown_py -x codehilite > views/acknowledge.html
wget -qO- https://raw.githubusercontent.com/hugapi/hug/develop/ARCHITECTURE.md | markdown_py -x codehilite > views/architecture.html
wget -qO- https://raw.githubusercontent.com/hugapi/hug/develop/EXTENDING.md | markdown_py -x codehilite > views/extending.html
wget -qO- https://raw.githubusercontent.com/hugapi/hug/develop/documentation/ROUTING.md | markdown_py -x codehilite > views/routing.html
wget -qO- https://raw.githubusercontent.com/hugapi/hug/develop/documentation/TYPE_ANNOTATIONS.md | markdown_py -x codehilite > views/type_annotation.html
wget -qO- https://raw.githubusercontent.com/hugapi/hug/develop/documentation/DIRECTIVES.md | markdown_py -x codehilite > views/directives.html
wget -qO- https://raw.githubusercontent.com/hugapi/hug/develop/documentation/OUTPUT_FORMATS.md | markdown_py -x codehilite > views/output_formats.html)
}
function distribute {
(root
python setup.py sdist upload)
}
function leave {
export PROJECT_NAME=""
export PROJECT_DIR=""
unalias root
unalias project
unalias tests
unalias requirements
unalias test
unset -f _start
unset -f _end
unset -f open
unset -f clean
unset -f _test
unset -f coverage
unset -f load
unset -f unload
unset -f install
unset -f run
unset -f update
unset -f distribute
unset -f static
unset -f compile
unset -f leave
deactivate
}