Skip to content
Browse files

Automatically select current version of a model (xmod comment has to …

…be set on xcdatamodeld group)
  • Loading branch information...
1 parent 473db99 commit 09b0d8ea40688fef7780f8bb99ba797bc0e81aaf @vguerci vguerci committed Feb 16, 2011
Showing with 11 additions and 0 deletions.
  1. +11 −0 Xmod/Xmod.applescript
View
11 Xmod/Xmod.applescript
@@ -17,6 +17,17 @@ on updateProjectXmod(_project)
repeat with modelItr in modelList
my updateModel(_project, modelItr, comments of modelItr)
end repeat
+ -- Iterate over every .xcdatamodeld (notice the 'd') in the project.
+ set modeldList to every group of _project whose name contains ".xcdatamodeld" and comments contains "xmod"
+ repeat with modeldIt in modeldList
+ -- Find the 'active' model version
+ set currentVersionFile to full path of modeldIt & "/.xccurrentversion"
+ set activeModelVersionFilename to do shell script "/usr/libexec/PlistBuddy -c 'print _XCCurrentVersionName' " & currentVersionFile
+ set activeModelVersion to full path of modeldIt & "/" & activeModelVersionFilename
+ set modelItr to item 1 of (every file reference of modeldIt whose name is activeModelVersionFilename)
+ -- Then update it
+ my updateModel(_project, modelItr, comments of modeldIt)
+ end repeat
end tell
end updateProjectXmod

0 comments on commit 09b0d8e

Please sign in to comment.
Something went wrong with that request. Please try again.