-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathsign-pledge.sh
executable file
·55 lines (37 loc) · 1.34 KB
/
sign-pledge.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
#!/bin/bash
edition=$(git tag -l --points-at HEAD 2>/dev/null)
if [ -z "$edition" ]; then
cat > /dev/stderr <<-EOS
This is not an official edition of The Berneout Pledge! Please visit
https://github.com/berneout/berneout-pledge for the latest edition!
EOS
exit 1
fi
read -p "Enter your GitHub user name, without @: " user
sed --in-place -- "s!{{{PLEDGE}}}!The Berneout Pledge $edition!g" pledge
sed --in-place -- "s!{{{GITHUB_USER_NAME}}}!$user!g" pledge
cat <<EOS
########################################################################
EOS
head -n -3 pledge
cat <<EOS
########################################################################
# To sign the pledge, type your name between slashes like /Casey Yao/. #
# If you don't want to sign, press Control + C to exit. #
########################################################################
EOS
read -p "Signed: " signature
timestamp=$(date --utc --iso-8601=minutes)
sed --in-place -- "s!{{{SIGNATURE}}}!$signature!g" pledge
sed --in-place -- "s!{{{TIMESTAMP}}}!$timestamp!g" pledge
git add pledge
git rm -f sign-pledge.sh
git rm -f sign-pledge.bat
git rm -f README.md
git commit -m "Customize for @$user"
cat <<EOS
You have signed The Berneout Pledge $edition!
Two more steps to go:
1. Create the repository github.com/$user/berneout-pledge.
2. Push this Git repository there.
EOS