Class: Zold::Routines::Spread
- Inherits:
-
Object
- Object
- Zold::Routines::Spread
- Defined in:
- lib/zold/commands/routines/spread.rb
Overview
Spread them
Instance Method Summary collapse
- #exec(_ = 0) ⇒ Object
-
#initialize(opts, wallets, remotes, copies, log: Log::NULL) ⇒ Spread
constructor
A new instance of Spread.
Constructor Details
#initialize(opts, wallets, remotes, copies, log: Log::NULL) ⇒ Spread
Returns a new instance of Spread.
37 38 39 40 41 42 43 |
# File 'lib/zold/commands/routines/spread.rb', line 37 def initialize(opts, wallets, remotes, copies, log: Log::NULL) @opts = opts @wallets = wallets @remotes = remotes @copies = copies @log = log end |
Instance Method Details
#exec(_ = 0) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/zold/commands/routines/spread.rb', line 45 def exec(_ = 0) sleep(60) unless @opts['routine-immediately'] @wallets.all.sample(100).each do |id| next if Copies.new(File.join(@copies, id)).all.count < 2 Push.new(wallets: @wallets, remotes: @remotes, log: @log).run( ['push', "--network=#{@opts['network']}", id.to_s] ) end end |