Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Commit 01099ea

Browse files
committed
Drop support for a delegating Vagrantfile / environment variables
1 parent ec8fb56 commit 01099ea

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

Vagrantfile

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@ require 'yaml'
66

77
VAGRANTFILE_API_VERSION = '2' unless defined? VAGRANTFILE_API_VERSION
88

9-
# Absolute paths on the host machine.
10-
host_drupalvm_dir = File.dirname(File.expand_path(__FILE__))
11-
host_project_dir = ENV['DRUPALVM_PROJECT_ROOT'] || host_drupalvm_dir
12-
host_config_dir = ENV['DRUPALVM_CONFIG_DIR'] ? "#{host_project_dir}/#{ENV['DRUPALVM_CONFIG_DIR']}" : host_project_dir
13-
14-
# Absolute paths on the guest machine.
15-
guest_project_dir = '/vagrant'
16-
guest_drupalvm_dir = ENV['DRUPALVM_DIR'] ? "/vagrant/#{ENV['DRUPALVM_DIR']}" : guest_project_dir
17-
guest_config_dir = ENV['DRUPALVM_CONFIG_DIR'] ? "/vagrant/#{ENV['DRUPALVM_CONFIG_DIR']}" : guest_project_dir
18-
19-
drupalvm_env = ENV['DRUPALVM_ENV'] || 'vagrant'
20-
219
# Cross-platform way of finding an executable in the $PATH.
2210
def which(cmd)
2311
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
@@ -44,25 +32,29 @@ def walk(obj, &fn)
4432
end
4533
end
4634

35+
drupalvm_env = ENV['DRUPALVM_ENV'] || 'vagrant'
36+
37+
# Default paths when the project is based on Drupal VM.
38+
host_project_dir = host_drupalvm_dir = host_config_dir = File.dirname(File.expand_path(__FILE__))
39+
guest_project_dir = guest_drupalvm_dir = guest_config_dir = '/vagrant'
40+
4741
if File.exist?("#{host_project_dir}/composer.json")
4842
cconfig = {}
4943
composer_conf = JSON.parse(File.read("#{host_project_dir}/composer.json"))
5044
if composer_conf['extra'] && composer_conf['extra']['drupalvm']
5145
cconfig = composer_conf['extra']['drupalvm']
5246
end
5347

54-
# If Drupal VM is a Composer dependency set the correct paths.
55-
if Dir.exist?("#{host_drupalvm_dir}/vendor/geerlingguy/drupal-vm")
56-
host_project_dir = File.dirname(File.expand_path(__FILE__))
48+
# If Drupal VM is a Composer dependency set the correct path.
49+
if Dir.exist?("#{host_project_dir}/vendor/geerlingguy/drupal-vm")
5750
host_drupalvm_dir = "#{host_project_dir}/vendor/geerlingguy/drupal-vm"
58-
host_config_dir = ENV['DRUPALVM_CONFIG_DIR'] ? "#{host_project_dir}/#{ENV['DRUPALVM_CONFIG_DIR']}" : host_project_dir
59-
guest_drupalvm_dir = '/vagrant/vendor/geerlingguy/drupal-vm'
51+
guest_drupalvm_dir = "#{guest_project_dir}/vendor/geerlingguy/drupal-vm"
6052
end
6153

6254
# Read config_dir from composer.json if set.
63-
if !ENV['DRUPALVM_CONFIG_DIR'] && cconfig.include?('config_dir')
55+
if cconfig.include?('config_dir')
6456
host_config_dir = "#{host_project_dir}/#{cconfig['config_dir']}"
65-
guest_config_dir = "/vagrant/#{cconfig['config_dir']}"
57+
guest_config_dir = "#{guest_project_dir}/#{cconfig['config_dir']}"
6658
end
6759
end
6860

0 commit comments

Comments
 (0)