Class: Zold::Merge
- Inherits:
-
Object
- Object
- Zold::Merge
- Defined in:
- lib/zold/commands/merge.rb
Overview
MERGE pulling command
Instance Method Summary collapse
-
#initialize(wallets:, copies:, log: Log::Quiet.new) ⇒ Merge
constructor
A new instance of Merge.
-
#run(args = []) ⇒ Object
Returns the array of modified wallets (IDs).
Constructor Details
Instance Method Details
#run(args = []) ⇒ Object
Returns the array of modified wallets (IDs)
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/zold/commands/merge.rb', line 46 def run(args = []) opts = Slop.parse(args, help: true, suppress_errors: true) do |o| o. = "Usage: zold merge [ID...] [options] Available options:" o.bool '--no-baseline', 'Don\'t trust any remote copies and re-validate all incoming payments against their wallets', default: false o.bool '--help', 'Print instructions' end mine = Args.new(opts, @log).take || return mine = @wallets.all if mine.empty? modified = [] mine.map { |i| Id.new(i) }.each do |id| next unless merge(id, Copies.new(File.join(@copies, id)), opts) modified << id require_relative 'propagate' modified += Propagate.new(wallets: @wallets, log: @log).run(args) end modified end |