lib/zold/upgrades.rb in zold-0.17.2 vs lib/zold/upgrades.rb in zold-0.17.3

- old
+ new

@@ -23,18 +23,31 @@ require_relative 'log' module Zold # Class to manage data upgrades (when zold itself upgrades). class Upgrades - def initialize(version, directory, log: Log::VERBOSE) + def initialize(version, directory, opts, log: Log::VERBOSE) + raise 'network can\'t be nil' if opts[:network].nil? @version = version @directory = directory @log = log + @opts = opts end def run Dir.glob("#{@directory}/*.rb").select { |f| f =~ /^(\d+)\.rb$/ }.sort.each do |script| @version.apply(script) end + + command = @opts[:command] + require_relative '../../upgrades/2' + Zold::UpgradeTo2.new(Dir.pwd, @log).exec + require_relative '../../upgrades/protocol_up' + Zold::ProtocolUp.new(Dir.pwd, @log).exec + require_relative '../../upgrades/rename_foreign_wallets' + Zold::RenameForeignWallets.new(Dir.pwd, @opts[:network], @log).exec + return unless command == 'node' + require_relative '../../upgrades/move_wallets_into_tree' + Zold::MoveWalletsIntoTree.new(Dir.pwd, @log).exec end end end