zold 0.13.42 → 0.13.43

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: af5c3740f905dabd3a8e7454e7b0bf65d9c3472b
4
- data.tar.gz: 91b089acdcca61e29768a8b2a31cc8f046d71ef4
3
+ metadata.gz: 7c1b984c84978412b1cbbc753771396705f0d544
4
+ data.tar.gz: 653f5e746fbae90ab0609915452eb646e49d86d9
5
5
  SHA512:
6
- metadata.gz: 90ce9c75f3b34aa7d6eac595eea885977875721c5bc258dbdd8b8f851182ed80e7968ea4722e068670f93e97f162d8507e6dc53f758456c54cf74a7aab56bfa6
7
- data.tar.gz: de73f91cf870c7bc3b8236e297e7e93a5f9f2e9ec37c4db7fa9b1ad56aafbc8c3e32a92a944d3f57b461916992671fb5650581ce4eed64ad1d2c34eeac939605
6
+ metadata.gz: 7aa48a078b7b037d165eae145f995ce886fb62f3bfe7d0f8b3e6fac984c80b02c6d4c0c5afc51f0c7411d9de28f6e0a607818043bd6c66f8fff4a38b82690784
7
+ data.tar.gz: 31e5789f3c7bc710b3ee970376c40c140f0d73251ebd0a182e5acf7185ea4e9b0ed94f82b753722d8ca5824fd68274d997d26fe4e7d9038324181d6ffd65b65a
@@ -98,8 +98,8 @@ Available options:"
98
98
  body = json['body']
99
99
  File.write(f, body)
100
100
  wallet = Wallet.new(f.path)
101
- cps.add(body, score.host, score.port, score.value)
102
- @log.info("#{r} returned #{body.length}b/#{wallet.txns.count}t \
101
+ copy = cps.add(body, score.host, score.port, score.value)
102
+ @log.info("#{r} returned #{body.length}b/#{wallet.txns.count}t as copy ##{copy} \
103
103
  of #{id} in #{(Time.now - start).round(2)}s: #{Rainbow(score.value).green} (#{json['version']})")
104
104
  end
105
105
  score.value
data/lib/zold/copies.rb CHANGED
@@ -54,6 +54,7 @@ module Zold
54
54
  save(load.reject { |s| s[:host] == host && s[:port] == port })
55
55
  end
56
56
 
57
+ # Returns the name of the copy
57
58
  def add(content, host, port, score, time = Time.now)
58
59
  raise "Content can't be empty" if content.empty?
59
60
  raise 'TCP port must be of type Integer' unless port.is_a?(Integer)
@@ -88,6 +89,7 @@ module Zold
88
89
  time: time
89
90
  }
90
91
  save(list)
92
+ name
91
93
  end
92
94
 
93
95
  def all
data/lib/zold/version.rb CHANGED
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Zold
26
- VERSION = '0.13.42'.freeze
26
+ VERSION = '0.13.43'.freeze
27
27
  end
data/lib/zold/wallet.rb CHANGED
@@ -64,7 +64,7 @@ module Zold
64
64
 
65
65
  def version
66
66
  v = lines[1].strip
67
- raise "Invalid version name '#{v}'" unless v =~ /^[0-9]+(\.[0-9]+){1,2}$/
67
+ raise "Invalid version name '#{v}'" unless v =~ /^[0-9]+$/
68
68
  v
69
69
  end
70
70
 
data/test/test_wallet.rb CHANGED
@@ -44,6 +44,7 @@ class TestWallet < Minitest::Test
44
44
  wallet.balance == amount * -3,
45
45
  "#{wallet.balance} is not equal to #{amount * -3}"
46
46
  )
47
+ assert_equal('1', wallet.version)
47
48
  end
48
49
  end
49
50
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.42
4
+ version: 0.13.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko