docker-sync 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6a66d66071e56943968e5b3581954556b94779f
4
- data.tar.gz: cf4e3cbdf71ee5f7452e9f0faaa008c19563a5ba
3
+ metadata.gz: 25a78699ee82484750b206b8a01c8dc9d6321a3c
4
+ data.tar.gz: a03a06fd88f5b1f396e5cdd51423a3608b4761c2
5
5
  SHA512:
6
- metadata.gz: df1b6b6c4d4af970e1654dff1d5e72fd3dd2acae216816c912c6e444276429e787d509efa482d87d83a032b690cace656fd1939851557fffc0d2293e05863519
7
- data.tar.gz: 13447169d54a094279db5afe68b15c12fe43b0f383559f0a36099764742798bf74c19cac3e3d078ee1a396d9721f885bff4e56602b4575e8d480a0226feeb299
6
+ metadata.gz: b83b63b54356843e661d5f29aa819d53a0fbf2661f6e51bd5513530ed5c3a01683afd8f4abac2f332d3685bebcce93cda2817feddcc9c7a019370162fa26af19
7
+ data.tar.gz: bfd090b4b29ce2be0b875ba66ab31764c92e9a6e70fd104d7282e40b6b4c0c806bba17cc66df4994f869127a96f8ed70afe0f73e486b69b4c83100387aa87efe
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -93,15 +93,16 @@ module Docker_Sync
93
93
  end
94
94
  end
95
95
 
96
- def sync_options
97
- args = []
96
+ def expand_ignore_strings
97
+ expanded_ignore_strings = []
98
+
98
99
  exclude_type = 'Path'
99
100
  unless @options['sync_excludes_type'].nil?
100
101
  exclude_type = @options['sync_excludes_type']
101
102
  end
102
103
 
103
104
  unless @options['sync_excludes'].nil?
104
- args = @options['sync_excludes'].map do |pattern|
105
+ expanded_ignore_strings = @options['sync_excludes'].map do |pattern|
105
106
  if exclude_type == 'none'
106
107
  # the ignore type like Name / Path are part of the pattern
107
108
  ignore_string = "#{pattern}"
@@ -109,8 +110,14 @@ module Docker_Sync
109
110
  ignore_string = "#{exclude_type} #{pattern}"
110
111
  end
111
112
  "-ignore='#{ignore_string}'"
112
- end + args
113
+ end
113
114
  end
115
+ expanded_ignore_strings
116
+ end
117
+
118
+ def sync_options
119
+ args = []
120
+ args = expand_ignore_strings + args
114
121
  args.push(@options['src'])
115
122
  args.push('-auto')
116
123
  args.push('-batch')
@@ -129,8 +136,8 @@ module Docker_Sync
129
136
  container_name = get_container_name
130
137
  volume_name = get_volume_name
131
138
  env = {}
132
-
133
- env['UNISON_EXCLUDES'] = @options['sync_excludes'].map { |pattern| "-ignore='Path #{pattern}'" }.join(' ') if @options.key?('sync_excludes')
139
+ ignore_strings = expand_ignore_strings
140
+ env['UNISON_EXCLUDES'] = ignore_strings.join(' ')
134
141
  env['UNISON_OWNER'] = @options['sync_user'] if @options.key?('sync_user')
135
142
  env['MAX_INOTIFY_WATCHES'] = @options['max_inotify_watches'] if @options.key?('max_inotify_watches')
136
143
  if @options['sync_userid'] == 'from_host'
@@ -5,8 +5,11 @@ require 'docker-sync/config'
5
5
  class UpdateChecker
6
6
  include Thor::Shell
7
7
  @config
8
+ @newer_image_found
9
+
8
10
  def initialize
9
11
  @config = DockerSyncConfig::global_config
12
+ @newer_image_found = false
10
13
  end
11
14
 
12
15
  def run
@@ -17,9 +20,21 @@ class UpdateChecker
17
20
  unless should_run
18
21
  return
19
22
  end
