Skip to content

Commit

Permalink
Dont just default to docker, check if it is installed first then use …
Browse files Browse the repository at this point in the history
…parallels if thats present
  • Loading branch information
tomjn committed Jun 18, 2024
1 parent 8e59717 commit edbb7f8
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ def sudo_warnings
# exit
end


def vvv_is_docker_present()
VagrantPlugins::DockerProvider::Driver.new.execute("docker", "version")
return true
rescue Vagrant::Errors::CommandUnavailable
return false
end

def vvv_is_parallels_present()
VagrantPlugins::DockerProvider::Driver.new.execute("prctl", "version")
return true
rescue Vagrant::Errors::CommandUnavailable
return false
end

vagrant_dir = __dir__
show_logo = false
branch_c = "\033[38;5;6m" # 111m"
Expand Down Expand Up @@ -214,12 +229,16 @@ vvv_config['general'] = {} unless vvv_config['general'].is_a? Hash

defaults = {}
defaults['memory'] = 2048
defaults['cores'] = 1
defaults['cores'] = 2
defaults['provider'] = 'virtualbox'

# if Arm default to docker
# if Arm default to docker then parallels
if Etc.uname[:version].include? 'ARM64'
defaults['provider'] = 'docker'
if vvv_is_docker_present()
defaults['provider'] = 'docker'
elsif vvv_is_parallels_present
defaults['provider'] = 'parallels'
end
end

# This should rarely be overridden, so it's not included in the config/default-config.yml file.
Expand Down

0 comments on commit edbb7f8

Please sign in to comment.