Skip to content

Commit

Permalink
Added support to install a specific nightly.
Browse files Browse the repository at this point in the history
  • Loading branch information
dragos committed Mar 30, 2012
1 parent a84e1be commit d793b4d
Showing 1 changed file with 82 additions and 15 deletions.
97 changes: 82 additions & 15 deletions eclipse-director.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,101 @@ function usage()
`basename $0` [opt] command [pluginid]
Options:
--eclipse-dir <path> Path to the Eclipse installation that you want to modify
--eclipse-dir <path> Path to the Eclipse installation that you want to modify
--branch <branch> What branch to use? (e.g. master or 2-0-x)
--branch <branch> What branch to use? (e.g. 'master' or '2-0-x')
Commands:
list List available plugins. (useless right now, as it uses the Eclipse repo).
list List available plugins. (useless right now, as it uses the Eclipse repo).
install <id> Install plugin. It is the version number of the Scala installation
For instance: 2.9.1.final or trunk
install <version> Install plugin. It is the version number of the Scala installation
For instance: 2.9.2-SNAPSHOT or trunk
install-local <path> Install from a local update site given by <path>
install <version>/YYYYMMDD Install the nightly for the given date. <version> is one of 'trunk' or
'2.9.2-SNAPSHOT'
uninstall Uninstall the currently installed Scala plugin
install-local <path> Install from a local update site given by <path>
install-bundle <id> Install the given bundle
uninstall Uninstall the currently installed Scala plugin
uninstall-bundle <id> Uninstall the given bundle
install-bundle <id> Install the given bundle
help Print this help screen
uninstall-bundle <id> Uninstall the given bundle
help Print this help screen
EOF
exit 1
}

#
# match the build dir name in the dir listing HTML response
#
build_dir_regex='s/.*<a href=\"\(.*\)\">.*/\1/'

#
# $1 - repo_base
# $2 - repo_date
#
function find_latest_build()
{
matches=`curl -s "$1/" | grep $2 | sed "${build_dir_regex}"`

arr_match=(${matches})
len=${#arr_match[@]}

if [[ len -eq 0 ]]; then
echo "No repository found for $repo_date, probably no nightlies were pushed on that date."
echo "Other nightlies on the same month (${2:0:6}):"
curl -s "$1/" | grep ${2:0:6} | sed "${build_dir_regex}"
exit 1
fi

echo "found nightly on ${arr_match[len - 1]}"
update_site="$1/${arr_match[len - 1]}/org.scala-ide.sdt.update-site"
}

#
# $1 - specification: trunk or trunk/YYYYMMDD (date)
# similarly, 2.9.2-SNAPSHOT or 2.9.2-SNAPSHOT/YYYYMMDD
#
function install()
{
case $1 in
trunk )
update_site="$scala_repo-$branch-trunk"
;;

trunk/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] )
echo "Looking for a specific nightly.."
repo_date=`echo $1 | cut -d \/ -f 2`
find_latest_build "http://download.scala-ide.org/builds/nightly-$branch-trunk" $repo_date
;;

2.9.2-SNAPSHOT )
update_site="$scala_repo-$branch-trunk"
;;

2.9.2-SNAPSHOT/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] )
repo_date=`echo $1 | cut -d \/ -f 2`
find_latest_build "http://download.scala-ide.org/builds/nightly-$branch-2.9.2-SNAPSHOT" $repo_date
;;

* )
echo -e "Not understood: $1.\n"
usage
;;
esac

echo "Installing from $update_site.."
$eclipse_dir/eclipse $eclipse_opt \
-application $app \
-repository $update_site/ \
-installIU org.scala-ide.sdt.feature.feature.group

}


while [ $# -gt 0 ]; do

case $1 in
Expand Down Expand Up @@ -66,11 +137,7 @@ while [ $# -gt 0 ]; do
;;

"install")
echo "Installing $2.."
$eclipse_dir/eclipse $eclipse_opt \
-application $app \
-repository "$scala_repo-$branch-$2" \
-installIU org.scala-ide.sdt.feature.feature.group
install $2
shift 2
;;

Expand Down

0 comments on commit d793b4d

Please sign in to comment.