Skip to content
Newer
Older
100755 70 lines (61 sloc) 2.24 KB
3e17890 1.1 branch is now trunk
graeme authored Mar 13, 2009
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 * Gant script that handles the installation of Grails plugins
835947f @burtbeckwith cleanup
burtbeckwith authored Jun 22, 2010
19 *
3e17890 1.1 branch is now trunk
graeme authored Mar 13, 2009
20 * @author Graeme Rocher
21 * @author Sergey Nebolsin
22 *
23 * @since 0.4
24 */
25 includeTargets << grailsScript("_GrailsPlugins")
26
67726ba @graemerocher Improve performance of script load times, package static resources as…
graemerocher authored Nov 26, 2010
27 target(installPlugin:"Installs a plug-in for the given URL or name and version") {
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored May 27, 2011
28 depends(checkVersion, parseArguments, configureProxy)
29 try {
30 def pluginArgs = argsMap['params']
67726ba @graemerocher Improve performance of script load times, package static resources as…
graemerocher authored Nov 26, 2010
31
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored May 27, 2011
32 // fix for Windows-style path with backslashes
67726ba @graemerocher Improve performance of script load times, package static resources as…
graemerocher authored Nov 26, 2010
33
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored May 27, 2011
34 if (pluginArgs) {
35 if (argsMap['global']) {
36 globalInstall = true
37 }
67726ba @graemerocher Improve performance of script load times, package static resources as…
graemerocher authored Nov 26, 2010
38
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored May 27, 2011
39 ant.mkdir(dir:pluginsBase)
67726ba @graemerocher Improve performance of script load times, package static resources as…
graemerocher authored Nov 26, 2010
40
1841c7a @burtbeckwith GRAILS-7709 removed incorrect metadata update and fixed final message…
burtbeckwith authored Jul 3, 2011
41 boolean installed
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored May 27, 2011
42 def pluginFile = new File(pluginArgs[0])
43 def urlPattern = ~"^[a-zA-Z][a-zA-Z0-9\\-\\.\\+]*://"
44 if (pluginArgs[0] =~ urlPattern) {
45 def url = new URL(pluginArgs[0])
1841c7a @burtbeckwith GRAILS-7709 removed incorrect metadata update and fixed final message…
burtbeckwith authored Jul 3, 2011
46 installed = doInstallPluginFromURL(url)
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored May 27, 2011
47 }
48 else if (pluginFile.exists() && pluginFile.name.startsWith("grails-") && pluginFile.name.endsWith(".zip")) {
1841c7a @burtbeckwith GRAILS-7709 removed incorrect metadata update and fixed final message…
burtbeckwith authored Jul 3, 2011
49 installed = doInstallPluginZip(pluginFile)
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored May 27, 2011
50 }
51 else {
52 // The first argument is the plugin name, the second
53 // (if provided) is the plugin version.
1841c7a @burtbeckwith GRAILS-7709 removed incorrect metadata update and fixed final message…
burtbeckwith authored Jul 3, 2011
54 installed = doInstallPlugin(pluginArgs[0], pluginArgs[1])
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored May 27, 2011
55 }
f985775 @graemerocher shorter output for downloading jars and poms
graemerocher authored Jun 3, 2011
56
1841c7a @burtbeckwith GRAILS-7709 removed incorrect metadata update and fixed final message…
burtbeckwith authored Jul 3, 2011
57 event("StatusFinal", [installed ? "Plugin installed." : 'Plugin not installed.'])
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored May 27, 2011
58 }
59 else {
60 event("StatusError", [ ERROR_MESSAGE])
61 }
62 }
63 catch(Exception e) {
64 logError("Error installing plugin: ${e.message}", e)
65 exit(1)
66 }
67726ba @graemerocher Improve performance of script load times, package static resources as…
graemerocher authored Nov 26, 2010
67 }
68
3e17890 1.1 branch is now trunk
graeme authored Mar 13, 2009
69 setDefaultTarget("installPlugin")
Something went wrong with that request. Please try again.