docker-sync 0.6.0 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1670b82d1e005cdfb4485db9241a513f962a732b29d4bd3cf6beec9227c52e65
4
- data.tar.gz: da40497b93174d5794d9fe7271a9c8a02c86fac647ee038b6d2380500da0cd31
3
+ metadata.gz: 88cce934f387bf527bd53628913c8bfe95b99533cea63a0ab45258fa66a4b185
4
+ data.tar.gz: b7fa487477e4ba03b6082f8712a391e0ac7c15b1fde8c671b35436c2a244f35a
5
5
  SHA512:
6
- metadata.gz: e0bf6820a799a2381e343d4cd9e5719a2f1adf2879f1cf82bc1a96833110963b8737a019c5870e74c6a59cb76a9951a97e1bf3226bea5e94a423c69897767dc7
7
- data.tar.gz: 550d7628a372fab1328ff3d06452919259409ac4d4d6d01324da9eab1fb99e6dbd26f9ba033fbbf0762134d766691e07edaf6e68117baa0371671c2b21accb43
6
+ metadata.gz: 635d2f2a06c5f284395b1dbc67db3fbc616efca42650a3d912265d1c88239078776a9975c74394b1dfb4071a5ca9b9f85234fe4a530932b0da1176dbb9b1e55b
7
+ data.tar.gz: 3e54b8c08bee9b846e9fdd8991b21370bc57b97bb0864b3a7f88712c775e72832902cf0134651ecd2ed6d33165c8496af48f8997f1429b41bc5643b3854621f2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.7.2
@@ -5,7 +5,11 @@ module DockerSync
5
5
  def self.docker_for_mac?
6
6
  return false unless Environment.mac?
7
7
  return @docker_for_mac if defined? @docker_for_mac
8
- @docker_for_mac = Environment.system('pgrep -q com.docker.hyperkit')
8
+
9
+ # com.docker.hyperkit for old virtualization engine
10
+ # com.docker.virtualization for new virtualization engine
11
+ # see https://docs.docker.com/desktop/mac/#enable-the-new-apple-virtualization-framework
12
+ @docker_for_mac = Environment.system('pgrep -q com.docker.hyperkit') || Environment.system('pgrep -q com.docker.virtualization')
9
13
  end
10
14
 
11
15
  def self.docker_toolbox?
@@ -5,6 +5,7 @@ module DockerSync
5
5
  module Unox
6
6
  LEGACY_UNOX_WARNING = 'You installed unison-fsmonitor (unox) the old legacy way (i.e. not using brew). We need to fix that.'.freeze
7
7
  FAILED_TO_REMOVE_LEGACY_UNOX = 'Failed to remove legacy unison-fsmonitor (unox). Please delete /usr/local/bin/unison-fsmonitor manually and try again.'.freeze
8
+ UNSUPPORTED_FSMONITOR = 'You are using unsupported version of unison-fsmonitor, consider installing eugenmayer/dockersync/unox instead'.freeze
8
9
 
9
10
  class << self
10
11
  extend Forwardable
@@ -13,15 +14,19 @@ module DockerSync
13
14
 
14
15
  def self.available?
15
16
  # should never have been called anyway - fix the call that it should check for the OS
16
- raise 'Unox cannot be available for other platforms then MacOS' unless Environment.mac?
17
+ raise 'Unox cannot be available for platforms other than MacOS' unless Environment.mac?
17
18
 
18
- cmd = 'brew list unox > /dev/null 2>&1'
19
- Environment.system(cmd)
19
+ return true if brew_package_installed?('unox')
20
+ return false unless brew_package_installed?('unison-fsmonitor')
21
+
22
+ say_status 'warning', UNSUPPORTED_FSMONITOR, :yellow unless @unsupported_fsmonitor_warning_displayed
23
+ @unsupported_fsmonitor_warning_displayed = true
24
+ true
20
25
  end
21
26
 
22
27
  def self.ensure!
23
28
  return if available?
24
- raise 'Unox cannot be installed on other platforms then MacOS' unless Environment.mac?
29
+ raise 'Unox cannot be installed on platforms other than MacOS' unless Environment.mac?
25
30
 
