Using Ubuntu and SVN to Update the WordPress Repository
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
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.
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
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.
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
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:
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/
Update Your Local SVNWithin the plugin-name directory this will create a local directory structure that looks like:
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]
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.
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/
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.
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.
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
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.
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
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.
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.
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
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.
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
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
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