Skip to content

Commit

Permalink
Automatically select current version of a model (xmod comment has to …
Browse files Browse the repository at this point in the history
…be set on xcdatamodeld group)
  • Loading branch information
vguerci committed Feb 16, 2011
1 parent 473db99 commit 09b0d8e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Xmod/Xmod.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 09b0d8e

Please sign in to comment.