zk-server 0.0.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ module ZK
10
10
  class Process
11
11
  include ZK::Logging
12
12
  extend Forwardable
13
- include FileUtils::Verbose
13
+ include FileUtils
14
14
 
15
15
  def_delegators :config,
16
16
  :base_dir, :data_dir, :log4j_props_path, :log_dir, :command_args,
@@ -26,7 +26,7 @@ module ZK
26
26
  attr_accessor :child_startup_timeout
27
27
 
28
28
  def initialize(opts={})
29
- @child_startup_timeout = opts.delete(:child_startup_timeout, 5)
29
+ @child_startup_timeout = opts.delete(:child_startup_timeout) || 6
30
30
  @run_called = false
31
31
  @config = Config.new(opts)
32
32
  @exit_watching_thread = nil
@@ -113,7 +113,7 @@ module ZK
113
113
  fork_and_exec!
114
114
  spawn_exit_watching_thread
115
115
 
116
- unless wait_until_ping
116
+ unless wait_until_ping(@child_startup_timeout)
117
117
  raise "Oh noes! something went wrong!" unless running?
118
118
  end
119
119
 
@@ -1,5 +1,5 @@
1
1
  module ZK
2
2
  module Server
3
- VERSION = "0.0.1"
3
+ VERSION = "0.8.0"
4
4
  end
5
5
  end
data/lib/zk-server.rb CHANGED
@@ -18,6 +18,7 @@ module ZK
18
18
  ZK_JAR_GEM = 'slyphon-zookeeper_jar'
19
19
  LOG4J_GEM = 'slyphon-log4j'
20
20
 
21
+
21
22
  # Create a new {ZK::Server::Process} instance. if a block is given
22
23
  # then yield the {Config} object to the block
23
24
  #
@@ -28,6 +29,20 @@ module ZK
28
29
  end
29
30
  end
30
31
 
32
+ # runs a server as a singleton instance. use ZK::Server.shutdown to stop and ZK::Server.clear
33
+ # to reset
34
+ def self.run(opts={}, &blk)
35
+ @server ||= new(opts, &blk).tap { |s| s.run }
36
+ end
37
+
38
+ def self.shutdown
39
+ @server and @server.shutdown
40
+ end
41
+
42
+ def self.clear
43
+ @server = nil if @server and not @server.running?
44
+ end
45
+
31
46
  def self.zk_jar_path
32
47
  # in future revisions of the zookeeper jar, we'll make it easier to get
33
48
  # at this information without needing rubygems and bundler to get at it,
data/zk-server.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.email = ["slyphon@gmail.com"]
7
7
  s.description = %q{runs a standalone zookeeper server}
8
8
  s.summary = s.description + "\n"
9
- s.homepage = ""
9
+ s.homepage = "http://github.com/slyphon/zk-server"
10
10
 
11
11
  s.add_runtime_dependency 'bundler', '~> 1.1.3'
12
12
  s.add_runtime_dependency 'zk', '>= 1.0.0'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zk-server
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 63
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 8
8
9
  - 0
9
- - 1
10
- version: 0.0.1
10
+ version: 0.8.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan D. Simms
@@ -105,7 +105,7 @@ files:
105
105
  - lib/zk-server/process.rb
106
106
  - lib/zk-server/version.rb
107
107
  - zk-server.gemspec
108
- homepage: ""
108
+ homepage: http://github.com/slyphon/zk-server
109
109
  licenses: []
110
110
 
111
111
  post_install_message: