zold 0.14.7 → 0.14.8

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: fe5dfb0c10d55bd3baccfdeb9fcdf48fa2c71b5f
4
- data.tar.gz: 72eb0acf988ec8e6e58eb7e9f341c286ab7c5732
3
+ metadata.gz: f2f9cbae830828107bb4b7aa19a24fa9d53620b4
4
+ data.tar.gz: 03f51730a5136f765985161d36b9454d59f19748
5
5
  SHA512:
6
- metadata.gz: a0c43f1bbf63ac32f535b2d3f5b5bb84b851395ef9445ea311fa2eda9467f4aae101862ab326fd90f1bac7e7fcd90eafa23f324502efeffa12647a7ebe49d19c
7
- data.tar.gz: 44fac93b3e27a4f3687d06fe4b2e6097503abbda9d280a392fd47c1b38a46d43a64ed505eab526ebb60cf36ddd1ae0333a7d1ef0c9666cc04bb3c697437e523a
6
+ metadata.gz: ed925085a934c77ffed65eb83bf9a8d0d97fb31dcb608ab20538445397a226241904fdf9ee41bb40f6078d0888d92d05e424c3cc7623cb581011b4cb0caaba1a
7
+ data.tar.gz: 1d0a2a7233ef74a7b1fb9e51584df480e06836b4efbbb67f71fc3c2238300a9f3409b98d4d2105f03d8905dc3a086066fafe601eda188309a4a8617c9b5a1e0a
data/.simplecov CHANGED
@@ -35,6 +35,6 @@ else
35
35
  SimpleCov.start do
36
36
  add_filter "/test/"
37
37
  add_filter "/features/"
38
- # minimum_coverage 30
38
+ minimum_coverage 30
39
39
  end
40
40
  end
data/bin/zold CHANGED
@@ -138,6 +138,16 @@ Available options:"
138
138
 
139
139
  Zold::Upgrades.new(Zold::VersionFile.new('.zoldata/version'), 'upgrades').run
140
140
 
141
+ # @todo #384:30min This is a workaround, move this code into Upgrades, somehow.
142
+ # We should find a way to run these arbitrary scripts and pass arguments
143
+ # to them. Each of them may need its own set of arguments.
144
+ require_relative '../upgrades/2'
145
+ Zold::UpgradeTo2.new(Dir.pwd, log).exec
146
+ require_relative '../upgrades/protocol_up'
147
+ Zold::ProtocolUp.new(Dir.pwd, log).exec
148
+ require_relative '../upgrades/rename_foreign_wallets'
149
+ Zold::RenameForeignWallets.new(Dir.pwd, opts['network'], log).exec
150
+
141
151
  wallets = Zold::Wallets.new('.')
142
152
  remotes = Zold::Remotes.new('./.zoldata/remotes', network: opts['network'])
143
153
  copies = './.zoldata/copies'
@@ -47,7 +47,7 @@ module Zold
47
47
  @entrance.push(id, File.read(@wallets.find(id).path))
48
48
  pushed << id
49
49
  end
50
- @log.info("Spread #{pushed.count} random wallets out of #{@wallets.all.count}: #{pushed.join}")
50
+ @log.info("Spread #{pushed.count} random wallets out of #{@wallets.all.count}: #{pushed.join(', ')}")
51
51
  end
52
52
  end
53
53
  end
data/lib/zold/upgrades.rb CHANGED
@@ -34,12 +34,6 @@ module Zold
34
34
  # - The upgrade scripts run when there is a version file and there are pending upgrade scripts.
35
35
  # - Make sure *only* the correct upgrade scripts run.
36
36
  def run
37
- # This is a workaround, remove it once this class works correctly
38
- require_relative '../../upgrades/2.rb'
39
- UpgradeTo2.new(Dir.pwd, @log).exec
40
- require_relative '../../upgrades/protocol_up.rb'
41
- ProtocolUp.new(Dir.pwd, @log).exec
42
-
43
37
  Dir.glob("#{@directory}/*.rb").select { |f| f =~ /^(\d+)\.rb$/ }.sort.each do |script|
44
38
  @version.apply(script)
45
39
  end
data/lib/zold/version.rb CHANGED
@@ -23,6 +23,6 @@
23
23
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Zold
26
- VERSION = '0.14.7'.freeze
26
+ VERSION = '0.14.8'.freeze
27
27
  PROTOCOL = 2
28
28
  end
@@ -0,0 +1,44 @@
1
+ # Copyright (c) 2018 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+
21
+ require_relative '../lib/zold/version'
22
+ require_relative '../lib/zold/wallet'
23
+
24
+ module Zold
25
+ # Rename wallets that belong to another network
26
+ class RenameForeignWallets
27
+ def initialize(home, network, log)
28
+ @home = home
29
+ @network = network
30
+ @log = log
31
+ end
32
+
33
+ def exec
34
+ Dir.new(@home).each do |path|
35
+ next unless path =~ /^[a-f0-9]{16}#{Wallet::EXTENSION}$/
36
+ f = File.join(@home, path)
37
+ wallet = Wallet.new(f)
38
+ next if wallet.network == @network
39
+ @log.info("Wallet #{wallet.id} renamed, since it's in #{wallet.network}, while we are in #{@network} network")
40
+ File.rename(f, f + '-old')
41
+ end
42
+ end
43
+ end
44
+ end
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.14.7
4
+ version: 0.14.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -463,6 +463,7 @@ files:
463
463
  - test/upgrades/test_protocol_up.rb
464
464
  - upgrades/2.rb
465
465
  - upgrades/protocol_up.rb
466
+ - upgrades/rename_foreign_wallets.rb
466
467
  - zold.gemspec
467
468
  homepage: http://github.com/zold-io/zold
468
469
  licenses: