Skip to content

Commit

Permalink
*: Add deploy script (#196)
Browse files Browse the repository at this point in the history
Signed-off-by: Ce Gao <ce.gao@outlook.com>
  • Loading branch information
gaocegege authored Aug 3, 2017
1 parent 8b1833d commit 5a0c982
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
9 changes: 9 additions & 0 deletions resources/RLangMode.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = R Language Mode
authorList = [Processing.R Authors](https://github.com/gaocegege/Processing.R/blob/master/AUTHORS.md)
url = https://github.com/gaocegege/Processing.R
sentence = Processing in R Language
paragraph =
version = @@mode-version@@
prettyVersion = @@pretty-version@@
maxVersion = 0
minVersion = 260
2 changes: 1 addition & 1 deletion resources/mode.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = R Language Mode
authors = [Processing.R Authors](https://github.com/gaocegege/Processing.R/blob/master/AUTHORS.md)
url = https://github.com/gaocegege/Processing.R
sentence = Processing in R Language
paragraph = Nil
paragraph =
version = @@mode-version@@
prettyVersion = @@pretty-version@@
maxVersion = 0
Expand Down
52 changes: 52 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash

# Usage: deploy.sh <version>

ROOT=$(dirname "${BASH_SOURCE}")/..
numberOfParams=1

# Timestamped log, e.g. log "started to build the binary".
#
# Input:
# $1 Log string.
function log {
echo -e "[`TZ=Asia/Shanghai date`] ${1}"
}

function help {
log "Usage: deploy.sh <version>"
}

function deploy {
if [[ $# -ne ${numberOfParams} ]]; then
log "The number of parameters is $#, which does not match ${FUNCNAME} in ${BASH_SOURCE}."
help
exit 1
fi

cd ${ROOT}

mkdir -p docs
cp resources/RLangMode.txt docs/RLangMode.txt

log "Injecting version into docs/RLangMode.txt"
# Get commit ID.
commitid=$(git log -n1 --format="%h")
version=${1}
date=`date "+%Y/%m/%d %R"`
pretty_version="Version ${version}, commit ${commitid}, built ${date}"

perl -i -pe "s|\@\@mode-version\@\@|${version}|g" docs/RLangMode.txt
perl -i -pe "s|\@\@pretty-version\@\@|${pretty_version}|g" docs/RLangMode.txt

scripts/generate-ant-file.sh.backup
ant package
cd dist/
zip -r RLangMode.zip RLangMode/
cd - > /dev/null
mv dist/RLangMode.zip docs/

cd - > /dev/null
}

deploy $*

0 comments on commit 5a0c982

Please # to comment.