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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e97eceb65350f7f9f098639d75d4393e8246e2a
4
- data.tar.gz: 4c7090c4986fb88f59ab8439291c7b50a3d6ec25
3
+ metadata.gz: 2152dd130c4370da1d2036f07ec8c5291b70a4b4
4
+ data.tar.gz: 066af4742375cb37f85c4ece941deecb5ffdfda3
5
5
  SHA512:
6
- metadata.gz: 7e82393d8a75a70aaf472cf7a140918eb80a4323e1bb554c5a62ce43a24af2adb25bb5c994f9df7351f9f007f945735d6a411bb822df11e8e925202587bc2dd1
7
- data.tar.gz: 5a6212b55ac7f991058afecc9e9d308e7d56294a0e94f97b72d9040ec41ab18016014dcd42ba92f14cead39194e330dcc86ff0052286ee5afea7f45ff240f9aa
6
+ metadata.gz: c18a8c9994a0978a18c6a3e8ae7fb49a8b9f7105d538eb4be015d61753ffbb644e523862ba05bd8a005527b01218ea5e56ae20ba68b3279bcbb5b67b9ff5773c
7
+ data.tar.gz: cf3026a022ba06a766f7467b1f9a488e85e595cfbca6bf47d4073e44bc72341fef09ff8e2048d8f7b1b8666f5187e7021f979cca73475f7505ff0fe820cda156
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mdbm_dist_support (0.1.3)
4
+ mdbm_dist_support (0.1.4)
5
5
  ruby-mdbm (>= 0.0.2)
6
6
 
7
7
  GEM
@@ -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
- Kernel.system %(#{@cmd_print} > #{f.path})
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
- Kernel.system %(cat #{f.path} | #{@cmd_gen} #{@local_path})
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
- Kernel.exec %(scp -o StrictHostKeychecking=no #{@local_path} #{s}:#{@dist_path}.tmp)
47
- Kernel.exec %(ssh -o StrictHostKeychecking=no #{s} \" #{@cmd_rep} #{@dist_path} #{@dist_path}.tmp && chmod 777 #{@dist_path}\")
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
@@ -1,3 +1,3 @@
1
1
  module MdbmDistSupport
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdbm_dist_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - MichinaoShimizu