docker_rails_proxy 0.1.7 → 0.1.8

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
  SHA256:
3
- metadata.gz: b9b3b25d46ab93efcfe8301c759bc45e0908183af40a8fa90c3f12fe7c5f889f
4
- data.tar.gz: 1519b485518a1cf17b2f4dfe2fcc41ed243cca5ab2a1f4135a80a2514cf4862a
3
+ metadata.gz: fdfc5f1dd0658381390e579aebafb630968d988e7ef84b496fb139295265164b
4
+ data.tar.gz: 981fef93157bce97cd8f767abdb3f79aa81d9161e89c399dbe617ec2767a98c4
5
5
  SHA512:
6
- metadata.gz: ca599ca5b7afe6e5862e11e80244ca42900772eb7376b6bb600fc9f6018b3ce270076b9ef6209c05a8a5fba3f6647adfa9cfa3a4e7cddc5050d5d642eba47528
7
- data.tar.gz: c306ef28db56be3fdd223b62b67affebe4a54e6be809ef6c8b4084c9a4689485edddccd2e16fd65eda32fadd2075fdef8704673057fcf68faad80750d12f34fd
6
+ metadata.gz: b1786efd36b559e38e68ec0ab699acf596455a2229b1d6f483413907044a8ef9fcf68ec4eb9418b9ddb5db82fc8c8690e6be0bdf838bc40947316e61fe178da0
7
+ data.tar.gz: 613b2069af30e06b70064c0e4b73d0046c439d4f3b351e8460e99f44a53b4452d5eb44570f39080fb7665cde023a918cde66f27fc0fb6db680e4faae66fca94c
@@ -1,7 +1,9 @@
1
1
  module DockerRailsProxy
2
2
  module Rsync
3
3
  class << self
4
- attr_accessor :exclusions
4
+ attr_accessor :exclusions,
5
+ :exclusions_from_host_to_container,
6
+ :exclusions_from_container_to_host
5
7
 
6
8
  def included(base)
7
9
  base.extend(ClassMethods)
@@ -19,6 +21,9 @@ module DockerRailsProxy
19
21
  .git*
20
22
  ]
21
23
 
24
+ self.exclusions_from_host_to_container = []
25
+ self.exclusions_from_container_to_host = []
26
+
22
27
  module ClassMethods
23
28
  end
24
29
 
@@ -59,9 +64,12 @@ module DockerRailsProxy
59
64
  end
60
65
 
61
66
  def sync(options)
67
+ return if source_in_exclusions?(options)
62
68
  source, target, volume = normalize_options(options)
63
69
 
64
- result = send "sync_#{volume}", source: source, target: target
70
+ result = send "sync_#{volume}", {
71
+ source: source, target: target, reverse: options[:reverse]
72
+ }
65
73
 
66
74
  if result && options[:silent].eql?(false)
67
75
  puts "#{source} =======> #{target}"
@@ -87,17 +95,19 @@ module DockerRailsProxy
87
95
  [paths.send(reverse ? :reverse : :to_a), values.last].flatten
88
96
  end
89
97
 
90
- def sync_app(source:, target:)
98
+ def sync_app(source:, target:, reverse:)
99
+ exclusions = all_exclusions(reverse: reverse)
100
+
91
101
  system <<-EOS
92
102
  rsync -avqP --no-owner --no-group \
93
- #{Rsync.exclusions.map{ |e| "--exclude '#{e}'" }.join(' '.freeze)} \
103
+ #{exclusions.map{ |e| "--exclude '#{e}'" }.join(' '.freeze)} \
94
104
  --force \
95
105
  --delete \
96
106
  #{source} #{target}
97
107
  EOS
98
108
  end
99
109
 
100
- def sync_gems(source:, target:)
110
+ def sync_gems(source:, target:, **)
101
111
  system <<-EOS
102
112
  rsync -avqP --no-owner --no-group \
103
113
  --exclude '.git*' \
@@ -106,6 +116,22 @@ module DockerRailsProxy
106
116
  #{source} #{target}
107
117
  EOS
108
118
  end
119
+
120
+ def all_exclusions(reverse:)
121
+ one_way_exclusions = if reverse
122
+ Rsync.exclusions_from_container_to_host
123
+ else
124
+ Rsync.exclusions_from_host_to_container
125
+ end
126
+
127
+ Rsync.exclusions + one_way_exclusions
128
+ end
129
+
130
+ def source_in_exclusions?(source:, reverse:, **)
131
+ !!all_exclusions(reverse: reverse).find do |e|
132
+ source.include?("#{APP_PATH}/#{e}")
133
+ end
134
+ end
109
135
  end
110
136
  end
111
137
  end
@@ -1,3 +1,3 @@
1
1
  module DockerRailsProxy
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_rails_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jairo