Skip to content

Instantly share code, notes, and snippets.

@squarefrog
Last active August 29, 2015 14:02
Show Gist options
  • Save squarefrog/0f867eb494be8028caeb to your computer and use it in GitHub Desktop.
Save squarefrog/0f867eb494be8028caeb to your computer and use it in GitHub Desktop.
Mogenerator Run Script
MODEL_DIR="ProjectName/Models"
MODEL_NAME="DataModel.xcdatamodeld"
PATH_TO_MODELD="${MODEL_DIR}/${MODEL_NAME}"
MACHINE_DIR="Machine"
HUMAN_DIR="Classes"
type mogenerator >/dev/null 2>&1 || {
echo >&2 "warning: mogenerator not found. You will need it when changing core data model";
exit 0;
}
#CURRENT_VERSION=$(/usr/libexec/PlistBuddy -c "Print :_XCCurrentVersionName" "${PATH_TO_MODELD}/.xccurrentversion")
CURRENT_VERSION="${MODEL_NAME}"
MODEL_PATH="${PATH_TO_MODELD}/${CURRENT_VERSION}"
echo "Used model path ${MODEL_PATH}"
mogenerator -m $MODEL_PATH --template-var arc=true --machine-dir ${MODEL_DIR}/${MACHINE_DIR} --human-dir ${MODEL_DIR}/${HUMAN_DIR}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment