Browse files

Loop over versioned data model collections (i.e. .xcdatamodeld direct…

…ories) and

generate model classes for the "current" data model version (of course, only if
the .xcdatamodeld directory's comment field contains 'xmod').
  • Loading branch information...
1 parent 01bc803 commit 575584320a03f8738f9e1c42f6e05f865f8aeb5a @nvie committed Dec 13, 2009
Showing with 14 additions and 0 deletions.
  1. +14 −0 Xmod/Xmod.applescript
@@ -54,6 +54,20 @@ end startGeneration
on updateProjectXmod(_project)
tell application "Xcode"
+ -- First, iterate over every .xcdatamodeld (notice the 'd') in the project.
+ set modeldList to every file reference of _project whose file kind is "wrapper.xcdatamodeld"
+ repeat with modeldIt in modeldList
+ if comments of modeldIt contains "xmod" then
+ -- 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
+ -- Then run it on that
+ my startMogenerator(_project, activeModelVersion)
+ end if
+ end repeat
-- Iterate over every .xcdatamodel in the project.
set modelList to every file reference of _project whose file kind is "wrapper.xcdatamodel"
repeat with modelIt in modelList

0 comments on commit 5755843

Please sign in to comment.