-
Notifications
You must be signed in to change notification settings - Fork 0
/
.env
189 lines (142 loc) · 3.21 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
182
183
184
185
186
187
188
189
#!/bin/bash
OPEN_PROJECT_NAME="hug"
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"
export PROJECT_VERSION="2.4.1"
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 examples="root; cd examples"
alias requirements="root; cd requirements"
alias test="_test"
function open {
(root
$CODE_EDITOR hug/*.py setup.py tests/*.py examples/*.py examples/*/*.py README.md tox.ini .gitignore CHANGELOG.md setup.cfg .editorconfig .env .coveragerc .travis.yml requirements/*.txt)
}
function clean {
(root
isort hug/*.py setup.py tests/*.py)
}
function check {
(root
frosted hug/*.py)
}
function _test {
(root
tox)
}
function coverage {
(root
$BROWSER htmlcov/index.html)
}
function load {
(root
python setup.py install)
}
function unload {
(root
pip uninstall hug)
}
function install {
(root
sudo python setup.py install)
}
function update {
(root
pip install -r requirements/development.txt -U)
}
function distribute {
(root
pip install pypandoc
python -c "import pypandoc; pypandoc.convert('README.md', 'rst')" || exit 1
python setup.py sdist upload)
}
function version()
{
echo $PROJECT_VERSION
}
function new_version()
{
(root
if [ -z "$1" ]; then
echo "You must supply a new version to replace the old version with"
return
fi
sed -i "s/$PROJECT_VERSION/$1/" .env setup.py hug/_version.py)
export PROJECT_VERSION=$1
}
function new_version_patch()
{
(root
bumpversion --allow-dirty patch)
}
function new_version_minor()
{
(root
bumpversion --allow-dirty minor)
}
function new_version_major()
{
(root
bumpversion --allow-dirty major)
}
function leave {
export PROJECT_NAME=""
export PROJECT_DIR=""
unalias root
unalias project
unalias tests
unalias examples
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 update
unset -f distribute
unset -f version
unset -f new_version
unset -f leave
deactivate
}