Skip to content
Newer
Older
100755 67 lines (59 sloc) 1.83 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") {
28 depends(checkVersion, parseArguments, configureProxy)
29 try {
30 def pluginArgs = argsMap['params']
31
32 // fix for Windows-style path with backslashes
33
34 if (pluginArgs) {
35 if (argsMap['global']) {
36 globalInstall = true
37 }
38
39 ant.mkdir(dir:pluginsBase)
40
41 def pluginFile = new File(pluginArgs[0])
42 def urlPattern = ~"^[a-zA-Z][a-zA-Z0-9\\-\\.\\+]*://"
43 if (pluginArgs[0] =~ urlPattern) {
44 def url = new URL(pluginArgs[0])
45 doInstallPluginFromURL(url)
46 }
47 else if (pluginFile.exists() && pluginFile.name.startsWith("grails-") && pluginFile.name.endsWith(".zip")) {
48 doInstallPluginZip(pluginFile)
49 }
50 else {
51 // The first argument is the plugin name, the second
52 // (if provided) is the plugin version.
53 doInstallPlugin(pluginArgs[0], pluginArgs[1])
54 }
55 }
56 else {
57 event("StatusError", [ ERROR_MESSAGE])
58 }
59 }
60 catch(Exception e) {
61 logError("Error installing plugin: ${e.message}", e)
62 exit(1)
63 }
64 }
65
3e17890 1.1 branch is now trunk
graeme authored Mar 13, 2009
66 setDefaultTarget("installPlugin")
Something went wrong with that request. Please try again.