docker-sync 0.0.12 → 0.0.13

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: 22787f972ef84ff342df17b05894ec25b79ec521
4
- data.tar.gz: 5d7a83c05ec3194d7292b9f2ab2798bfc9909c76
3
+ metadata.gz: 53b015ea9a91c28a2a853b611f3f0ffc69897cf3
4
+ data.tar.gz: 932bbd68a8ea5543626dd4be5e70bdc541efd4c9
5
5
  SHA512:
6
- metadata.gz: 4a5141387dd95c343f467c9d72bc32038b953e2ec56d5d71ff8e378b667a230333bb8345c5bc049c31c7e6e5d2fa8a9a2c54ea8eef7b1d7eef427adcf1603f12
7
- data.tar.gz: 8ddf36c4068404754d969de94d00a70ea56a528f4d127fc600b7d01d656f39b2430e6bc63f30c55a4cba4df85a7555875e6474bb0747e1277f93d7d6009c7f68
6
+ metadata.gz: abdd92bb2321085d92b156968a9dd2ece9a65a1dfb655baf2a427308b21cda65a67326d15c2b7a805dfd3e351f378825427c0036706866750458eb305b1fb13b
7
+ data.tar.gz: a8ea319b00c764d183baffe56de3ab2ada13b02df3291d304dd7c0ee1d59415d239e1a4af71d3ff2e351963b4bda44fb53f702b3fd5a9c73fa0fa92873a1fcd4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.12
1
+ 0.0.13
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ file = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
3
+ $LOAD_PATH.unshift File.expand_path('../../lib', file)
3
4
 
4
5
  require 'thor'
5
6
  require 'docker-sync/update_check'
6
7
 
7
- thor = File.expand_path('../../tasks/sync', __FILE__)
8
+ thor = File.expand_path('../../tasks/sync', file)
8
9
  Dir.glob(File.join(thor, '/**/*.thor')).each { |taskfile|
9
10
  load taskfile
10
11
  }
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ file = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
3
+ $LOAD_PATH.unshift File.expand_path('../../lib', file)
4
+
3
5
 
4
6
  require 'thor'
5
7
  require 'docker-sync/update_check'
@@ -14,7 +16,7 @@ require 'docker-sync/update_check'
14
16
  # exit 0
15
17
  #end
16
18
 
17
- thor = File.expand_path('../../tasks/stack', __FILE__)
19
+ thor = File.expand_path('../../tasks/stack', file)
18
20
  Dir.glob(File.join(thor, '/**/*.thor')).each { |taskfile|
19
21
  # noinspection RubyResolve
20
22
  load taskfile
@@ -1,20 +1,43 @@
1
1
  require 'docker/compose'
2
-
2
+ require 'pp'
3
3
  class ComposeManager
4
4
  include Thor::Shell
5
5
  @compose_session
6
6
  @global_options
7
7
  def initialize(global_options)
8
8
  @global_options = global_options
9
- compose_file_path = 'docker-compose.yml'
9
+
10
+ ### production docker-compose.yml
11
+ compose_files = [File.expand_path('docker-compose.yml')]
10
12
  if @global_options.key?('compose-file-path')
11
13
  path = File.expand_path(@global_options['compose-file-path'])
12
14
  unless File.exist?(path)
13
15
  raise("Your referenced docker-compose file in docker-sync.yml was not found at #{@global_options['compose-file-path']}")
14
16
  end
15
- compose_file_path = @global_options['compose-file-path']
17
+ compose_files = [path] # replace
18
+ end
19
+
20
+ ### development docker-compose-dev.yml
21
+ if @global_options.key?('compose-dev-file-path')
22
+ # explicit path given
23
+ path = File.expand_path(@global_options['compose-dev-file-path'])
24
+ unless File.exist?(path)
25
+ raise("Your referenced docker-compose-dev file in docker-sync.yml was not found at #{@global_options['compose-dev-file-path']}")
26
+ end
27
+ say_status 'ok',"Found explicit docker-compose-dev.yml and using it from #{@global_options['compose-dev-file-path']}", :green
28
+ compose_files.push path # add
29
+ else
30
+ # try to find docker-compose-dev.yml
31
+ e = compose_files.to_enum
32
+ production_compose_file = File.expand_path(e.peek)
33
+ working_dir = File.dirname(production_compose_file)
34
+ compose_dev_path = "#{working_dir}/docker-compose-dev.yml"
35
+ if File.exist?(compose_dev_path)
36
+ say_status 'ok',"Found implicit docker-compose-dev.yml and using it from #{compose_dev_path}", :green
37
+ compose_files.push compose_dev_path
38
+ end
16
39
  end
17
- @compose_session = Docker::Compose::Session.new(dir:'./', :file => compose_file_path)
40
+ @compose_session = Docker::Compose::Session.new(dir:'./', :file => compose_files)
18
41
  end
19
42
 
20
43
  def run
@@ -44,17 +44,15 @@ class Stack < Thor
44
44
 
45
45
  begin
46
46
  compose_thread.join
47
- #@sync_manager.join_threads
48
- rescue SystemExit, Interrupt
49
- say_status 'shutdown', 'Shutting down...', :blue
50
-
51
- @sync_manager.stop
52
- @compose_manager.stop
53
- rescue Exception => e
54
-
55
- puts "EXCEPTION: #{e.inspect}"
56
- puts "MESSAGE: #{e.message}"
47
+ #@sync_manager.join_threads
48
+ rescue SystemExit, Interrupt
49
+ say_status 'shutdown', 'Shutting down...', :blue
57
50
 
51
+ @sync_manager.stop
52
+ @compose_manager.stop
53
+ rescue Exception => e
54
+ puts "EXCEPTION: #{e.inspect}"
55
+ puts "MESSAGE: #{e.message}"
58
56
  end
59
57
  end
60
58
 
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.12
4
+ version: 0.0.13
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-12 00:00:00.000000000 Z
11
+ date: 2016-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor