Class: BitcoinTestnet::Booter

Inherits:
Object
  • Object
show all
Defined in:
lib/bitcoin_testnet/booter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.boot(*args) ⇒ Object



4
5
6
# File 'lib/bitcoin_testnet/booter.rb', line 4

def self.boot(*args)
  self.new(*args).boot
end

Instance Method Details

#bootObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bitcoin_testnet/booter.rb', line 8

def boot
  if Detector.exists?
    Stopper.stop
  else
    Executes.command "make clean"
  end

  thread = Thread.new do
    Executes.command "make start"
  end

  Wait.new.until do
    thread.status == false && Executes.command("make getinfo")
  end

  unless Detector.exists?
    fail "The bitcoin processes didn't seem to start. Please ensure that the bitcoin testnet servers started at `#{BitcoinTestnet.dir}`"
  end
end