B. Contributing a Module through CVS

This article is largely taken from http://drupal.org/node/112902<. The following is essentially a walk-through focusing on the actual process involved when submitting modules to Drupal.org. This is by no means a detailed CVS guide and I am not a CVS expert. After spending days combing through the Drupal Handbook (and asking the experts) to put it all together, I decided to write it all down for my own reference and share it with others.

It is highly recommended that you read the detailed CVS instructions in the Drupal Handbook at some point. This guide is for Windows users and a CVS client is used, so you don't have to use command-line. There are decent instructions already available for Linux users.

I also recommend that you familiarize yourself with the Drupal coding standards<. I then suggest you download and install the Coder module< for checking your application of the standards. Then it's always nice to at least lay the groundwork for translation of your module, so check out the Translation Template Extractor module<. There will be more on this later.

The assumption is that a stable release will be submitted, meaning that the module has been tested thoroughly (preferably by others), the PHP code has been checked for security vulnerabilities, the CSS has been validated etc, and the module is ready to share with the Drupal community.

Adding a module to Drupal CVS

  1. First you will need to apply for a CVS account with Drupal.org<.
  2. Once your account is approved you will be able to add projects. But first, you will want to upload your module to the Drupal CVS server. There are several CVS GUI clients< available. I chose to use TortoiseCVS per recommendation from a Drupal developer. You can download TortoiseCVS here<.

  3. After you have installed TortoiseCVS, browse to the folder that contains all of the files for your module. The commands for TortoiseCVS are accessed via the context menu when you right-click on a folder.
  4. Right-click the folder for your module. Select CVS > Make New Module<. Make sure that Password server (:pserver:) is selected for Protocol:. For CVSROOT: copy and paste or type the following line, replacing "username" with your username for your CVS account with Drupal (note: username is case-sensitive).

  5. :pserver:username@cvs.drupal.org:/cvs/drupal-contrib<

  6. For the Module: field, copy and paste or type in the following line replacing "modulename" with the name of your module. This should match the name of the folder which contains your module files:

  7. contributions/modules/modulename<

    Press OK. TortoiseCVS will do it's thing and should report that the operation was successful. This has created a directory in Drupal CVS to contain the files for your module. You can verify that the directory was created by visiting the Index of contributions<.

  8. Now the folder for your module will have a green checkmark on it. The next thing to do is create your first CVS branch (more on maintaining your branches will be in another article). Right-click the folder and select CVS > Branch. Depending on which version of Drupal you're releasing the module for, you will want to use one of the following branches for New branch name:

  9. DRUPAL-6
    DRUPAL-5
    DRUPAL-4-7<

  10. Next you will want to create a CVS tag for the specific version of the module you are releasing. This helps to keep track of different releases. Since this is the initial stable release you will start with 1.0. Use one of the following tags below depending on the version of Drupal:

  11. DRUPAL-6--1-0
    DRUPAL-5--1-0
    DRUPAL-4-7--1-0<

    When this is complete, the module has been registered on Drupal CVS and the branch and tags have been designated.

  12. Time to add the files. Right-click on the module folder again and select CVS Add Contents. All of the files in your module folder will be selected automatically. Press OK.
  13. Now the files have to be commited. Open the folder for your module. You will see orange plus signs on all of the files indicating that they have been added. Select these files, right-click and choose CVS Commit. In the Comment field, add something like "Initial Release for Drupal 5.0" and press OK. If your module folder contains sub-folders i.e. "/images" etc. you may need to repeat this procedure for all of the files in each sub-folder since the commit command is not always recursive.
  14. Creating a project for your module on Drupal.org

  15. It is now time to add your project on Drupal.org. Login to your account. Click on Create content > Project. Most of the fields on the Submit project form should be self-explanatory. The Short project name should match the name of the folder that contains your module files. For CVS tree, use the following URL and replace "modulename" with the short project name you entered earlier:

  16. http://cvs.drupal.org/viewcvs/drupal/contributions/modules/modulename<

    After everything applicable has been filled in, click Submit. Don't worry, you can come back and fill in missing details later.

  17. Now to add the release that was uploaded to CVS earlier. This is an easy step to forget, but don't or you will have wasted all your time. Click the Add new release link for your project - the one on the project page (the "create content » release" doesn't do it). Select the appropriate CVS identifier. The next screen is fairly self-explanatory. Click Submit.










That's it! Whew! Now your module is officially managed through Drupal CVS and included as a project on Drupal.org. If you want to add a screenshot, first read the Theme screenshot guidelines<. You will need to Submit an issue< with the Drupal.org webmasters in order to have your screenshot added.

So there you have it. Ten "easy" steps to add your module to Drupal. Perhaps not that easy, but it is to be expected that there will be some tedious procedures to deal with in order to keep the quality of contributions high while maintaining a community effort like Drupal. Hopefully this has been informative and will save some time and headache for people who aren't familiar with CVS but would like to contribute a Drupal module. Again, it is recommended that you read through the Drupal handbook so that you have a more complete understanding of CVS; here is a good place to start<.