Appledoc プラグインを使用してドキュメントを生成する一環として、このスクリプトを実行しようとしています。このスクリプトを Xcode (またはターミナル) で実行するとエラーが発生します。私はスクリプトを書くのが初めてで、コード内の正確なエラーを特定できないので、助けてください!
#!/bin/bash
tmpdir="tmpdocs"
finaldir="docs"
rm -rf $tmpdir
mkdir $tmpdir # we killed this last time, create it to avoid warnings from appledoc
cd ./AppledocTemplates/
git checkout master
git pull origin master
expectedversion=$(./templateversion.sh) # Check repo version
cd ..
##########################################
# Install templates if not current
##########################################
if [ ! -f ~/.appledoc/templateversion.sh ] #If this file doesn't exist, then need to install templates
then
cd ./AppledocTemplates/
./installtemplates.sh
if [ $? -ne 0 ] # Descriptive error message is sent in installtemplates. Just exit with error
then
exit 1
fi
cd ..
fi
version=$(~/.appledoc/templateversion.sh) # Check installed version
if [ $version -ne $expectedversion ]
then
echo "Updating templates"
cd ./AppledocTemplates/
./installtemplates.sh #wrong version - try installing
version=$(~/.appledoc/templateversion.sh)
if [ $? -ne 0 ] # Descriptive error message is sent in installtemplates. Just exit with error
then
cd ..
exit 1
fi
if [ $version -ne $expectedversion ] # Now is the version correct? If not, exit with error
then
cd ..
echo "You do not have the correct version of the appledoc templates"
echo "Make sure you run installtemplates.sh to put them in their correct location."
exit 1
fi
cd ..
fi
##########################################
# Compile the docs
##########################################
appledoc ./AppledocSettings.plist MySDK # Compile the docs
if [ $? -ne 0 ]
then
echo "Compile failure of source documents. MySDK doc creation not completed."
exit 1
fi
##########################################
# Stage docs in proper places and cleanup
##########################################
#Move the docs to final directory
rm -rf $finaldir # clean out whatever was in the final dir
mkdir $finaldir # and recreate it
#Copy the docset file to the docs directory so that it can be loaded into github
cp -a ~/Library/Developer/Shared/Documentation/DocSets/us.MySDK.MySDK-Total-SDK.docset ./$finaldir
if [ $? -ne 0 ]
then
echo "Unable to copy docset to ./docs"
exit 1
fi
# stage the html directories to their final destination
mv -f ./$tmpdir/html/* $finaldir
if [ $? -ne 0 ]
then
echo "Unable to move html files to ./docs"
exit 1
fi
rm -rf $tmpdir #clear out the tmp dir
echo "MySDK doc creation successful."
exit 0
最初のものは、ターミナルからスクリプトを実行した場合のログ スクリーン ショットです。2 番目は、Xcode からスクリプトを実行した場合のログのスクリーン ショットです。