Labs/Ubiquity/Ubiquity 0.1 Development Tutorial: Difference between revisions

From MozillaWiki
< Labs‎ | Ubiquity
Jump to navigation Jump to search
Line 7: Line 7:
It is pretty easy to get involved with the development of Ubiquity. Start off by introducing yourself on the irc channel #ubiquity on [[irc.mozilla.org]].
It is pretty easy to get involved with the development of Ubiquity. Start off by introducing yourself on the irc channel #ubiquity on [[irc.mozilla.org]].


We use Mercurial [http://www.selenic.com/mercurial/wiki/] for version control. It is very easy to install if you've got Python 2.5 with setuptools. Just type:
You will need to have [http://www.python.org|Python] installed, preferably Python 2.5.  (If you are on Mac OS X, you have Python already.)  We use Python instead of Make for our build script.
 
We use [http://www.selenic.com/mercurial/wiki/|Mercurial], called "Hg" for short, for version control. It is very easy to install if you've got Python 2.5 with setuptools. Just type:


   easy_install Mercurial
   easy_install Mercurial
Line 30: Line 32:


Now you are all set to become a pro Ubiquity hacker!
Now you are all set to become a pro Ubiquity hacker!
== Uninstalling Ubiquity ==
Just run "python manage.py uninstall", optionally specifying a profile
name/directory if necessary.  Alternatively, you can also uninstall
the extension through the normal Firefox addon management UI.
== Building an XPI ==
To build an XPI for Ubiquity, just run:
  python manage.py build-xpi
This will create an XPI with the name "ubiquity-<version>.xpi", where
"<version>" is taken from the contents of the "em:version" element in the
"ubiquity/install.rdf" file.


= Development =
= Development =

Revision as of 23:50, 29 August 2008

If you just want to write new commands for Ubiquity, you should read the Command Author Tutorial instead. This page is about how to do development on the Ubiquity core.

Getting Set Up

Getting the Source

It is pretty easy to get involved with the development of Ubiquity. Start off by introducing yourself on the irc channel #ubiquity on irc.mozilla.org.

You will need to have [1] installed, preferably Python 2.5. (If you are on Mac OS X, you have Python already.) We use Python instead of Make for our build script.

We use [2], called "Hg" for short, for version control. It is very easy to install if you've got Python 2.5 with setuptools. Just type:

 easy_install Mercurial

Once installed, you will be able to checkout the current source using the command:

 hg clone http://hg.toolness.com/ubiquity-firefox

Installing the Source Version of the Extension

Uninstall your current version of Ubiquity from your Firefox Addons and then run:

 python manage.py install

This will generate a new build of the Ubiquity extension from the source checkout and install it with your local Firefox instance.

If you have a separate profile that you'd prefer to install the extension under, such as 'testing', you can add that as an optional parameter:

 python manage.py install testing

Now you are all set to become a pro Ubiquity hacker!

Uninstalling Ubiquity

Just run "python manage.py uninstall", optionally specifying a profile name/directory if necessary. Alternatively, you can also uninstall the extension through the normal Firefox addon management UI.

Building an XPI

To build an XPI for Ubiquity, just run:

 python manage.py build-xpi

This will create an XPI with the name "ubiquity-<version>.xpi", where "<version>" is taken from the contents of the "em:version" element in the "ubiquity/install.rdf" file.

Development

The heart of the code can be found in the subdirectory:

  ubiquity/chrome/content/


Note: There is no need for you to keep on rebuilding your Extension after the first time. The changes to the manage.py built Extension are updated whenever you save updates to the source files and restart Firefox.

Don't Forget to Test

Make sure you run the test suite before committing your changes. From the root directory of your checkout, run:

   python manage.py test

Another way to run the same test suite is by visiting this page:

 chrome://ubiquity/content/test.html

Due to slight differences between running javascript code in xpcshell on the command line, and running it in an html page, a test occasionally will fail on the html page even though it succeeds on the command line. In that case, you can ignore the failure on the html page.

Keeping Up to Date

I recommend that you frequently update your repository to get the latest changes from the central repository. In case you're not familiar with using Mercurial, pulling the code is a two-step process:

hg pull
hg update

You can also view the latest changes to the central repository on the web at hg.toolness.com.

Finding Something to Work On

We use this Wiki [3] and Getsatisfaction [4] as places to get feature requests and bug reports. These feed into an internal Trac-based ticketing system [5].

Login to the Trac [6] using an OpenID account. Look for unassigned tickets (these are the ones that say "New" in the status column as opposed to "Assigned"). Check out what needs to be done, add things appropriately, choose unassigned tickets and start hacking!


Submitting Patches

When you're starting out with development, you won't have push access to the central hg repository. The best way for you to submit your changes is by creating a source code diff and attaching it to the Trac ticket that you're working on. The command line is like this:

hg diff > filename.diff

Then, on the Trac ticket page, click the "Attach file" button and choose the file you just created. Add a bit of explanation about your changes, and click "Submit changes". Don't change the status of the ticket yet.

One of the core developers will review your patch and, if it's found to be good, will commit it to the core repository and close the ticket.

After you've been developing for a while and have had some patches accepted, someone from the core development team (having noticed how awesome you are) will contact you to talk about getting you direct push access to the repository.