docker-sync 0.0.14 → 0.0.15

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: 5a467b9dee71d933110ea66148ac480c7ed3d9b0
4
- data.tar.gz: 1533c522f6aa5db93e15d85e4b8a53f61f350e2a
3
+ metadata.gz: f91f3a2eb84005eb9ecd865282ace48c86f2f2c4
4
+ data.tar.gz: 3a5ca77ceab1cbe91ae630c6cd7c102db467f0c2
5
5
  SHA512:
6
- metadata.gz: 3dfb30f05807f691089c1e106934a29e2bfa54794994b6d7180789824052e1f18532e239058b91f1989b8779c27bbfe58a2adf7db6eaa7c06c1ebc72b2b41004
7
- data.tar.gz: c09c3b2a2e6615302bf5593e6f5472fa7f364a96e3183a421c09d911042fd20bad5ae0a2e83005f821b0e2883eebd15d4307aa178564b28f1256119b94785c5a
6
+ metadata.gz: 35de54d7b90e0dd76617a8ad102cea41ff8c837904790f96313c8943eb5b9c7e13249bfa3209673788fec538eb9784f173393dddfeff6f81e8a967be10feceda
7
+ data.tar.gz: 30776d4c9c53279ffa349ac44f50efb9b204a7577678d67c44baaeef5131f94eab02e62d28ae423dbd641e3a62f7ae5fe7d0f9b8f86bf8a6bc38ba799adac901
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.14
1
+ 0.0.15
@@ -16,7 +16,7 @@ module Docker_Rsync
16
16
  def initialize(options)
17
17
  @sync_processes = []
18
18
  @config_syncs = []
19
- @config_options = []
19
+ @config_global = []
20
20
  @config_path = options[:config_path]
21
21
  load_configuration
22
22
  end
@@ -28,13 +28,13 @@ module Docker_Rsync
28
28
 
29
29
  config = YAML.load_file(@config_path)
30
30
  validate_config(config)
31
- @config_options = config['options'] || {}
31
+ @config_global = config['options'] || {}
32
32
  @config_syncs = config['syncs']
33
33
  upgrade_syncs_config
34
34
  end
35
35
 
36
36
  def global_options
37
- return @config_options
37
+ return @config_global
38
38
  end
39
39
 
40
40
  def get_sync_points
@@ -46,12 +46,13 @@ module Docker_Rsync
46
46
  @config_syncs[name]['config_path'] = @config_path
47
47
  # expand the sync source to remove ~ and similar expressions in the path
48
48
  @config_syncs[name]['src'] = File.expand_path(@config_syncs[name]['src'], File.dirname(@config_path))
49
+ @config_syncs[name]['cli_mode'] = @config_global['cli_mode'] || 'auto'
49
50
 
50
51
  # set the global verbose setting, if the sync-endpoint does not define a own one
51
52
  unless config.key?('verbose')
52
53
  @config_syncs[name]['verbose'] = false
53
- if @config_options.key?('verbose')
54
- @config_syncs[name]['verbose'] = @config_options['verbose']
54
+ if @config_global.key?('verbose')
55
+ @config_syncs[name]['verbose'] = @config_global['verbose']
55
56
  end
56
57
  end
57
58
 
@@ -1,5 +1,6 @@
1
1
  require 'thor/shell'
2
2
  require 'docker-sync/preconditions'
3
+ require 'terminal-notifier'
3
4
 
4
5
  module Docker_Sync
5
6
  module SyncStrategy
@@ -45,6 +46,9 @@ module Docker_Sync
45
46
  say_status 'error', "Error starting sync, exit code #{$?.exitstatus}", :red
46
47
  say_status 'message', out
47
48
  else
49
+ TerminalNotifier.notify(
50
+ "Synced #{@options['src']}", :title => @sync_name
51
+ ) if @options['notify_terminal']
48
52
  say_status 'ok', "Synced #{@options['src']}", :white
49
53
  if @options['verbose']
50
54
  say_status 'output', out
@@ -2,6 +2,7 @@ require 'thor/shell'
2
2
  require 'docker-sync/preconditions'
3
3
  require 'open3'
4
4
  require 'socket'
5
+ require 'terminal-notifier'
5
6
 
6
7
  module Docker_Sync
7
8
  module SyncStrategy
@@ -48,6 +49,9 @@ module Docker_Sync
48
49
  say_status 'error', "Error starting sync, exit code #{$?.exitstatus}", :red
49
50
  say_status 'message', stderr
50
51
  else
52
+ TerminalNotifier.notify(
53
+ "Synced #{@options['src']}", :title => @sync_name
54
+ ) if @options['notify_terminal']
51
55
  say_status 'ok', "Synced #{@options['src']}", :white
