This repository has been archived by the owner on May 9, 2022. It is now read-only.
forked from nilliams/jekyll.exe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.sh
93 lines (65 loc) · 1.77 KB
/
test.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
87
88
89
90
91
92
93
#!/bin/bash
# this script tests a couple of basic jekyll subcommands and checks the exit
# codes. the serve subcommand is a little more difficult, as i do not know any
# reliable way to check the running process.
CURRENT_DIR=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
cd "$CURRENT_DIR"
function trigger_error () {
echo "<!> Test failed!"
exit 1
}
# ========================================
echo '> Testing jekyll presence'
if [[ ! -f ./jekyll.exe ]]; then
trigger_error
fi
# ========================================
echo '> Testing jekyll default response ("A subcommand is required.")'
output="$(./jekyll.exe 2>&1 > /dev/null)"
if [[ ! ( $? -eq 1 && "$output" == *"A subcommand is required."* ) ]]; then
trigger_error
fi
# ========================================
echo '> Testing jekyll help'
./jekyll.exe help
if [[ ! $? -eq 0 ]]; then
trigger_error
fi
# ========================================
echo '> Testing jekyll new'
folder_name="jekyll-new-folder"
rm -rf "$folder_name"
mkdir "$folder_name"
./jekyll.exe new "$folder_name"
# if [[ ! $? -eq 0 ]]; then
# trigger_error
# fi
# ========================================
echo '> Testing jekyll build, b'
cd "$folder_name"
rm Gemfile
../jekyll.exe build
if [[ ! $? -eq 0 ]]; then
trigger_error
fi
cd ..
# ========================================
echo '> Testing jekyll clean'
cd "$folder_name"
../jekyll.exe clean
if [[ ! $? -eq 0 ]]; then
trigger_error
fi
cd ..
# ========================================
echo '> Testing jekyll doctor, hyde'
cd "$folder_name"
echo "url: http://example.com" >> _config.yml
../jekyll.exe hyde
if [[ ! $? -eq 0 ]]; then
trigger_error
fi
cd ..
# ========================================
echo "> Test all OK"
printf "\n> Please test jekyll serve manually with the \"$folder_name\" folder."