docker-sync 0.4.1 → 0.4.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
  SHA1:
3
- metadata.gz: 25e94e8b63059e13f3836bf55b2ac0b333cfc2bf
4
- data.tar.gz: 122904ea397e01bcada45ab92244935230d0c403
3
+ metadata.gz: 0dc6a6d17b0c061b6f089c82f25fccdee21b477f
4
+ data.tar.gz: 52d4daa5b8b9aab3e6bb9fd218dd7d324ff55a94
5
5
  SHA512:
6
- metadata.gz: 160f2d4a43d7f4fd26434429ea9c935e3afaf5e15363c4de14b5502cb038a93cd74fffa1d7ba0ea306d6220d5c8ded5433fc48c4f6242a08da2f6d2b64514bab
7
- data.tar.gz: 4169edcfb1926c07ff4e95c1d6bceab1bde258c3cc62213291eddf6a83479499c75582a1c90ed9ceaeb903dce6ac2a03df9842f1195bda52bba64d97c0ab6397
6
+ metadata.gz: 9b1c17a21b47ef1bc4445ad5cfe705e78c64ada480e9f677c0adf1485fe184415b27e94a467b9520da759513baf0fa26f6e23ae03305166ea67e4934ab6b66b1
7
+ data.tar.gz: d1eed5aba038bcfb69f49f49ad09782bdf0b54e435cc539455950fd4860c539e8b194f7dd7a41c0152fa640206a50fcce4a00c7c5867ffcd6d5ab6f4bbb0b2f0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -2,7 +2,7 @@ require 'singleton'
2
2
  require 'docker-sync/config/config_locator'
3
3
  require 'docker-sync/config/config_serializer'
4
4
  require 'forwardable'
5
-
5
+ require 'docker-sync/preconditions/strategy'
6
6
  module DockerSync
7
7
  class ProjectConfig
8
8
  extend Forwardable
@@ -134,9 +134,14 @@ module DockerSync
134
134
  end
135
135
 
136
136
  def default_sync_strategy
137
- case true
138
- when OS.linux? then 'native'
139
- else 'native_osx'
137
+ if OS.linux?
138
+ return 'native'
139
+ elsif OS.osx?
140
+ if DockerSync::Preconditions::Strategy.instance.is_driver_docker_for_mac?
141
+ return 'native_osx'
142
+ else
143
+ return 'unison'
144
+ end
140
145
  end
141
146
  end
142
147
 
@@ -145,7 +150,7 @@ module DockerSync
145
150
  when 'rsync' then 'fswatch'
146
151
  when 'unison' then 'unison'
147
152
  when 'native' then 'dummy'
148
- when 'native_osx' then 'dummy'
153
+ when 'native_osx' then 'remotelogs'
149
154
  else raise "you shouldn't be here"
150
155
  end
151
156
  end
@@ -9,6 +9,7 @@ require 'docker-sync/sync_strategy/native_osx'
9
9
  require 'docker-sync/watch_strategy/fswatch'
10
10
  require 'docker-sync/watch_strategy/dummy'
11
11
  require 'docker-sync/watch_strategy/unison'
12
+ require 'docker-sync/watch_strategy/remotelogs'
12
13
 
13
14
  module Docker_Sync
14
15
  class SyncProcess
@@ -62,6 +63,8 @@ module Docker_Sync
62
63
  @watch_strategy = Docker_Sync::WatchStrategy::Dummy.new(@sync_name, @options)
63
64
  when 'unison'
64
65
  @watch_strategy = Docker_Sync::WatchStrategy::Unison.new(@sync_name, @options)
66
+ when 'remotelogs'
67
+ @watch_strategy = Docker_Sync::WatchStrategy::Remote_logs.new(@sync_name, @options)
65
68
  else
66
69
  raise "Unknown watch_strategy #{@options['watch_strategy']}"
67
70
  end
@@ -1,6 +1,7 @@
1
1
  require 'gem_update_checker'
2
2
  require 'thor/actions'
