Using Ubuntu and SVN to Update the WordPress Repository
-
Upload
chris-winters -
Category
Self Improvement
-
view
312 -
download
1
description
Transcript of 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 Subversion
Before you can get started you will need to install Subversion on your Ubuntu machine.
Within Terminal (CTRL+ALT+T) type:
sudo apt-get install subversion
Setup Your Local Directory Structure
Next you will need to create a document structure to store the Subversion copies of your WordPress plugins. My structure looks like this:
Update Your Local SVNNow it is time to build a local copy of your Plugins. You will do this even if this is your first Plugin and you have not added the plugin the Repository yet.
Within the /svn/ folder that you created, checkout (co) a copy 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 Directory
If your plugin is structured into directories, here is how you would copy a unique file within a directory.
cd /home/username/wordpress/plugins/plugin-name/sudo cp -r includes/function.class.php ../../svn/plugin-name/trunk/includes
Note: The plugin has NOT been published at this point.
If you Screwed Up /svn/trunk
Here is how you would reset the /svn/trunk directory if you made an mistake.
Change into the /svn/plugin-name/ directory, remove the trunk directory, the checkout a new copy of the trunk directory from the repository.
cd /home/username/wordpress/svn/plugin-name/sudo rm -r trunksudo svn co http://plugins.svn.wordpress.org/wp-my-admin-bar/trunk
You will now need to re-copy your changed filesback into the /svn/plugin-name/trunk directory.
Check The Status Of Your Files
To make sure all the proper files have been copied over to /trunk, check the status of the files.
cd /home/username/wordpress/svn/plugin-name/sudo svn status
Tag Your New Local Version
Once your local /trunk/ has a copy of your developed plugin, it is time to copy the conents of trunk over to your new Version tag.
The tag name / directory, will match your plugin Version in your readme.txt file. If the Stable tag within the readme.txt is on Version 0.1 then your tagged directory name would be 0.1 as well.
Change directories into your local /svn/plugin-name directory.
cd /home/username/wordpress/svn/plugin-name/sudo svn cp trunk tags/0.1
Remember: The tag version should relate to the “Stable tag” version number inyour readme.txt file.
Check The Status Of Your Files
To make sure all the proper files have been copied over to /trunk, again, check the status of the files.
cd /home/username/wordpress/svn/plugin-name/sudo svn status
Commit Your Plugin
Now it is time to publish or commit your Plugin to the Repository.
At this point, Subversion at wordpress.org will ask you for your WordPress.org password.
Note: The area within the quote marks is a message to let you know what action is taking place.
cd /home/username/wordpress/svn/plugin-name/sudo svn ci -m 'Adding Version 0.1'
View Your Plugin
Open the svn http url to your plugin, example:
http://plugins.svn.wordpress.org/wp-my-admin-bar/
Enter the /trunk/ and /tags/version-number directories and check that your modified files show up correctly.
After a few minutes has passed, check the plugin version at Wordpres.org, example:
http://wordpress.org/extend/plugins/wp-my-admin-bar/
You should see that you new version is now available for download.
Making Changes
If you noticed a “simple” error in a script or maybe you forget to update some information within the readme.txt file, you will modify the needed files via root. Any changes you make will 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-versionsudo pico readme.txt
Making Changes
If you would rather use a GUI Editor, such as gedit or Blueflish, you will need to run those programs as root, in the terminal window type: gksudo program-name
gksudo blueflishgksudo gedit
Navigate 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 the status of your files.
Re-Commit Your ChangesNow that you have modified the files, re-commit your changes.
cd /home/username/wordpress/svn/plugin-name/sudo svn status
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 published to the WordPress Repository and is available for download.
Have a suggestions for this article? Like it, love it, hate it?
Drop me some feedback and let me know! ~tribalNerd
View Article, Download PDFand 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