zold 0.14.7 → 0.14.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.simplecov +1 -1
- data/bin/zold +10 -0
- data/lib/zold/commands/routines/spread.rb +1 -1
- data/lib/zold/upgrades.rb +0 -6
- data/lib/zold/version.rb +1 -1
- data/upgrades/rename_foreign_wallets.rb +44 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2f9cbae830828107bb4b7aa19a24fa9d53620b4
|
4
|
+
data.tar.gz: 03f51730a5136f765985161d36b9454d59f19748
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed925085a934c77ffed65eb83bf9a8d0d97fb31dcb608ab20538445397a226241904fdf9ee41bb40f6078d0888d92d05e424c3cc7623cb581011b4cb0caaba1a
|
7
|
+
data.tar.gz: 1d0a2a7233ef74a7b1fb9e51584df480e06836b4efbbb67f71fc3c2238300a9f3409b98d4d2105f03d8905dc3a086066fafe601eda188309a4a8617c9b5a1e0a
|
data/.simplecov
CHANGED
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
@@ -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.
|
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:
|