26
31
  cleanup_non_brew_version!
27
32
  PackageManager.install_package('eugenmayer/dockersync/unox')
@@ -39,6 +44,11 @@ module DockerSync
39
44
  def self.non_brew_version_installed?
40
45
  !available? && File.exist?('/usr/local/bin/unison-fsmonitor')
41
46
  end
47
+
48
+ def self.brew_package_installed?(name)
49
+ cmd = "brew list #{name} > /dev/null 2>&1"
50
+ Environment.system(cmd)
51
+ end
42
52
  end
43
53
  end
44
54
  end
@@ -42,12 +42,16 @@ module DockerSync
42
42
 
43
43
  out = `#{cmd}`
44
44
  if $?.exitstatus > 0
45
- say_status 'error', "Error starting sync, exit code #{$?.exitstatus}", :red
45
+ error_msg = "Error starting sync, exit code #{$?.exitstatus}"
46
+ say_status 'error', error_msg, :red
46
47
  say_status 'message', out
47
- else
48
48
  TerminalNotifier.notify(
49
- "Synced #{@options['src']}", :title => @sync_name
49
+ "#{error_msg}", :title => @sync_name, :subtitle => @options['src'], group: 'docker-sync'
50
50
  ) if @options['notify_terminal']
51
+ else
52
+ TerminalNotifier.notify(
53
+ "Synced #{@options['src']}", :title => @sync_name, group: 'docker-sync'
54
+ ) if @options['notify_terminal'] && @options['notify_terminal'] != 'errors_only'
51
55
  say_status 'ok', "Synced #{@options['src']}", :white
52
56
  if @options['verbose']
53
57
  say_status 'output', out
@@ -78,13 +78,20 @@ module DockerSync
78
78
 
79
79
  stdout, stderr, exit_status = Open3.capture3(cmd)
80
80
  if !exit_status.success?
81
- say_status 'error', "Error starting sync, exit code #{$?.exitstatus}", :red
81
+ error_msg = "Error starting sync, exit code #{$?.exitstatus}"
82
+ say_status 'error', error_msg, :red
82
83
  say_status 'message', stdout
83
84
  say_status 'message', stderr
84
- else
85
+
85
86
  if @options['notify_terminal']
86
87
  TerminalNotifier.notify(
87
- "Synced #{@options['src']}", title: @sync_name
88
+ "#{error_msg}", :title => @sync_name, :subtitle => @options['src'], group: 'docker-sync'
89
+ )
90
+ end
91
+ else
92
+ if @options['notify_terminal'] && @options['notify_terminal'] != 'errors_only'
93
+ TerminalNotifier.notify(
94
+ "Synced #{@options['src']}", title: @sync_name, group: 'docker-sync'
88
95
  )
89
96
  end
90
97
  say_status 'ok', "Synced #{@options['src']}", :white
@@ -205,7 +212,7 @@ module DockerSync
205
212
  say_status 'ok', "starting initial sync of #{container_name}", :white if @options['verbose']
206
213
  # wait until container is started, then sync:
207
214
  sync_host_port = get_host_port(get_container_name, UNISON_CONTAINER_PORT)
208
- cmd = "unison -testserver #{@options['src']} \"socket://#{@options['sync_host_ip']}:#{sync_host_port}\""
215
+ cmd = "unison -testserver \"#{@options['src']}\" \"socket://#{@options['sync_host_ip']}:#{sync_host_port}\""
209
216
  say_status 'command', cmd, :white if @options['verbose']
210
217
  attempt = 0
211
218
  max_attempt = @options['max_attempt'] || 5
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugen Mayer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-30 00:00:00.000000000 Z
11
+ date: 2022-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  - !ruby/object:Gem::Version
225
225
  version: '0'
226
226
  requirements: []
227
- rubygems_version: 3.1.4
227
+ rubygems_version: 3.1.6
228
228
  signing_key:
229
229
  specification_version: 4
230
230
  summary: Docker Sync - Fast and efficient way to sync code to docker-containers