forked from PyGithub/PyGithub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.sh
executable file
·86 lines (71 loc) · 1.97 KB
/
manage.sh
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
#!/bin/bash
# -*- coding: utf-8 -*-
function publish {
# check
# test
bump
readme
doc
push
}
function check {
pep8 --ignore=E501 github setup.py || exit
}
function check_copyright {
for file in $(git ls-files | grep "py$")
do
git log "--format=format:# Copyright %ad %an %ae" --date=short -- $file |
sed "s/\([0-9][0-9][0-9][0-9]\)-[0-9][0-9]-[0-9][0-9]/\1/g" | sort -u |
while read copyright
do
if grep -n $file -e "^$copyright$" > /dev/null
then
echo > /dev/null
else
echo "$file should contain '$copyright'"
fi
done
done
}
function test {
python3 setup.py test --quiet || exit
coverage run --branch --include=github/*.py --omit=github/tests/*.py setup.py test --quiet || exit
coverage report --show-missing || exit
}
function bump {
previousVersion=$( grep '^version =' setup.py | sed 's/version = \"\(.*\)\"/\1/' )
echo "Next version number? (previous: '$previousVersion')"
read version
sed -i -b "s/version = .*/version = \"$version\"/" setup.py
}
function readme {
git log v$previousVersion.. --oneline
echo "Edit README.rst and doc/changes.rst now, then press enter"
read foobar
}
function doc {
rm -rf doc/build
mkdir doc/build
cd doc/build
git init
sphinx-build -b html -d doctrees .. . || exit
touch .nojekyll
echo /doctrees/ > .gitignore
git add . || exit
git commit --message "Automatic generation" || exit
git push --force ../.. HEAD:gh-pages || exit
cd ../..
}
function push {
echo "Break (Ctrl+c) here if something is wrong. Else, press enter"
read foobar
git commit -am "Publish version $version"
cp COPYING* github
python setup.py sdist upload
rm -rf github/COPYING*
git tag -m "Version $version" v$version
git push github master master:develop
git push --force github gh-pages
git push --tags
}
$1