Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

*: Add deploy script #196

Merged
merged 1 commit into from
Aug 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 $*