Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 49 lines (43 sloc) 1.871 kB
3e17890 1.1 branch is now trunk
graeme authored
1 /*
2 * Copyright 2004-2005 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /**
18 * Contains a target for configuring an HTTP proxy.
19 *
20 * @author Peter Ledbrook
21 *
22 * @since 1.1
23 */
24
25 target(configureProxy: "The implementation target") {
26 def scriptFile = new File("${userHome}/.grails/scripts/ProxyConfig.groovy")
835947f @burtbeckwith cleanup
burtbeckwith authored
27 if (!scriptFile.exists()) {
28 return
3e17890 1.1 branch is now trunk
graeme authored
29 }
835947f @burtbeckwith cleanup
burtbeckwith authored
30
31 includeTargets << scriptFile.text
32
33 if (!proxyConfig.proxyHost) {
34 return
35 }
36
37 // Let's configure proxy...
38 def proxyHost = proxyConfig.proxyHost
39 def proxyPort = proxyConfig.proxyPort ? proxyConfig.proxyPort : '80'
40 def proxyUser = proxyConfig.proxyUser ? proxyConfig.proxyUser : ''
41 def proxyPassword = proxyConfig.proxyPassword ? proxyConfig.proxyPassword : ''
e3fb07d @burtbeckwith renamed 'console' binding variable to 'grailsConsole' since it confli…
burtbeckwith authored
42 grailsConsole.updateStatus "Configured HTTP proxy: ${proxyHost}:${proxyPort}${proxyConfig.proxyUser ? '(' + proxyUser + ')' : ''}"
835947f @burtbeckwith cleanup
burtbeckwith authored
43 // ... for ant. We can remove this line with ant 1.7.0 as it uses system properties.
44 ant.setproxy(proxyhost: proxyHost, proxyport: proxyPort, proxyuser: proxyUser, proxypassword: proxyPassword)
45 // ... for all other code
46 System.properties.putAll(["http.proxyHost": proxyHost, "http.proxyPort": proxyPort,
47 "http.proxyUserName": proxyUser, "http.proxyPassword": proxyPassword])
3e17890 1.1 branch is now trunk
graeme authored
48 }
Something went wrong with that request. Please try again.