Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 176 lines (138 sloc) 4.703 kb
93537d2 @dragos Added eclipse director script, for easy command-line
dragos authored
1 #!/bin/bash
2
3 eclipse_dir="/Applications/Programming/eclipse-helios/"
4 eclipse_opt="-nosplash -consoleLog"
5 app="org.eclipse.equinox.p2.director"
6
7 eclipse_repo="http://download.eclipse.org/releases/helios/"
8 branch="master"
9 scala_repo="http://scala-ide.dreamhosters.com/nightly-update"
10
11 function usage()
12 {
13 cat <<EOF
14 `basename $0` [opt] command [pluginid]
15
16 Options:
d793b4d @dragos Added support to install a specific nightly.
dragos authored
17 --eclipse-dir <path> Path to the Eclipse installation that you want to modify
93537d2 @dragos Added eclipse director script, for easy command-line
dragos authored
18
d793b4d @dragos Added support to install a specific nightly.
dragos authored
19 --branch <branch> What branch to use? (e.g. 'master' or '2-0-x')
c946e0e @dragos Updated the director script with an option to install from an update sit...
dragos authored
20
93537d2 @dragos Added eclipse director script, for easy command-line
dragos authored
21 Commands:
d793b4d @dragos Added support to install a specific nightly.
dragos authored
22 list List available plugins. (useless right now, as it uses the Eclipse repo).
93537d2 @dragos Added eclipse director script, for easy command-line
dragos authored
23
d793b4d @dragos Added support to install a specific nightly.
dragos authored
24 install <version> Install plugin. It is the version number of the Scala installation
a8d0572 @dragos Updated install script for 2.9.x compatibility.
dragos authored
25 For instance: 2.9.x or trunk
93537d2 @dragos Added eclipse director script, for easy command-line
dragos authored
26
d793b4d @dragos Added support to install a specific nightly.
dragos authored
27 install <version>/YYYYMMDD Install the nightly for the given date. <version> is one of 'trunk' or
a8d0572 @dragos Updated install script for 2.9.x compatibility.
dragos authored
28 '2.9.x'
c946e0e @dragos Updated the director script with an option to install from an update sit...
dragos authored
29
d793b4d @dragos Added support to install a specific nightly.
dragos authored
30 install-local <path> Install from a local update site given by <path>
93537d2 @dragos Added eclipse director script, for easy command-line
dragos authored
31
d793b4d @dragos Added support to install a specific nightly.
dragos authored
32 uninstall Uninstall the currently installed Scala plugin
c946e0e @dragos Updated the director script with an option to install from an update sit...
dragos authored
33
d793b4d @dragos Added support to install a specific nightly.
dragos authored
34 install-bundle <id> Install the given bundle
93537d2 @dragos Added eclipse director script, for easy command-line
dragos authored
35
d793b4d @dragos Added support to install a specific nightly.
dragos authored
36 uninstall-bundle <id> Uninstall the given bundle
37
38 help Print this help screen
93537d2 @dragos Added eclipse director script, for easy command-line
dragos authored
39
40 EOF
41 exit 1
42 }
43
d793b4d @dragos Added support to install a specific nightly.
dragos authored
44 #
45 # match the build dir name in the dir listing HTML response
46 #
47 build_dir_regex='s/.*<a href=\"\(.*\)\">.*/\1/'
48
49 #
50 # $1 - repo_base
51 # $2 - repo_date
52 #
53 function find_latest_build()
54 {
55 matches=`curl -s "$1/" | grep $2 | sed "${build_dir_regex}"`
56
57 arr_match=(${matches})
58 len=${#arr_match[@]}
59
60 if [[ len -eq 0 ]]; then
61 echo "No repository found for $repo_date, probably no nightlies were pushed on that date."
62 echo "Other nightlies on the same month (${2:0:6}):"
63 curl -s "$1/" | grep ${2:0:6} | sed "${build_dir_regex}"
64 exit 1
65 fi
66
67 echo "found nightly on ${arr_match[len - 1]}"
68 update_site="$1/${arr_match[len - 1]}/org.scala-ide.sdt.update-site"
69 }
70
71 #
72 # $1 - specification: trunk or trunk/YYYYMMDD (date)
73 # similarly, 2.9.2-SNAPSHOT or 2.9.2-SNAPSHOT/YYYYMMDD
74 #
75 function install()
76 {
77 case $1 in
78 trunk )
79 update_site="$scala_repo-$branch-trunk"
80 ;;
81
82 trunk/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] )
83 echo "Looking for a specific nightly.."
84 repo_date=`echo $1 | cut -d \/ -f 2`
85 find_latest_build "http://download.scala-ide.org/builds/nightly-$branch-trunk" $repo_date
86 ;;
87
a8d0572 @dragos Updated install script for 2.9.x compatibility.
dragos authored
88 2.9.x )
89 update_site="$scala_repo-$branch-29x"
d793b4d @dragos Added support to install a specific nightly.
dragos authored
90 ;;
91
a8d0572 @dragos Updated install script for 2.9.x compatibility.
dragos authored
92 2.9.x/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] )
d793b4d @dragos Added support to install a specific nightly.
dragos authored
93 repo_date=`echo $1 | cut -d \/ -f 2`
a8d0572 @dragos Updated install script for 2.9.x compatibility.
dragos authored
94 find_latest_build "http://download.scala-ide.org/builds/nightly-$branch-29x" $repo_date
d793b4d @dragos Added support to install a specific nightly.
dragos authored
95 ;;
96
97 * )
98 echo -e "Not understood: $1.\n"
99 usage
100 ;;
101 esac
102
103 echo "Installing from $update_site.."
104 $eclipse_dir/eclipse $eclipse_opt \
105 -application $app \
106 -repository $update_site/ \
107 -installIU org.scala-ide.sdt.feature.feature.group
108
109 }
110
111
93537d2 @dragos Added eclipse director script, for easy command-line
dragos authored
112 while [ $# -gt 0 ]; do
113
114 case $1 in
115 "" | "help")
116 usage
117 ;;
118
119 "--eclipse-dir")
120 eclipse_dir=$2
121 echo "Eclipse installation dir is $eclipse_dir"
122 shift 2
123 ;;
124
125 "--branch")
126 branch=$2
127 echo "Eclipse repository is $scala_repo-$branch-?"
128 shift 2
129 ;;
130
131 "list")
132 $eclipse_dir/eclipse $eclipse_opt \
133 -application $app \
134 -repository $eclipse_repo \
135 -list
136 shift
137 ;;
138
139 "install")
d793b4d @dragos Added support to install a specific nightly.
dragos authored
140 install $2
93537d2 @dragos Added eclipse director script, for easy command-line
dragos authored
141 shift 2
142 ;;
143
c946e0e @dragos Updated the director script with an option to install from an update sit...
dragos authored
144 "install-local")
145 echo "Installing $2.."
146 $eclipse_dir/eclipse $eclipse_opt \
147 -application $app \
148 -repository "file://$2" \
149 -installIU org.scala-ide.sdt.feature.feature.group
150 shift 2
151 ;;
152
93537d2 @dragos Added eclipse director script, for easy command-line
dragos authored
153 "uninstall")
154 echo "Unnstalling.."
155 shift 1
156 $eclipse_dir/eclipse $eclipse_opt \
157 -application $app \
158 -repository "$eclipse_repo" \
159 -uninstallIU org.scala-ide.sdt.feature.feature.group
160 ;;
161
162 "uninstall-bundle")
163 echo "Unnstalling.. $2"
164 $eclipse_dir/eclipse $eclipse_opt \
165 -application $app \
166 -repository "$eclipse_repo" \
167 -uninstallIU $2
168 shift 2
169 ;;
170
171 *)
172 usage
173 ;;
174 esac
175 done
Something went wrong with that request. Please try again.