20
- check_rsync_image unless DockerSyncConfig::is_first_run # do not check the image if its the first run - since this it will be downloaded anyway
21
- check_unison_onesided_image unless DockerSyncConfig::is_first_run
22
- check_unison_image unless DockerSyncConfig::is_first_run
23
+
24
+ # do not check the image if its the first run - since this it will be downloaded anyway
25
+ unless DockerSyncConfig::is_first_run
26
+ check_rsync_image
27
+ check_unison_onesided_image
28
+ check_unison_image
29
+
30
+ # stop if there was an update
31
+ if @newer_image_found
32
+ say_status 'warning', 'One or more images have been updated. Please use "docker-sync clean" before you start docker-sync again', :red
33
+ exit 0
34
+ end
35
+
36
+ end
37
+
23
38
  check_and_warn(@config['update_enforce'])
24
39
  end
25
40
 
@@ -38,36 +53,36 @@ class UpdateChecker
38
53
  say_status 'ok','Checking if a newer rsync image is available'
39
54
 
40
55
  if system("docker pull eugenmayer/rsync | grep 'Downloaded newer image for'")
41
- say_status 'warning', 'Downloaded newer image for rsync', :red
42
- say_status 'warning', 'Please use "docker-sync clean" before you start docker-sync again', :red
43
-
44
- exit 0
56
+ say_status 'ok', 'Downloaded newer image for rsync', :green
57
+ @newer_image_found = true
58
+ else
59
+ say_status 'ok', 'No newer image found - current image is up to date.'
45
60
  end
46
- say_status 'success','Image is (now) up to date'
61
+
47
62
  end
48
63
 
49
64
  def check_unison_image
50
65
  say_status 'ok','Checking if a newer unison image is available'
51
66
 
52
67
  if system("docker pull eugenmayer/unison:unox | grep 'Downloaded newer image for'")
53
- say_status 'warning', 'Downloaded newer image for unison', :red
54
- say_status 'warning', 'Please use "docker-sync clean" before you start docker-sync again', :red
55
-
56
- exit 0
68
+ say_status 'ok', 'Downloaded newer image for unison', :green
69
+ @newer_image_found = true
70
+ else
71
+ say_status 'ok', 'No newer image found - current image is up to date.'
57
72
  end
58
- say_status 'success','Image is (now) up to date'
73
+
59
74
  end
60
75
 
61
76
  def check_unison_onesided_image
62
77
  say_status 'ok','Checking if a newer unison:onesided image is available'
63
78
 
64
79
  if system("docker pull eugenmayer/unison:onesided | grep 'Downloaded newer image for'")
65
- say_status 'warning', 'Downloaded newer image for unison:onesided', :red
66
- say_status 'warning', 'Please use "docker-sync clean" before you start docker-sync again', :red
67
-
68
- exit 0
80
+ say_status 'ok', 'Downloaded newer image for unison:onesided', :green
81
+ @newer_image_found = true
82
+ else
83
+ say_status 'ok', 'No newer image found - current image is up to date.'
69
84
  end
70
- say_status 'success','Image is (now) up to date'
85
+
71
86
  end
72
87
 
73
88
  def get_current_version
@@ -100,4 +115,4 @@ class UpdateChecker
100
115
  end
101
116
  end
102
117
  end
103
- end
118
+ end
@@ -89,7 +89,7 @@ class Stack < Thor
89
89
 
90
90
  # now shutdown sync
91
91
  @sync_manager.clean(options[:sync_name])
92
- say_status 'success', 'Finished cleanup. Removed stopped, removed sync container and removed there volumes', :green
92
+ say_status 'success', 'Finished cleanup. Removed stopped, removed sync container and removed their volumes', :green
93
93
  end
94
94
  end
95
95
 
@@ -82,7 +82,7 @@ class Sync < Thor
82
82
  end
83
83
  @sync_manager = Docker_sync::SyncManager.new(:config_path => config_path)
84
84
  @sync_manager.clean(options[:sync_name])
85
- say_status 'success', 'Finished cleanup. Removed stopped, removed sync container and removed there volumes', :green
85
+ say_status 'success', 'Finished cleanup. Removed stopped, removed sync container and removed their volumes', :green
86
86
  end
87
87
 
88
88
  desc 'list', 'List all sync-points of the project configuration path'
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.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugen Mayer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-04 00:00:00.000000000 Z
11
+ date: 2016-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor