Developing for COD Drupal 7

Last updated on
28 April 2017

Using a dev snapshot or git branch for development is often the best way to contribute back to a distribution. For COD, we have built some scripts to help setup a development environment.

build_distro.sh: This file manages building of the distribution and associated support files
The build script uses the following layout:
cod file layout
cod/ (this is the root folder, usually not in git)
cod_profile/ (this is where you download cod: git clone --branch 7.x-1.x http://git.drupal.org/project/cod.git)
cod_profile/scripts/build_distro.sh: the build script
docroot/ : Ephemeral development docroot, gets wiped out every time build_distro.sh is ran
sites/ : sites folder for the docroot. Remains when docroot gets wiped out on rebuild
repos/ : location for modules and themes that you want to have git or other snapshots of** (see below)
patches/ : I like to make a folder for my patches here
screenshots/ : screenshots of issues found in the dev environment
repos.txt : Text file containing all repos you want symlinked to the docroot folder.

* Build the distro. Follow these steps (all steps assume you're in the 'cod' root folder:
1) Download cod into cod_profile: git clone --branch 7.x-1.x http://git.drupal.org/project/cod.git
2) Run the build script: cod_profile/scripts/build_distro.sh build /full/path/to/my/root/folder/cod username*
* You can use your d.o username if you're a cod or cod_support maintainer to push git changes.
3) Link /path/to/my/root/folder/cod/docroot to your web server's vhosts
4) Point your browser to the associated site indicated in step 3.

* To rebuild the docroot, simply type cod_profile/scripts/build_distro.sh build /full/path/to/my/root/folder/cod

* Basically the build distro script will symbolically link the docroot to cod_profile for everything in docroot/profiles/cod and link repos/modules/contrib/cod_support to docroot/profiles/cod/modules/contrib/cod_support so you can work on these modules without having to rebuild your git repos every time you rebuild the distro with drush make.

** The repos folder is useful for keeping copies of modules you're testing against and don't want to see destroyed every time drush make is re-ran with build_distro.sh. For example: If you're working on a patch in the ticket module, you'd download clone ticket's git repo to repos/modules/contrib/ticket. Then add the relative path for ticket in cod/repos.txt. The next time you rebuild, ticket will be symbolically linked instead of the version that is downloaded in drupal-org.make. Important! You must verify any patches that cod applies to a module and make sure to manually apply to the git repo. Also make sure the branch and git hash are the same, otherwise your version of cod will be inconsistent with the version supplied by drupal-org.make.