docker-sync 0.5.7 → 0.5.8

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
- SHA1:
3
- metadata.gz: d9b0bbe3c46dc3198195f56ecade1577fe9ae97a
4
- data.tar.gz: f54093017e0e51194753815902d87feee75db211
2
+ SHA256:
3
+ metadata.gz: ecc935b13c597ecb9e2beaf3a75881c58d5c386d6df3e937cdb07b15ccee88d7
4
+ data.tar.gz: 381e33ab0456a9974c31128de0603ae15e1f566d901f260783bc6acc79be75ee
5
5
  SHA512:
6
- metadata.gz: cd43a0bc62654a748ea0bd13603cde76151879e9a755dc1ef5946de6c495ea7f4a1b98a0e1427335f28824eae6141cf12e527aa76540d3165f2ce07d5cff21b7
7
- data.tar.gz: 20a97b141f4f6651d1528c064145f208352f9ae17e0c29d8a62cc17d08f892634dec74184f3d90952381f5fc5c39c2bfbe829d355f1034bd07fe2a00707555ef
6
+ metadata.gz: fec25c5c03c77cea81f99cafa27457063033b2d077942864e6c8d8962c83958046016c20392bced7204ef8c3dabfe20236180d77145f51cbfdcd228b39712e4b
7
+ data.tar.gz: b0281a5d8449aa08b0e3bd3fd1829c6a54cb41495fe61ca5f6b9d48ac857e79631a582b9fa15a7eec347176f3a8aab5e8c7e7b508eca852551babfd5f1c6c364
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.7
1
+ 0.5.8
@@ -23,7 +23,14 @@ module DockerSync
23
23
  Docker.ensure!
24
24
  Unison.ensure! if config.unison_required?
25
25
  Rsync.ensure! if config.rsync_required?
26
- Fswatch.ensure! if config.fswatch_required?
26
+ if config.fswatch_required?
27
+ unless Fswatch.available?
28
+ Fswatch.ensure!
29
+ puts "please restart docker sync so the installation of fswatch takes effect"
30
+ raise(UNSUPPORTED_OPERATING_SYSTEM)
31
+ end
32
+ end
33
+
27
34
  end
28
35
 
29
36
  def self.ensure_all_for_linux!(_config)
@@ -11,7 +11,7 @@ module DockerSync
11
11
 
12
12
  def self.running?
13
13
  return @running if defined? @running
14
- @running = system('docker ps &> /dev/null')
14
+ @running = system('docker ps 2>&1 > /dev/null')
15
15
  end
16
16
 
17
17
  def self.ensure!
@@ -13,7 +13,7 @@ module DockerSync
13
13
 
14
14
  def self.available?
15
15
  return @available if defined? @available
16
- cmd = 'brew list unox &> /dev/null'
16
+ cmd = 'brew list unox 2>&1 > /dev/null'
17
17
  @available = defined?(Bundler) ? Bundler.clean_system(cmd) : system(cmd)
18
18
  end
19
19
 
@@ -71,6 +71,21 @@ module DockerSync
71
71
  return args
72
72
  end
73
73
 
74
+ # sleep until rsync --dry-run succeeds in connecting to the daemon on the configured IP and port.
75
+ def health_check
76
+ health_check_cmd = "rsync --dry-run rsync://#{@options['sync_host_ip']}:#{@options['sync_host_port']}:: 2> /dev/null"
77
+
78
+ retry_counter = 0
79
+
80
+ health_check_status = `#{health_check_cmd}`
81
+ while health_check_status == '' && retry_counter < 10 do
82
+ say_status 'ok', "waiting for rsync daemon on rsync://#{@options['sync_host_ip']}:#{@options['sync_host_port']}", :white if @options['verbose']
83
+ retry_counter += 1
84
+ health_check_status = `#{health_check_cmd}`
85
+ sleep 1
86
+ end
87
+ end
88
+
74
89
  def get_container_name
75
90
  return "#{@sync_name}"
76
91
  end
@@ -109,8 +124,8 @@ module DockerSync
109
124
  say_status 'ok', "#{container_name} container still running", :blue if @options['verbose']
110
125
  end
111
126
  say_status 'ok', "#{container_name}: starting initial sync of #{@options['src']}", :white if @options['verbose']
112
- # this sleep is needed since the container could be not started
113
- sleep 3
127
+
128
+ health_check
114
129
  sync
115
130
  say_status 'success', 'Rsync server started', :green
116
131
  end
@@ -70,20 +70,6 @@ class UpdateChecker
70
70
 
71
71
  end
72
72
 
73
- def check_unison_image
74
- return # we do not need this anymore since we use versioned ( tagged ) images and they will be pulled autoamtically if they are missing
75
- return if ENV['DOCKER_SYNC_SKIP_UPDATE']
76
- say_status 'ok','Checking if a newer unison image is available'
77
-
78
- if system("docker pull eugenmayer/unison:2.51.2.1 | grep 'Downloaded newer image for'")
79
- say_status 'ok', 'Downloaded newer image for unison', :green
80
- @newer_image_found = true
81
- else
82
- say_status 'ok', 'No newer image found - current image is up to date.'
83
- end
84
-
85
- end
86
-
87
73
  def get_current_version
88
74
  path = File.expand_path('../../../', __FILE__)
89
75
  version = File.read("#{path}/VERSION")
@@ -103,7 +89,7 @@ class UpdateChecker
103
89
  # update the timestamp
104
90
  @config.update! 'update_last_check' => DateTime.now.iso8601(9)
105
91
 
106
- check = docker_sync_update_check
92
+ check = docker_sync_update_check7
107
93
  if check.update_available
108
94
  say_status 'warning',"There is an update (#{check.latest_version}) available (current version #{check.current_version}). Please update before you continue",:yellow
109
95
  if yes?("Shall I update docker-sync to #{check.latest_version} for you?")
@@ -17,12 +17,17 @@ module DockerSync
17
17
  @options = options
18
18
  @events_to_watch = %w(AttributeModified Created Link MovedFrom MovedTo Renamed Removed Updated)
19
19
 
20
- begin
21
- Dependencies::Fswatch.ensure!
22
- rescue StandardError => e
23
- say_status 'error', e.message, :red
24
- exit 1
25
- end
20
+ unless Dependencies::Fswatch.available?
21
+ begin
22
+ Dependencies::Fswatch.ensure!
23
+ rescue StandardError => e
24
+ say_status 'error', e.message, :red
25
+ exit 1
26
+ end
27
+ puts "please restart docker sync so the installation of fswatch takes effect"
28
+ raise(UNSUPPORTED_OPERATING_SYSTEM)
29
+ end
30
+
26
31
  end
27
32
 
28
33
  def run
@@ -27,8 +27,11 @@ module DockerSync
27
27
  end
28
28
 
29
29
  def stop
30
- Process.kill 'TERM', @watch_fork
31
- Process.wait @watch_fork
30
+ # Make sure @watch_fork is not nil otherwise a TypeError is thrown
31
+ if @watch_fork
32
+ Process.kill 'TERM', @watch_fork
33
+ Process.wait @watch_fork
34
+ end
32
35
  end
33
36
 
34
37
  def clean
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.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugen Mayer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-28 00:00:00.000000000 Z
11
+ date: 2018-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  version: '0'
226
226
  requirements: []
227
227
  rubyforge_project:
228
- rubygems_version: 2.5.2
228
+ rubygems_version: 2.7.6
229
229
  signing_key:
230
230
  specification_version: 4
231
231
  summary: Docker Sync - Fast and efficient way to sync code to docker-containers