Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 75 lines (65 sloc) 2.568 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 * Gant script that handles the installation of Grails plugins
835947f @burtbeckwith cleanup
burtbeckwith authored
19 *
3e17890 1.1 branch is now trunk
graeme authored
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
27 target(installPlugin:"Installs a plug-in for the given URL or name and version") {
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored
28 depends(checkVersion, parseArguments, configureProxy)
3f10634 @jeffbrown log a warning about install-plugin being deprecated.
jeffbrown authored
29 grailsConsole.warn 'The install-plugin command is deprecated and \
30 may be removed from a future version of Grails. Plugin dependencies should \
31 be expressed in grails-app/conf/BuildConfig.groovy. \
32 See http://grails.org/doc/2.2.x/guide/conf.html#pluginDependencies.'
33
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored
34 try {
35 def pluginArgs = argsMap['params']
67726ba @graemerocher Improve performance of script load times, package static resources as…
graemerocher authored
36
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored
37 // fix for Windows-style path with backslashes
67726ba @graemerocher Improve performance of script load times, package static resources as…
graemerocher authored
38
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored
39 if (pluginArgs) {
40 if (argsMap['global']) {
41 globalInstall = true
42 }
67726ba @graemerocher Improve performance of script load times, package static resources as…
graemerocher authored
43
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored
44 ant.mkdir(dir:pluginsBase)
67726ba @graemerocher Improve performance of script load times, package static resources as…
graemerocher authored
45
1841c7a @burtbeckwith GRAILS-7709 removed incorrect metadata update and fixed final message…
burtbeckwith authored
46 boolean installed
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored
47 def pluginFile = new File(pluginArgs[0])
48 def urlPattern = ~"^[a-zA-Z][a-zA-Z0-9\\-\\.\\+]*://"
49 if (pluginArgs[0] =~ urlPattern) {
50 def url = new URL(pluginArgs[0])
1841c7a @burtbeckwith GRAILS-7709 removed incorrect metadata update and fixed final message…
burtbeckwith authored
51 installed = doInstallPluginFromURL(url)
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored
52 }
53 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
54 installed = doInstallPluginZip(pluginFile)
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored
55 }
56 else {
57 // The first argument is the plugin name, the second
58 // (if provided) is the plugin version.
1841c7a @burtbeckwith GRAILS-7709 removed incorrect metadata update and fixed final message…
burtbeckwith authored
59 installed = doInstallPlugin(pluginArgs[0], pluginArgs[1])
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored
60 }
f985775 @graemerocher shorter output for downloading jars and poms
graemerocher authored
61
1841c7a @burtbeckwith GRAILS-7709 removed incorrect metadata update and fixed final message…
burtbeckwith authored
62 event("StatusFinal", [installed ? "Plugin installed." : 'Plugin not installed.'])
4a69917 @burtbeckwith whitespace, STS warnings, etc.
burtbeckwith authored
63 }
64 else {
65 event("StatusError", [ ERROR_MESSAGE])
66 }
67 }
68 catch(Exception e) {
69 logError("Error installing plugin: ${e.message}", e)
70 exit(1)
71 }
67726ba @graemerocher Improve performance of script load times, package static resources as…
graemerocher authored
72 }
73
3e17890 1.1 branch is now trunk
graeme authored
74 setDefaultTarget("installPlugin")
Something went wrong with that request. Please try again.