forked from simkimsia/UtilityBehaviors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
validate.sh
65 lines (54 loc) · 1.32 KB
/
validate.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
#!/bin/bash
if [ ! -z "${PLUGIN_PATH}" ]; then
cd $PLUGIN_PATH
fi
success=true
if [ ! -f "CONTRIBUTING.markdown" -a ! -f "CONTRIBUTING.md" ]; then
echo "Missing CONTRIBUTING.markdown"
success=false
fi
if [ ! -f "LICENSE.txt" ]; then
echo "Missing LICENSE.txt"
success=false
fi
if [ ! -f "README.markdown" -a ! -f "README.md" ]; then
echo "Missing README.markdown"
success=false
fi
if [ ! -f ".editorconfig" ]; then
echo "Missing .editorconfig"
success=false
fi
if [ ! -f ".semver" ]; then
echo "Missing .semver"
success=false
fi
if [ ! -f ".travis.yml" ]; then
echo "Missing .travis.yml"
success=false
else
if ! grep -q PLUGIN_NAME ".travis.yml"; then
echo "Missing PLUGIN_NAME global environment variable in yml file"
success=false
elif grep -q PLUGIN_NAME=ExamplePlugin ".travis.yml"; then
echo "PLUGIN_NAME should be set to your plugin's name, not ExamplePlugin"
success=false
fi
fi
composer -q validate || {
echo 'Invalid composer.json file'
success=false
}
if [ -z "${PLUGIN_NAME}" ]; then
echo "Please set PLUGIN_NAME environment variable to your plugin's CakePHP name"
success=false
elif [ ! -f "Test/Case/All${PLUGIN_NAME}Test.php" ]; then
echo "Missing Test/Case/All${PLUGIN_NAME}Test.php"
success=false
fi
if $success; then
echo "Valid FOC plugin"
exit 0
else
exit 1
fi