docker-sync 0.1.1 → 0.1.2
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 +4 -4
- data/VERSION +1 -1
- data/lib/docker-sync/compose.rb +1 -2
- data/lib/docker-sync/preconditions.rb +11 -5
- data/lib/docker-sync/sync_process.rb +1 -1
- data/lib/docker-sync/sync_strategy/rsync.rb +2 -2
- data/lib/docker-sync/sync_strategy/unison-onesided.rb +2 -2
- data/lib/docker-sync/sync_strategy/unison.rb +17 -4
- data/tasks/sync/sync.thor +0 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3910d6ffb6de84e75c09c017b98179fc2392c380
|
4
|
+
data.tar.gz: ad1c1e5f030116680834323636be0b6337637c45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 790a319c6efb072a0b45d6f1cb80d5fa0354859324786150a16b133df016c10ab1d21507f25d7ec0b374292ffe6acb0d1419e37288243028fb65ba4ae9fc8263
|
7
|
+
data.tar.gz: 2b1c23f585760a9f55a33de7181f53a241ebf45d33dfbbe5323827949a145feea66a159762784bd9c810122ed2f655b5f78dc5d9d56ecbde3e8255d79e3d0a98
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/docker-sync/compose.rb
CHANGED
@@ -48,12 +48,18 @@ module Preconditions
|
|
48
48
|
if (find_executable0 'unison-fsmonitor').nil?
|
49
49
|
cmd1 = 'curl "https://raw.githubusercontent.com/hnsl/unox/master/unox.py" -o "/usr/local/bin/unison-fsmonitor" \
|
50
50
|
&& chmod +x /usr/local/bin/unison-fsmonitor'
|
51
|
-
cmd2 = 'easy_install pip && pip install macfsevents'
|
51
|
+
cmd2 = 'sudo easy_install pip && sudo pip install macfsevents'
|
52
52
|
Thor::Shell::Basic.new.say_status 'warning', 'Could not find unison-fsmonitor (for file watching) binary in $PATH. Please install unox before you continue, see https://github.com/hnsl/unox.', :yellow
|
53
|
-
if Thor::Shell::Basic.new.yes?('Shall I install unison-fsmonitor for you?')
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
if Thor::Shell::Basic.new.yes?('Shall I install unison-fsmonitor for you? ')
|
54
|
+
system cmd1
|
55
|
+
if $?.exitstatus > 0
|
56
|
+
raise('Failed to install unison-fsmonitor, please file an issue with the output of the error')
|
57
|
+
end
|
58
|
+
Thor::Shell::Basic.new.say_status 'ok','install macfsevents using pip (This will ask for sudo, since we use the system python)', :yellow
|
59
|
+
system cmd2
|
60
|
+
if $?.exitstatus > 0
|
61
|
+
raise('Failed to install macfsevents, please file an issue with the output of the error')
|
62
|
+
end
|
57
63
|
else
|
58
64
|
raise("Please install it, see https://github.com/hnsl/unox, or simply run :\n #{cmd1} && #{cmd2}")
|
59
65
|
end
|
@@ -87,10 +87,10 @@ module Docker_Sync
|
|
87
87
|
say_status 'ok', 'Starting rsync', :white
|
88
88
|
container_name = get_container_name
|
89
89
|
volume_name = get_volume_name
|
90
|
-
running = `docker ps --filter 'status=running' --filter 'name=#{container_name}'
|
90
|
+
running = `docker ps --filter 'status=running' --filter 'name=#{container_name}' --format "{{.Names}}" | grep '^#{container_name}$'`
|
91
91
|
if running == '' # container is yet not running
|
92
92
|
say_status 'ok', "#{container_name} container not running", :white if @options['verbose']
|
93
|
-
exists = `docker ps --filter "status=exited" --filter "name=#{container_name}"
|
93
|
+
exists = `docker ps --filter "status=exited" --filter "name=#{container_name}" --format "{{.Names}}" | grep '^#{container_name}$'`
|
94
94
|
if exists == '' # container has yet not been created
|
95
95
|
say_status 'ok', "creating #{container_name} container", :white if @options['verbose']
|
96
96
|
|
@@ -78,10 +78,10 @@ module Docker_Sync
|
|
78
78
|
say_status 'ok', 'Starting unison', :white
|
79
79
|
container_name = get_container_name
|
80
80
|
volume_name = get_volume_name
|
81
|
-
running = `docker ps --filter 'status=running' --filter 'name=#{container_name}'
|
81
|
+
running = `docker ps --filter 'status=running' --filter 'name=#{container_name}' --format "{{.Names}}" | grep '^#{container_name}$'`
|
82
82
|
if running == ''
|
83
83
|
say_status 'ok', "#{container_name} container not running", :white if @options['verbose']
|
84
|
-
exists = `docker ps --filter "status=exited" --filter "name=#{container_name}"
|
84
|
+
exists = `docker ps --filter "status=exited" --filter "name=#{container_name}" --format "{{.Names}}" | grep '^#{container_name}$'`
|
85
85
|
if exists == ''
|
86
86
|
say_status 'ok', "creating #{container_name} container", :white if @options['verbose']
|
87
87
|
cmd = "docker run -p '#{@options['sync_host_port']}:#{UNISON_CONTAINER_PORT}' -v #{volume_name}:#{@options['dest']} -e UNISON_DIR=#{@options['dest']} -e TZ=${TZ-`readlink /etc/localtime | sed -e 's,/usr/share/zoneinfo/,,'`} --name #{container_name} -d #{@docker_image}"
|
@@ -80,6 +80,7 @@ module Docker_Sync
|
|
80
80
|
stdout, stderr, exit_status = Open3.capture3(cmd)
|
81
81
|
if not exit_status.success?
|
82
82
|
say_status 'error', "Error starting sync, exit code #{$?.exitstatus}", :red
|
83
|
+
say_status 'message', stdout
|
83
84
|
say_status 'message', stderr
|
84
85
|
else
|
85
86
|
TerminalNotifier.notify(
|
@@ -94,9 +95,21 @@ module Docker_Sync
|
|
94
95
|
|
95
96
|
def sync_options
|
96
97
|
args = []
|
98
|
+
exclude_type = 'Path'
|
99
|
+
unless @options['sync_excludes_type'].nil?
|
100
|
+
exclude_type = @options['sync_excludes_type']
|
101
|
+
end
|
97
102
|
|
98
103
|
unless @options['sync_excludes'].nil?
|
99
|
-
args = @options['sync_excludes'].map
|
104
|
+
args = @options['sync_excludes'].map do |pattern|
|
105
|
+
if exclude_type == 'none'
|
106
|
+
# the ignore type like Name / Path are part of the pattern
|
107
|
+
ignore_string = "#{pattern}"
|
108
|
+
else
|
109
|
+
ignore_string = "#{exclude_type} #{pattern}"
|
110
|
+
end
|
111
|
+
"-ignore='#{ignore_string}'"
|
112
|
+
end + args
|
100
113
|
end
|
101
114
|
args.push(@options['src'])
|
102
115
|
args.push('-auto')
|
@@ -127,14 +140,14 @@ module Docker_Sync
|
|
127
140
|
end
|
128
141
|
|
129
142
|
additional_docker_env = env.map{ |key,value| "-e #{key}=\"#{value}\"" }.join(' ')
|
130
|
-
running = `docker ps --filter 'status=running' --filter 'name=#{container_name}'
|
143
|
+
running = `docker ps --filter 'status=running' --filter 'name=#{container_name}' --format "{{.Names}}" | grep '^#{container_name}$'`
|
131
144
|
if running == ''
|
132
145
|
say_status 'ok', "#{container_name} container not running", :white if @options['verbose']
|
133
|
-
exists = `docker ps --filter "status=exited" --filter "name=#{container_name}"
|
146
|
+
exists = `docker ps --filter "status=exited" --filter "name=#{container_name}" --format "{{.Names}}" | grep '^#{container_name}$'`
|
134
147
|
if exists == ''
|
135
148
|
say_status 'ok', "creating #{container_name} container", :white if @options['verbose']
|
136
149
|
run_privileged = '--privileged' if @options.key?('max_inotify_watches') #TODO: replace by the minimum capabilities required
|
137
|
-
cmd = "docker run -p '
|
150
|
+
cmd = "docker run -p '#{@options['sync_host_ip']}::#{UNISON_CONTAINER_PORT}' \
|
138
151
|
-v #{volume_name}:#{@options['dest']} \
|
139
152
|
-e UNISON_DIR=#{@options['dest']} \
|
140
153
|
-e TZ=${TZ-`readlink /etc/localtime | sed -e 's,/usr/share/zoneinfo/,,'`} \
|
data/tasks/sync/sync.thor
CHANGED
@@ -114,11 +114,4 @@ class Sync < Thor
|
|
114
114
|
print_table(config) if options['verbose']
|
115
115
|
end
|
116
116
|
end
|
117
|
-
desc 'start', 'Start all sync configurations in this project'
|
118
|
-
def upgrade
|
119
|
-
# do run update check in the start command only
|
120
|
-
upgrades = UpgradeChecker.new
|
121
|
-
upgrades.run
|
122
|
-
end
|
123
|
-
|
124
117
|
end
|
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
|
+
version: 0.1.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: 2016-08-
|
11
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|