我尝试将此脚本作为生成文档的一部分来运行 使用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
如果我从终端运行脚本,第一个是日志屏幕截图。 第二个是我从Xcode运行脚本时的日志屏幕截图。