Detailed description of Xcode documentation automatic installation script

Source: Internet
Author: User

DetailsXcode documentAutomatic InstallationScriptIs the content to be introduced in this article, each upgradeXcodeOr the iPhone SDK, which was previously downloadedDocumentWill be deleted and re-initiated. This may not be a big problem for Apple developers who are quickly connected to the Internet, but for many domestic users, download n GiBDocumentIt is a heavy burden. Forced to do so, this time I wroteScriptTo solve the problem.

The method is simple. Place the iPhone document and Mac document in the two sub-directories of iOS and Mac respectively, and then create the following script:

 
 
  1. #!/bin/bash  
  2. macdocs='/Developer/Documentation/DocSets/' 
  3. iosdocs='/Developer/Platforms/iPhoneOS.platform/Developer/Documentation/DocSets/' 
  4. # Function: Extract Docs From Xar Archivesdo_extract() {  
  5.  echo In directory: $1  
  6.   echo Extract xars... for file in `ls -1`   
  7.   do     
  8.   xar -xf $file   
  9.   done    
  10.     
  11. echo Delete xars...   
  12. rm -f *.xar   
  13. echo Change ownerships...   
  14. for dir in `ls -1`   
  15. do     
  16. chown -R -P _devdocs $dir    
  17.  
  18. chmod 775 $dir done  
  19. }  
  20. # Delete Old Docs and Copy xar to Mac Doc Direcho Operation Start.  
  21. echo  
  22. echo Deleting Old Mac Docsets...  
  23. rm -rf ${  
  24. macdocs  
  25. }  
  26. *.docsetecho Copying xars to   
  27. $macdocscp Mac  
  28. /*.xar   
  29. $macdocs  
  30. # Delete Old Docs and Copy xar to iOS Doc Direcho Deleting Old iOS Docsets...  
  31. rm -rf ${iosdocs}*.docset  
  32. echo Copying xars to $iosdocs...  
  33. cp iOS/*.xar   
  34. $iosdocs  
  35.  
  36. # Goto Mac Doc Dir and Extract Docs.  
  37. echo Start to Extract Mac Docs...  
  38. cd $macdocsdo_extract   
  39. $macdocs  
  40. # Goto iOS Doc Dir and Extract Docs.  
  41. echo Start to Extract iOS Docs...  
  42. cd $iosdocsdo_extract   
  43. $iosdocsecho All Done. 

You canScriptName any name, such as docsetup. sh, and grant the execution permission. Upgrade completeXcodeThen, enterDocumentDirectory, run:

Sudu./docsetup. sh Wait for a moment,DocumentAll installed.

The one aboveScriptThere is no error capture mechanism, so be cautious when using it. In addition,ScriptThe meaning is very simple. Before executing the command, you should first understandScriptWhat did you do in your system, and then decide whether to use it. Incorrect executionScriptYou are responsible for any losses, so please use them with caution. :)

Summary: DetailsXcode documentAutomatic InstallationScriptI hope this article will help you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.