-
Notifications
You must be signed in to change notification settings - Fork 6
/
newfeature
executable file
·64 lines (47 loc) · 1.95 KB
/
newfeature
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
#! /bin/sh -e
# check we are a clone or suggest to make us one - finding the toplevel sufficient for now
cd `git rev-parse --show-toplevel`
echo "Trying to update codebase before creating template for new feature..."
# pull from upstream
git pull [email protected]:nexusformat/features.git master || ( echo refresh from upstream git failed >&2 ; exit 1 )
# ask questions:
# email
printf "enter your email address: "
read EMAIL
# feature title
printf "enter a title/tag line for the proposed feature (< 80 chars): "
read TITLE
# request to webservice
# encode proposer & title
# check curl is there
ID=`curl -s --data "proposer=$EMAIL&title=$TITLE" https://hidden-springs-12500.herokuapp.com/ids/\?format=json | python -c "import sys, json; print(json.load(sys.stdin)['id'])"`
if test `echo -n $ID | tr -dc A-F0-9 | wc -c` -ne 16 ; then
echo Something went wrong. We did not get back an id in the expected format \(we saw "$ID"\). Get support! >&1
exit 1
fi
cat << EOF
The ID assigned was $ID - congratulations!
EOF
# create template
DIR=src/recipes/$ID
mkdir -p $DIR || ( echo cannot create directory for new feature >&2 ; exit 1)
cd $DIR
touch __init__.py
sed -e s,@TITLE@,"$TITLE", -e s,@EMAIL@,"$EMAIL", < ../TEMPLATETEMPLATE/recipe.py > recipe.py
cat << EOF
If all went well and you should now be set.
The ID assigned was $ID.
This is a temporary assignment and needs to be confirmed by clicking
the link in the activation email you should have recevied or should
recevie soon.
The ID assignment may be withdrawn if not confirmed within a reasonable
timescale (on the order of months).
Some template code to get you started has been created in $DIR.
Please edit this code and submit a Github pull request against
https://github.com/nexusformat/features when done to get your
code included.
There is no firm time limit for submitting a pull request as
long as your confirmed email address is still reachable.
Have fun. Thank you for supporting NeXus.
EOF
exit 0