52
56
  if @options['verbose']
53
57
  say_status 'output', stdout
@@ -118,7 +122,7 @@ module Docker_Sync
118
122
  else
119
123
  say_status 'ok', "#{container_name} container still running", :blue
120
124
  end
121
- say_status 'ok', "starting initial #{container_name} of src", :white if @options['verbose']
125
+ say_status 'ok', "starting initial sync of #{container_name}", :white if @options['verbose']
122
126
  # this sleep is needed since the container could be not started
123
127
  sleep 5 # TODO: replace with unison -testserver
124
128
  sync
@@ -1,6 +1,7 @@
1
1
  require 'thor/shell'
2
2
  require 'docker-sync/preconditions'
3
3
  require 'open3'
4
+ require 'terminal-notifier'
4
5
 
5
6
  module Docker_Sync
6
7
  module SyncStrategy
@@ -45,6 +46,9 @@ module Docker_Sync
45
46
  say_status 'error', "Error starting sync, exit code #{$?.exitstatus}", :red
46
47
  say_status 'message', stderr
47
48
  else
49
+ TerminalNotifier.notify(
50
+ "Synced #{@options['src']}", :title => @sync_name
51
+ ) if @options['notify_terminal']
48
52
  say_status 'ok', "Synced #{@options['src']}", :white
49
53
  if @options['verbose']
50
54
  say_status 'output', stdout
@@ -91,7 +95,7 @@ module Docker_Sync
91
95
  else
92
96
  say_status 'ok', "#{container_name} container still running", :blue
93
97
  end
94
- say_status 'ok', "starting initial #{container_name} of src", :white if @options['verbose']
98
+ say_status 'ok', "starting initial sync of #{container_name}", :white if @options['verbose']
95
99
  # this sleep is needed since the container could be not started
96
100
  sleep 1
97
101
  sync
@@ -55,17 +55,33 @@ module Docker_Sync
55
55
  args.push(@events_to_watch.map { |pattern| "--event #{pattern}" })
56
56
  args.push(@options['watch_args']) if @options.key?('watch_args')
57
57
  args.push(@options['src'])
58
-
59
- sync_command = 'thor sync:sync'
60
- exec_name =File.basename($PROGRAM_NAME)
61
- if exec_name != 'thor'
62
- sync_command = 'docker-sync sync'
63
- else
64
- say_status 'warning', 'Called user thor, not docker-sync* wise, assuming dev mode, using thor', :yellow
65
- end
58
+ sync_command = get_sync_cli_call
66
59
  args.push(" | xargs -I -n1 #{sync_command} -n #{@sync_name} --config='#{@options['config_path']}'")
67
60
  end
68
61
 
62
+ def get_sync_cli_call
63
+ sync_command = 'thor sync:'
64
+ case @options['cli_mode']
65
+ when 'docker-sync'
66
+ say_status 'ok','Forcing cli mode docker-sync',:yellow if @options['verbose']
67
+ sync_command = 'docker-sync '
68
+ when 'thor'
69
+ say_status 'ok','Forcing cli mode thor',:yellow if @options['verbose']
70
+ sync_command = 'thor sync:'
71
+ else # 'auto' or any other, try to guss
72
+ say_status 'ok','Cli mode is auto, selecting .. ',:white if @options['verbose']
73
+ exec_name = File.basename($PROGRAM_NAME)
74
+ if exec_name != 'thor'
75
+ sync_command = 'docker-sync '
76
+ else
77
+ say_status 'warning', 'Called user thor, not docker-sync* wise, assuming dev mode, using thor', :yellow
78
+ end
79
+ say_status 'ok',".. #{sync_command}",:white if @options['verbose']
80
+ end
81
+
82
+ # append the actual operation
83
+ return "#{sync_command}sync"
84
+ end
69
85
  def watch_thread
70
86
  return @watch_thread
71
87
  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.0.14
4
+ version: 0.0.15
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-07-16 00:00:00.000000000 Z
11
+ date: 2016-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -64,6 +64,20 @@ dependencies:
64
64
  - - '='
65
65
  - !ruby/object:Gem::Version
66
66
  version: 0.8.3
67
+ - !ruby/object:Gem::Dependency
68
+ name: terminal-notifier
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '='
72
+ - !ruby/object:Gem::Version
73
+ version: 1.6.3
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '='
79
+ - !ruby/object:Gem::Version
80
+ version: 1.6.3
67
81
  description: Sync your code live to docker-containers without losing any performance
68
82
  on OSX
69
83
  email: eugen.mayer@kontextwork.de