Created
August 31, 2010 18:43
-
-
Save deluan/559495 to your computer and use it in GitHub Desktop.
Grails script to create a new Mercurial Repository for the current project, and a default .hgignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2010 Deluan Cotts ([email protected]) | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
HGIGNORE_CONTENTS = """ | |
# Eclipse project files | |
.classpath | |
.project | |
.settings/ | |
# IntelliJ project files | |
\\.iml | |
\\.ipr | |
\\.iws | |
.idea/ | |
out | |
# Grails files and dirs that should not be versioned | |
target | |
web-app/WEB-INF/classes | |
web-app/WEB-INF/tld/c.tld | |
web-app/WEB-INF/tld/fmt.tld | |
stacktrace.log | |
plugin.xml | |
devDb.* | |
prodDb.* | |
# Mac OS/X finder files | |
.DS_Store | |
""" | |
target(main: "Creates a new Mercurial Repository for the current project, and a default .hgignore") { | |
println() | |
print "Initializing Mercurial repository.... " | |
proc = "hg init".execute() | |
result = proc.waitFor() | |
if (result) { | |
println "ERROR: ${proc.err.text}" | |
exit(-1) | |
} | |
println "OK" | |
print "Creating .hgignore..." | |
hgignore = new File(".hgignore") | |
hgignore << HGIGNORE_CONTENTS | |
println "OK" | |
println "Finished. Add your files now (with hg add)." | |
} | |
setDefaultTarget(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use this script with your projects, put it in ~/.grails/scripts/HgInit.groovy, then use it like this:
$ grails hg-init
in your project base dir.