-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcreateSkeletonPack.sh
executable file
·96 lines (70 loc) · 2.45 KB
/
createSkeletonPack.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
94
95
96
#!/bin/bash
#Creates the skeleton directory structure for a new content pack including creating
#root README and CHANGELOG files
SOURCE_DIR=./source
if [ "$#" -eq 0 ]; then
echo "Usage: $0 new-content-pack-name" >&2
echo "E.g: $0 my-new-content-pack" >&2
echo "Existing content packs" >&2
ls -1 -d ./source/* | sed 's#\./source/# #'
exit 1
fi
contentPackName=$1
if [ -e "${SOURCE_DIR}/${contentPackName}" ]; then
echo "Content pack [${contentPackName}] already exists, exiting!" >&2
exit 1
fi
contentPackDir="${SOURCE_DIR}/${contentPackName}"
docsDir="$contentPackDir/docs"
clientDir="$contentPackDir/clientArtefacts"
stroomContentDir="$contentPackDir/stroomContent"
changeLogFile="${contentPackDir}/CHANGELOG.md"
rootReadmeFile="${contentPackDir}/README.md"
buildFile="${contentPackDir}/build.gradle"
makeDir() {
[ "$#" -eq 0 ] && echo "Expecting dir as an arg" && exit 1
dir=$1
echo "Creating directory $dir"
mkdir $dir
touch $dir/.gitkeep
}
echo "Creating content pack $contentPackName..."
echo ""
makeDir "$contentPackDir"
makeDir "$docsDir"
makeDir "$clientDir"
makeDir "$stroomContentDir"
echo "Creating README file $rootReadmeFile"
cat >$rootReadmeFile <<EOL
# _${contentPackName}_ Content Pack
EOL
echo "Creating CHANGELOG file $changeLogFile"
cat >$changeLogFile <<EOL
# Change Log
All notable changes to this content pack will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
### Changed
### Removed
## [${contentPackName}-v1.0]
Initial version.
[Unreleased]: https://github.com/gchq/stroom-content/compare/${contentPackName}-v1.0...HEAD
[${contentPackName}-v1.0]: https://github.com/gchq/stroom-content/compare/${contentPackName}-v1.0...${contentPackName}-v1.0
EOL
echo "Creating Gradle build file $buildFile"
cat >$buildFile <<EOL
//${contentPackName}
//example of how to configure dependencies on another content packs
//dependencies {
// compileSource project(path: ':one-content-pack', configuration: 'distConfig')
// compileSource project(path: ':another-content-pack', configuration: 'distConfig')
//}
EOL
echo ""
echo "TIP: Use the linux binary 'uuidgen' to generatethe UUIDs required in the content pack's XML files."
echo ""
echo "TIP: Run the script createNewStroomFolder.sh from any directory to create a new Stroom Folder in that directory."
echo ""
echo "Done"