-
-
Notifications
You must be signed in to change notification settings - Fork 645
Composer plugin? #1247
Comments
Interesting... definitely something worth considering. It would take one extra step out of integrating Drupal VM straight into a project. |
The main concern I'd have is how easy it would be to allow customizations per project (e.g. if you want your config_dir to be |
Completely understand, which is why it would be difficult to jump to PR stage. We've also been testing the concept of adding config directly to |
Also for a bit of background we're moving to only support composer installations to help with breaking backwards compatibility -- beetboxvm/beetbox#391 |
So with beetbox as an example, we could do something like this to support specifying the config_dir in Edit: Nevermind, this needs more work as the diff --git a/Vagrantfile b/Vagrantfile
index 386e9d0..46fb62e 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -14,6 +14,16 @@ guest_config_dir = ENV['DRUPALVM_CONFIG_DIR'] ? "/vagrant/#{ENV['DRUPALVM_CONFIG
drupalvm_env = ENV['DRUPALVM_ENV'] || 'vagrant'
+if File.exist?("#{host_project_dir}/composer.json")
+ require 'json'
+ composer_conf = JSON.parse(File.read("#{host_project_dir}/composer.json"))
+ config_dir = composer_conf['extra']['drupalvm']['config_dir'] rescue nil
+ if config_dir.is_a?(String)
+ host_config_dir = "#{host_project_dir}/#{config_dir}"
+ guest_config_dir = "/vagrant/#{config_dir}"
+ end
+end
+
# Cross-platform way of finding an executable in the $PATH.
def which(cmd)
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] |
We could use environment variables to allow users to create the VagrantFile with certain attributes.
Maybe not the most friendly solution, passing stuff like that is a standard way to run scripts in Composer. I cannot say I have ever seen that done on install before. |
@frob I liked that idea, would have been cool to be able to do something like:
Unfortunately it seems this only works for run-script :/ |
I think it would be so much better if users didn't need to create their You can test it using these steps:
If this would be merged the steps would be:
Also pinging drupal-composer/drupal-project#214 |
One issue is that this can quickly move too far into composer territory which we don't want to. It should only support the basics and then users can use drupal-vm-cli or other dedicated tools to configure more. The scaffolded config should only have so much that the setup works out of the box. If a user wants to customize something, they'll need to read the docs. |
drupal-composer/drupal-project#180 uses the |
I think it makes sense to use what drupal-project uses. |
Copied from the PR that corresponds to this ticket:
|
Leaving this issue open for now... but as in the real world, I see many fewer sites being built with Composer than I'd originally imagined still (definitely much less than 50%), I'm going to keep Drupal VM as-is, and not convert to a plugin—at least not yet. I'd rather keep the majority user experience optimized for now. |
For slightly easier docs on this we could put it in a separate package too. Just copied the PR over to a new repo to try and it works fine except that rather than copying Drupal VMs Vagrantfile it copies over the delegating Vagrantfile. https://github.com/oxyc/drupal-vm-composer Add the repo as a vcs repository "repositories": [
{ "type": "vcs", "url": "https://github.com/oxyc/drupal-vm-composer.git" }
], composer require oxyc/drupal-vm-composer @dev |
Popping off the 5.0.0 milestone for now. I like your suggestion, but for now, will just keep the status quo. I'm going to use 5.0.0 to update defaults to PHP 7.2, Ubuntu 18.04. |
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution! Please read this blog post to see the reasons why I mark issues as stale. |
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details. |
Issue Type
Summary
@geerlingguy have you considered making DVM a composer plugin so you don't need a
delegating Vagrantfile?
see https://github.com/beetboxvm/beetbox/blob/master/composer/src/Plugin.php
This creates/updates a
Vagrantfile
during acomposer install
Then you'd just ignore the
Vagrantfile
in.gitignore
The text was updated successfully, but these errors were encountered: