mdbm_dist_support 0.1.3 → 0.1.4
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/Gemfile.lock +1 -1
- data/lib/mdbm_dist_support/distributer.rb +12 -7
- data/lib/mdbm_dist_support/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2152dd130c4370da1d2036f07ec8c5291b70a4b4
|
4
|
+
data.tar.gz: 066af4742375cb37f85c4ece941deecb5ffdfda3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c18a8c9994a0978a18c6a3e8ae7fb49a8b9f7105d538eb4be015d61753ffbb644e523862ba05bd8a005527b01218ea5e56ae20ba68b3279bcbb5b67b9ff5773c
|
7
|
+
data.tar.gz: cf3026a022ba06a766f7467b1f9a488e85e595cfbca6bf47d4073e44bc72341fef09ff8e2048d8f7b1b8666f5187e7021f979cca73475f7505ff0fe820cda156
|
data/Gemfile.lock
CHANGED
@@ -12,40 +12,45 @@ module MdbmDistSupport
|
|
12
12
|
|
13
13
|
def initialize
|
14
14
|
yield self if block_given?
|
15
|
+
@meta = MdbmDistSupport::Meta.new(@meta_path)
|
15
16
|
end
|
16
17
|
|
17
18
|
def run_dist
|
18
19
|
MdbmDistSupport::Validator::check_run_dist(instance_variables)
|
19
20
|
@lock = MdbmDistSupport::Lock.new(@lock_path)
|
20
|
-
@meta = MdbmDistSupport::Meta.new(@meta_path)
|
21
21
|
@lock.try_lock
|
22
22
|
local_up
|
23
23
|
end
|
24
24
|
|
25
25
|
def run_print_after(meta_val)
|
26
26
|
MdbmDistSupport::Validator::check_run_print_after(instance_variables)
|
27
|
-
@meta = MdbmDistSupport::Meta.new(@meta_path)
|
28
27
|
@meta.store(@meta_incr_key, meta_val)
|
29
28
|
end
|
30
29
|
|
31
30
|
private
|
32
31
|
|
33
32
|
def local_up
|
34
|
-
date_b = @meta.fetch(@meta_incr_key)
|
35
33
|
Tempfile.create('mdbm_dist_support') do |f|
|
36
|
-
|
34
|
+
date_b = @meta.fetch(@meta_incr_key)
|
35
|
+
cmd_exec %(#{@cmd_print} > #{f.path})
|
37
36
|
date_a = @meta.fetch(@meta_incr_key)
|
38
37
|
abort %(no need to update) if @full_mode == false && date_a <= date_b
|
39
|
-
|
38
|
+
cmd_exec %(cat #{f.path} | #{@cmd_gen} #{@local_path})
|
40
39
|
dist
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
44
43
|
def dist
|
45
44
|
@dist_server_hosts.each do |s|
|
46
|
-
|
47
|
-
|
45
|
+
cmd_exec %(scp -o StrictHostKeychecking=no #{@local_path} #{s}:#{@dist_path}.tmp)
|
46
|
+
cmd_exec %(ssh -o StrictHostKeychecking=no #{s} \" #{@cmd_rep} #{@dist_path} #{@dist_path}.tmp && chmod 777 #{@dist_path}\")
|
48
47
|
end
|
49
48
|
end
|
49
|
+
|
50
|
+
def cmd_exec(cmd)
|
51
|
+
puts %(exec: #{cmd})
|
52
|
+
Kernel.system cmd
|
53
|
+
raise %(error: #{$?}) unless $?.exitstatus.zero?
|
54
|
+
end
|
50
55
|
end
|
51
56
|
end
|