This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 03ec59e4 Try to allow for locally installed Docker
03ec59e4 is described below

commit 03ec59e4f319b0277c82d0932229c75780744f11
Author: Sebb <s...@apache.org>
AuthorDate: Tue Apr 23 12:18:57 2024 +0100

    Try to allow for locally installed Docker
---
 config/setupmymac | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/config/setupmymac b/config/setupmymac
index b7e73dab..1115eb1b 100755
--- a/config/setupmymac
+++ b/config/setupmymac
@@ -66,6 +66,8 @@ def brew *args
   run 'brew', *args
 end
 
+# TODO: this does not work well for dry-run;
+# the script can be called multiple times
 # Switch to root
 def sudo
   if $root
@@ -332,19 +334,27 @@ if force[:prune]
 end
 
 if option == :docker
-  unless Dir.exist? '/Applications/Docker.app'
+  dockerapp = nil
+  if Dir.exist? "#{Dir.home}/Applications/Docker.app"
+    dockerapp = "#{Dir.home}/Applications/Docker.app"
+  elsif Dir.exist? '/Applications/Docker.app'
+    dockerapp = '/Applications/Docker.app'
+  end
+  unless dockerapp
+    dockerapp = '/Applications/Docker.app'
     brew 'cask', 'install', 'docker'
   end
 
   if `which docker-compose`.empty?
-    run 'open /Applications/Docker.app'
+    run dockerapp
   end
 
   unless system 'docker info > /dev/null 2>&1'
-    run 'open /Applications/Docker.app'
+    run dockerapp
   end
 
   unless $root
+    # TODO: this is wrong if Docker is to be used alongside a local install
     Dir.chdir '/srv/whimsy' do
       run 'rake docker:update'
     end

Reply via email to