Skip to content

Commit

Permalink
Only configure docker wrapper on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Nov 21, 2024
1 parent f7c5759 commit cc142c9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 19 deletions.
35 changes: 35 additions & 0 deletions lib/tasks/docker.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true

require 'macos'

task :docker => :'brew:formulae_and_casks' do
docker_dir = File.expand_path('~/.docker')

if macos?
fish_function = Pathname('~/.config/fish/functions/docker.fish').expand_path
fish_function.dirname.mkpath
fish_function.write <<~FISH
# This file was created automatically, do not edit it directly.
function docker --wraps docker
if contains -- -h $argv || contains -- --help $argv || test (count $argv) = 0; else
if ! pgrep Docker >&-
open -jga Docker
end
while true
set -l ping_status (curl --fail --unix-socket ~/.docker/run/docker.sock 'http://localhost/_ping' 2>&-)
if test "$ping_status" = OK
break
else
sleep 1
end
end
end
command docker $argv
end
FISH
end
end
19 changes: 0 additions & 19 deletions ~/.config/fish/functions/docker.fish

This file was deleted.

0 comments on commit cc142c9

Please sign in to comment.