3
3
  require 'docker-sync/config/global_config'
4
+ require 'docker-sync/update_check'
4
5
 
5
6
  class UpgradeChecker
6
7
  include Thor::Shell
@@ -94,6 +95,17 @@ class UpgradeChecker
94
95
  end
95
96
  end
96
97
 
98
+ if Gem::Version.new(last_upgraded_version) < Gem::Version.new('0.4.2')
99
+ checker = UpdateChecker.new
100
+ checker.check_unison_hostsync_image
101
+
102
+ Thor::Shell::Basic.new.say_status 'warning', "The native_osx is NOW ONLY for docker-for-mac, this is due to https://github.com/EugenMayer/docker-sync/issues/346\n\nThat means, that unison is picked as a default automatically, if you use docker-machine", :red
103
+
104
+ unless Thor::Shell::Basic.new.yes?('Just wanted you to no that! (y/N)')
105
+ exit 1
106
+ end
107
+ end
108
+
97
109
  # update the upgrade_status
98
110
  @config.update! 'upgrade_status' => "#{UpgradeChecker.get_current_version}"
99
111
  end
@@ -0,0 +1,50 @@
1
+ require 'thor/shell'
2
+ require 'docker-sync/execution'
3
+
4
+ module Docker_Sync
5
+ module WatchStrategy
6
+ class Remote_logs
7
+ include Thor::Shell
8
+ include Execution
9
+
10
+ @options
11
+ @sync_name
12
+ @watch_fork
13
+ @watch_thread
14
+
15
+ def initialize(sync_name, options)
16
+ @options = options
17
+ @sync_name = sync_name
18
+ @watch_fork = nil
19
+ @watch_thread = nil
20
+ @unison = Docker_Sync::SyncStrategy::Unison.new(@sync_name, @options)
21
+ end
22
+
23
+ def run
24
+ say_status 'success', "Showing unison logs from your sync container: #{@unison.get_container_name}", :green
25
+ cmd = "docker exec #{@unison.get_container_name} tail -f /tmp/unison.log"
26
+ @watch_thread = threadexec(cmd, 'Sync Log:')
27
+ end
28
+
29
+ def stop
30
+ end
31
+
32
+ def clean
33
+ end
34
+
35
+ def watch
36
+ end
37
+
38
+ def watch_options
39
+ end
40
+
41
+ def watch_fork
42
+ return @watch_fork
43
+ end
44
+
45
+ def watch_thread
46
+ return @watch_thread
47
+ end
48
+ end
49
+ end
50
+ end
@@ -12,8 +12,14 @@ class Stack < Thor
12
12
  class_option :sync_name, :aliases => '-n', :type => :string, :desc => 'If given, only this sync configuration will be references/started/synced'
13
13
  class_option :version, :aliases => '-v',:type => :boolean, :default => false, :desc => 'prints out the version of docker-sync and exits'
14
14
 
15
- desc 'start', 'Start sync services, watcher and then your docker-compose defined stack'
15
+ desc '--version, -v', 'Prints out the version of docker-sync and exits'
16
+ def print_version
17
+ puts UpgradeChecker.get_current_version
18
+ exit(0)
19
+ end
20
+ map %w[--version -v] => :print_version
16
21
 
22
+ desc 'start', 'Start sync services, watcher and then your docker-compose defined stack'
17
23
  def start
18
24
  if options[:version]
19
25
  puts UpgradeChecker.get_current_version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugen Mayer
@@ -173,6 +173,7 @@ files:
173
173
  - lib/docker-sync/upgrade_check.rb
174
174
  - lib/docker-sync/watch_strategy/dummy.rb
175
175
  - lib/docker-sync/watch_strategy/fswatch.rb
176
+ - lib/docker-sync/watch_strategy/remotelogs.rb
176
177
  - lib/docker-sync/watch_strategy/unison.rb
177
178
  - tasks/daemon/daemon.thor
178
179
  - tasks/stack/stack.thor