Using Ubuntu and SVN to Update the WordPress Repository

511 views
420 views

Published on

A Complete walk-through on how to use Ubuntu and SVN to update your Plugin at the Wordpress Repository.

Published in: Self Improvement
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
511
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Using Ubuntu and SVN to Update the WordPress Repository

  1. 1. Using Ubuntu and SVN to Update the WordPress Repository Created by: Chris Winters (tribalNerd) Circle techNerdia on Google Plus | Circle Chris Winters on Google Plus
  2. 2. About This Tutorial A Complete walk-through on how to use Ubuntu and SVN to update your Plugin at the Wordpress Repository. If you are new to the Repository or just confused how to update it on Ubuntu, then this step-by-step walk-through should clear up any confusions you have.
  3. 3. The Steps Install Subversion Setup Local Directory Structure Update Your Local SVN Setup the Plugins Readme.txt File Copy Your Development Plugin Into /trunk/ Tag Your New Local Version Commit Your Plugin To The Repository Correcting Errors
  4. 4. What is the WordPress Repository? The Repository is where you, the author of the Plugin, will store the plugin at WordPress.org. What is Subversion?Subversion is an open source version control system that keepstrack of the different versions of your WordPress plugin. UsingSubversion will allow you to store your various plugin versions andif needed restore a previous working version if a critical mistake ismade in a current version.Subversion is what allows to you Publish / Update your WordPressPlugin at the Repository. You do not have to commit every changeyou make, just the tested-working version.
  5. 5. Install SubversionBefore you can get started you will need toinstall Subversion on your Ubuntu machine.Within Terminal (CTRL+ALT+T) type: sudo apt-get install subversion
  6. 6. Setup Your Local Directory StructureNext you will need to create a documentstructure to store the Subversion copies of yourWordPress plugins. My structure looks like this:
  7. 7. Update Your Local SVNNow it is time to build a local copy of your Plugins. You willdo this even if this is your first Plugin and you have notadded the plugin the Repository yet.Within the /svn/ folder that you created, checkout (co) acopy of your plugin(s). cd /home/username/wordpress/svn/ sudo svn co http://plugins.svn.wordpress.org/wp-my-admin- bar/
  8. 8. Update Your Local SVNWithin the plugin-name directory this will create a local directory structure that looks like:
  9. 9. The Plugins Readme.txt FileA plugins readme.txt file is the key file to making your plugin publishcorrectly. The readme.txt creates the description of your plugin and iswhat determines the version of your plugin that will be available to thepublic.The “Stable tag” is what “tags” the version of your plugin. The Stabletag must always be updated/changed when a new version of yourplugin is published.The readme.txt file also lays out the different tabbed pages displayed onwordpress.org, such as: Description, Installation, FAQ, Screenshots,Other Notes, Changelog, and Other Notes. This is done based off thestructure of the readme.txt file. [Clean Robots.txt Template]
  10. 10. Copy Your Plugin Into /trunk/Before we publish anything to the Repository, you will need to copy your development plugin to the /svn/ directory on your local harddrive. If you updated your Plugin, you will copy over the files that have Updated, including the readme.txt file. New Plugin or Full Plugin UpdateFor newly published plugins or if all of your plugin files have updated, youwill recursively copy your core plugin files into the /truck/ directory of thelocal SVN.Change directories to the root plugins directory, and not within theplugin-name directory itself. cd /home/username/wordpress/plugins/ sudo cp -r plugin-name/* ../svn/plugin-name/truck/Note: The plugin has NOT been published at this point.
  11. 11. Copy Newly Updated Files OnlyIf only a couple of files changed, then copy over only the files that changed, this includes the readme.txt file.Change directories to the plugin-name directory, then copy the changed file into the svn/trunk. cd /home/username/wordpress/plugins/plugin-name/ sudo cp readme.txt ../../svn/plugin-name/trunk/
  12. 12. An Updated File Within A DirectoryIf your plugin is structured into directories, hereis how you would copy a unique file within adirectory.cd /home/username/wordpress/plugins/plugin-name/sudo cp -r includes/function.class.php ../../svn/plugin-name/trunk/includesNote: The plugin has NOT been published at this point.
  13. 13. If you Screwed Up /svn/trunkHere is how you would reset the /svn/trunkdirectory if you made an mistake.Change into the /svn/plugin-name/ directory,remove the trunk directory, the checkout a newcopy of the trunk directory from the repository. cd /home/username/wordpress/svn/plugin-name/ sudo rm -r trunk sudo svn co http://plugins.svn.wordpress.org/wp-my-admin-bar/trunkYou will now need to re-copy your changed filesback into the /svn/plugin-name/trunk directory.
  14. 14. Check The Status Of Your FilesTo make sure all the proper files have beencopied over to /trunk, check the status of thefiles. cd /home/username/wordpress/svn/plugin-name/ sudo svn status
  15. 15. Tag Your New Local VersionOnce your local /trunk/ has a copy of your developed plugin, it istime to copy the conents of trunk over to your new Version tag.The tag name / directory, will match your plugin Version in yourreadme.txt file. If the Stable tag within the readme.txt is onVersion 0.1 then your tagged directory name would be 0.1 aswell.Change directories into your local /svn/plugin-name directory. cd /home/username/wordpress/svn/plugin-name/ sudo svn cp trunk tags/0.1Remember: The tag version should relate to the “Stable tag” version number inyour readme.txt file.
  16. 16. Check The Status Of Your FilesTo make sure all the proper files have beencopied over to /trunk, again, check the status ofthe files. cd /home/username/wordpress/svn/plugin-name/ sudo svn status
  17. 17. Commit Your PluginNow it is time to publish or commit your Pluginto the Repository. cd /home/username/wordpress/svn/plugin-name/ sudo svn ci -m Adding Version 0.1At this point, Subversion at wordpress.org will ask you for your WordPress.orgpassword.Note: The area within the quote marks is a message to let you know what actionis taking place.
  18. 18. View Your PluginOpen the svn http url to your plugin, example:http://plugins.svn.wordpress.org/wp-my-admin-bar/Enter the /trunk/ and /tags/version-numberdirectories and check that your modified filesshow up correctly.After a few minutes has passed, check theplugin version at Wordpres.org, example:http://wordpress.org/extend/plugins/wp-my-admin-bYou should see that you new version is nowavailable for download.
  19. 19. Making ChangesIf you noticed a “simple” error in a script ormaybe you forget to update some informationwithin the readme.txt file, you will modify theneeded files via root. Any changes you makewill have to be done to both copies in the /trunk/and within /tags/For a Linux text editor, such as pico, vi, emacs,etc run the editor using sudo. cd /home/username/wordpress/svn/plugin-name/trunk/ cd /home/username/wordpress/svn/plugin-name/tags/tag-version sudo pico readme.txt
  20. 20. Making ChangesIf you would rather use a GUI Editor, such asgedit or Blueflish, you will need to run thoseprograms as root, in the terminal window type:gksudo program-name gksudo blueflish gksudo geditNavigate to /home/username/wordpress/svn/plugin-name/trunk directoryand make the same modifications to the /tags/version-number files.
  21. 21. Status Check & Re-CommitTo make sure your changes work, check thestatus of your files. cd /home/username/wordpress/svn/plugin-name/ sudo svn status Re-Commit Your ChangesNow that you have modified the files, re-commityour changes. cd /home/username/wordpress/svn/plugin-name/ sudo svn ci -m Correction To Version 0.1
  22. 22. Your Plugin Is Ready!All Done! Your plugin has now been publishedto the WordPress Repository and is available fordownload.Have a suggestions for this article? Like it, loveit, hate it?Drop me some feedback and let me know!~tribalNerd
  23. 23. View Article, Download PDF and Leave Feedback View the Article on techNerdia Download the PDF View PDF at Scribd Leave Feedback Thanks for taking the time to view this presentation. ~Chris Winters

×