Problem/Motivation
For developers and testers (primarily) the github pull-request style workflow for Rules project development are challenging to integrate into a project that is using a Composer workflow.
Drupal-project frameworks drupal-project , Acquia BLT, and the hosting/deployment solutions like platform.sh all prefer to use site-recipes managed by composer.json - and the recent drupal.org instructions for Using Composer to manage Drupal site dependencies all expect us to be able to use
composer require drupal/rules
At the moment, we cannot do that and use or test the github-style dev branches of Rules from fago/rules or similar.
But! A few adjustments to the documentation for work-arounds could get us back on the same page!
Proposed resolution
Documentation
A couple of steps can be applied to your Composer-controlled Drupal project to instruct it to fetch the Rules module from an alternate (non-drupal.org locatipn.
Given an empty/clean (working) Drupal install built using https://github.com/drupal-composer/drupal-project, https://github.com/acquia/blt or similar...
Optionally fork a copy of the whole project, as per instructions - or just locate one of the working github branches that you need to use
Add that github repo as a specific remote repo (via composer)
composer config repositories.forked-rules vcs https://github.com/fago/rules.git
Have composer pull in the git checkout for us.
composer require --prefer-source drupal/rules:8.x-3.x-dev
rules/composer.json improvement
In order for a non-drupal.org drupal project to be fetched correctly, the projects composer.json should be complete. (Drupal.org actually fills in some missing stuff for us magically, but that cannot be relied on outside of that ecosystem)
Basically, we just need to ensure that all the project dependencies (this week that's typed_data) are explicitly in the composer.json
{
"name": "drupal/rules",
"description": "React on events and conditionally evaluate actions.",
"type": "drupal-module",
"license": "GPL-2.0+",
"minimum-stability": "dev",
"require": {
"drupal/typed_data": "*"
}
}
In my experience this does not conflict with the d.o magic under the https://packages.drupal.org/8 server, and in the long term it will be expected for drupal projects to start defining their requirements using composer.json properly this way anyway.
... drupalcon code sprint is closing, I have other notes I'll just paste un-edited below...
Comments
Comment #2
dman commentedIf that worked,
You should have seen the `drupal/typed_data` dependency arrive during the downloads. (2017-09-29 this still does not work)
You should see the rules module arrived in `web/modules/contrib/rules` (**)
You should be able to confirm that `web/modules/contrib/rules` is a git checkout, and that the git remote origin is the github originaln(fagos) or the github fork (yours) - not drupal.org.
Comment #3
tr commentedGood information.
Can you create a documentation page for this under https://www.drupal.org/docs/8/modules/rules ?
Then provide a patch for composer.json to make it work with both workflows?
Comment #4
tr commentedRules has not use the gitlab repository for more than 2 years now - Rules is currently hosted entirely on drupal.org. After re-reading this issue, I don't see that any of this is relevant any more.