[SVN] r6700 (Groovy)

Graeme Rocher graemerocher at yahoo.co.uk
Fri Mar 2 22:52:25 UTC 2007


Thanks Allan,

I've committed a fix, could you verify that it works ok? In the
meantime here is the Groovy script I used. I imagine you could
probably do this in less lines of Ruby, hell its probably a Perl
one-liner, but here you go ;-)


def infoPlistFile = new File("info.plist")
if(!infoPlistFile.exists())  {
	println "Can't find info.plist file!"
	return
}
def infoPlistText = infoPlistFile.text
new File(".").eachFileRecurse { file ->
	if(file.isFile() && !file.name.endsWith(".svn-base") &&
!file.parentFile.name.equals(".svn")) {
		try {
			def xml = new XmlSlurper().parse(file)
			def children = xml.dict.'*'
			def oldUUID		
			boolean foundUUID = false
			for(node in children) {
				if(foundUUID == true) {
					oldUUID = node.text()
					break
				}
				else if(node.text()=='uuid') {
					foundUUID = true
				}
			}
			if(oldUUID) {
				def newUUID = "uuidgen".execute().inputStream.text.trim()
				// backup old file
				def backup = new File(file.absolutePath+".backup")
				def fileText = file.text
				backup.write(fileText)
				println "Replacing old UUID $oldUUID with new UUID $newUUID"
				def newText = fileText.replaceFirst(oldUUID, newUUID)
				infoPlistText = infoPlistText.replaceFirst(oldUUID, newUUID)
				file.write(newText)
			}
		}
		catch(Exception e) { println "not an XML file, skipping [${e.message}]" }
	}
}
println "Updating info.plist file.."
infoPlistFile.write(infoPlistText)

Cheers

Graeme

On 3/2/07, Allan Odgaard <throw-away-1 at macromates.com> wrote:
> Sorry, didn't consider that. I have enabled writing to the Disabled
> Bundles dir.
>
>
> On 2. Mar 2007, at 23:38, Graeme Rocher wrote:
>
> > Allan,
> >
> > I was in the process of fixing this. I didn't realise about the script
> > in Support/bin nevertheless I wrote a Groovy script that updates all
> > the UUIDs, however I now don't have permission to commit the changes
> > into the Disabled Bundles/Groovy.tmbundle directory
> >
> > Could you please either move it back or give me permission so I can
> > fix the problem
> >
> > Cheers
> >
> > On 3/2/07, Allan Odgaard <throw-away-1 at macromates.com> wrote:
> >> •move this bundle to the Disabled Bundles — a placeholder for
> >> "broken" bundles. We can move it back when it doesn't eclipse
> >> other bundle items (by re-using their UUIDs), hint: JEG2 wrote a
> >> script which is in Support/bin to find problematic items
> >>
> >> Changed:
> >> D   trunk/Bundles/Groovy.tmbundle/
> >> A   trunk/Disabled Bundles/
> >> A   trunk/Disabled Bundles/Groovy.tmbundle/
> >>
> >> _______________________________________________
> >> textmate-dev mailing list
> >> textmate-dev at lists.macromates.com
> >> http://lists.macromates.com/mailman/listinfo/textmate-dev
> >>
> >
> >
> > --
> > Graeme Rocher
> > Grails Project Lead
> > http://grails.org
> >
> > _______________________________________________
> > textmate-dev mailing list
> > textmate-dev at lists.macromates.com
> > http://lists.macromates.com/mailman/listinfo/textmate-dev
>
>


-- 
Graeme Rocher
Grails Project Lead
http://grails.org



More information about the textmate-dev mailing list