Skip to content

Commit 1eafe3d

Browse files
committedFeb 4, 2019
add Gitpod support
1 parent 6013dc0 commit 1eafe3d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
 

Diff for: ‎README.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
Repository for [tupleblog](http://tupleblog.github.io) (in Thai) based on [Jekyll](http://jekyllrb.com/) [HPSTR](https://github.com/mmistakes/hpstr-jekyll-theme) theme.
44

5+
### Write on Gitpod
6+
7+
[Gitpod](https://gitpod.io) is an amazing online IDE especially for GitHub. You can start writing the blog on Gitpod by clicking [here](https://gitpod.io/#https://github.com/tupleblog/tupleblog.github.io) and logging in with your GitHub Authentication.
8+
9+
510
### `tpb` script
611

712
`tpb` script is now live! `tpb.sh` will help you install and serve the site easily. All you need to have is Ruby version >= `2.5.3`.

Diff for: ‎tpb.sh

+16
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,18 @@ installDeps() {
6565
## debug locally
6666
debugLocally() {
6767
local config_file
68+
local fwp_pid
6869
config_file="./_config.yml"
6970

71+
if type gp > /dev/null; then
72+
echo -e ">> Running on Gitpod.. Forwarding port 4000 to 4001 to expose publicly..\n"
73+
74+
gp forward-port 4000 4001 &
75+
76+
# collect pid of forwarding port to kill later
77+
fwp_pid="$!"
78+
fi
79+
7080
# comment url line on start
7181
xsed 's/^(url:.*)/\# \1/' $config_file
7282

@@ -75,6 +85,12 @@ debugLocally() {
7585

7686
# uncomment url line on stop
7787
xsed 's/^#\s*(url: https\:\/\/tupleblog.*)/\1/' $config_file
88+
89+
# if there is forward port, kill it
90+
if [ ! -z "$fwp_pid" ]; then
91+
echo -e "\n>> Killing pid: $fwp_pid.."
92+
kill -9 "$fwp_pid"
93+
fi
7894
}
7995

8096
# ---------------------------

0 commit comments

Comments
 (0)
Please sign in to comment.