Skip to content

Commit 5a0c982

Browse files
authored
*: Add deploy script (#196)
Signed-off-by: Ce Gao <ce.gao@outlook.com>
1 parent 8b1833d commit 5a0c982

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

resources/RLangMode.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name = R Language Mode
2+
authorList = [Processing.R Authors](https://github.com/gaocegege/Processing.R/blob/master/AUTHORS.md)
3+
url = https://github.com/gaocegege/Processing.R
4+
sentence = Processing in R Language
5+
paragraph =
6+
version = @@mode-version@@
7+
prettyVersion = @@pretty-version@@
8+
maxVersion = 0
9+
minVersion = 260

resources/mode.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = R Language Mode
22
authors = [Processing.R Authors](https://github.com/gaocegege/Processing.R/blob/master/AUTHORS.md)
33
url = https://github.com/gaocegege/Processing.R
44
sentence = Processing in R Language
5-
paragraph = Nil
5+
paragraph =
66
version = @@mode-version@@
77
prettyVersion = @@pretty-version@@
88
maxVersion = 0

scripts/deploy.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
3+
# Usage: deploy.sh <version>
4+
5+
ROOT=$(dirname "${BASH_SOURCE}")/..
6+
numberOfParams=1
7+
8+
# Timestamped log, e.g. log "started to build the binary".
9+
#
10+
# Input:
11+
# $1 Log string.
12+
function log {
13+
echo -e "[`TZ=Asia/Shanghai date`] ${1}"
14+
}
15+
16+
function help {
17+
log "Usage: deploy.sh <version>"
18+
}
19+
20+
function deploy {
21+
if [[ $# -ne ${numberOfParams} ]]; then
22+
log "The number of parameters is $#, which does not match ${FUNCNAME} in ${BASH_SOURCE}."
23+
help
24+
exit 1
25+
fi
26+
27+
cd ${ROOT}
28+
29+
mkdir -p docs
30+
cp resources/RLangMode.txt docs/RLangMode.txt
31+
32+
log "Injecting version into docs/RLangMode.txt"
33+
# Get commit ID.
34+
commitid=$(git log -n1 --format="%h")
35+
version=${1}
36+
date=`date "+%Y/%m/%d %R"`
37+
pretty_version="Version ${version}, commit ${commitid}, built ${date}"
38+
39+
perl -i -pe "s|\@\@mode-version\@\@|${version}|g" docs/RLangMode.txt
40+
perl -i -pe "s|\@\@pretty-version\@\@|${pretty_version}|g" docs/RLangMode.txt
41+
42+
scripts/generate-ant-file.sh.backup
43+
ant package
44+
cd dist/
45+
zip -r RLangMode.zip RLangMode/
46+
cd - > /dev/null
47+
mv dist/RLangMode.zip docs/
48+
49+
cd - > /dev/null
50+
}
51+
52+
deploy $*

0 commit comments

Comments
 (0)