goat 0.3.33 → 0.3.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/bin/state-srv +19 -3
  2. data/goat.gemspec +1 -1
  3. metadata +3 -3
data/bin/state-srv CHANGED
@@ -195,9 +195,8 @@ module Goat
195
195
  end
196
196
 
197
197
  class Delegate
198
- @registry = Registry.new
199
-
200
198
  def self.registry; @registry; end
199
+ def self.registry=(x); @registry = x; end
201
200
 
202
201
  class << self
203
202
  def ensure_keys(hash, ks)
@@ -441,6 +440,7 @@ end
441
440
 
442
441
  $host = '127.0.0.1'
443
442
  $port = 8011
443
+ $registry_file = '/tmp/reg_dump'
444
444
 
445
445
  def usage
446
446
  $stderr.puts <<-EOH
@@ -453,11 +453,27 @@ OptionParser.new do |opts|
453
453
  opts.on('-pMANDATORY', Integer) {|r| $port = r}
454
454
  opts.on('-HMANDATORY', String) {|h| $host = h}
455
455
  opts.on('-v') {} # suppress optparse wanting to use -v as version
456
+ opts.on('-f', String) {|f| $registry_file = f}
456
457
  opts.on('-h') {usage; exit 1}
457
458
  end.parse!(ARGV)
458
459
 
460
+ if File.exists?($registry_file)
461
+ Goat::StateSrv::Delegate.registry = Marshal.load(File.read($registry_file))
462
+ $stderr.puts "Registry file loaded"
463
+ else
464
+ Goat::StateSrv::Delegate.registry = Goat::StateSrv::Registry.new
465
+ $stderr.puts "No registry file found; instantiating new Registry"
466
+ end
467
+
468
+ at_exit do
469
+ File.open($registry_file, 'w') do |f|
470
+ f.write(Marshal.dump(Goat::StateSrv::Delegate.registry))
471
+ end
472
+ $stderr.puts "Wrote registry dump to file #{$registry_file}"
473
+ end
474
+
459
475
  Goat.announce_launch('state-srv')
460
- EM.run do
476
+ EM.run do
461
477
  Goat::StateSrv::Sweeper.start
462
478
  Goat::StateSrv::RecvServer.start($host, $port)
463
479
  end
data/goat.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'goat'
3
- s.version = '0.3.33'
3
+ s.version = '0.3.34'
4
4
  s.summary = 'Pre-release beta version of Goat'
5
5
  s.author = 'Patrick Collison'
6
6
  s.email = 'patrick@collison.ie'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 81
4
+ hash: 87
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 33
10
- version: 0.3.33
9
+ - 34
10
+ version: 0.3.34
11
11
  platform: ruby
12
12
  authors:
13
13
  - Patrick Collison