zk 1.9.5 → 1.9.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2UxZTVhMDZjMGQxOTllZDc3NTQ5ZDliODA0ODkzZTM5MzM2ZGFkZg==
4
+ YWUxMzk1MjRkMmFhZjEyMDg2OTA1ODQ3NTQxYjBiNWNjODc4OGQ3ZA==
5
5
  data.tar.gz: !binary |-
6
- NjE0NGRmNTNjN2YxNzc2YWE5ZTY0NDE1YTkyODg1YmZjZTI2NjNiMg==
6
+ NjViMTA4YTA1YTUxYTA4ZWJiMTA4Y2JiNDIxMGMyZDVkZjY5ZmMyMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWMxODIyZjY4YjM2NDAwODdjZTZlOTZkNjMzNjFkYmM3YmZlYzY3NTFhOWIz
10
- NzQ5ODJjNjg3NWE4ZDRhYmU4YjhhYjhlNjViMWJjYTVhOGQ1NjhiNjE4OGY5
11
- MGNhNjdmMGQ3ZDE3NjEzNjM0YTJjM2YwZDEyNmU0ZjBhNzQ5Nzg=
9
+ N2UwYzk3YTMxY2M1ZGFiNGU4ZjgwMmEyYjVjNTQ2MzIxNWRhZWNiNmUzMjIz
10
+ ZjVhZTZmNTkyMmE3MDRhMTFlODY4MTM0MDBkMWY3MWQxNDRlNjA1OTVkOGQy
11
+ NjU2YTU2ODIwZGEzY2Y2YTg4MjlkY2FjNGY3NTgzYWNjOTI1ZTQ=
12
12
  data.tar.gz: !binary |-
13
- Njk5ODY2NWM4ZTU1MTJjZmZkZjBjYzg1NWI4OTM4MmMzZWEyNGU2MTkwNGFh
14
- ZmFjMGEyMTY2MDljZDRlZDY1YjMzMjFkM2E3N2M2YWZkZjFmNjE0YTFkODY2
15
- NjYxN2JjMTVjYzU3YWI4NjExNjIyYTE5OTY1MjJiMjgyYThhOWM=
13
+ NjY5YTA0MzRkMDEwMTQzYzAxYjRjODZiOTlkNGMwZmQ0MTI4MzhlOGJiODgx
14
+ ZGVhODY2YWQzM2I5NzJkZDgwNzMwZDBkMTZmMmU5N2IxY2VlYTg4M2ExMzcx
15
+ NGZjM2QwMjhhMzRkYWY2OTA4OWI5YTA2YTdkMmJiNDllODM2ZmQ=
@@ -1,4 +1,6 @@
1
- ---
1
+ # This should kick us over to the docker system
2
+ sudo: false
3
+
2
4
  notifications:
3
5
  email:
4
6
  - slyphon@gmail.com
@@ -9,6 +11,7 @@ env:
9
11
 
10
12
  # pull in releaseops submodule
11
13
  before_install:
14
+ - gem update bundler
12
15
  - git submodule update --init --recursive
13
16
 
14
17
  rvm:
@@ -19,9 +22,6 @@ rvm:
19
22
  - 2.0.0
20
23
  - 2.1.0
21
24
  - 2.2.0
22
- matrix:
23
- allow_failures:
24
- - rvm: 2.2.0
25
25
 
26
26
  # jruby specs are too intesive for travis
27
27
  # - jruby-18mode
data/Gemfile CHANGED
@@ -43,6 +43,7 @@ group :test do
43
43
  gem 'rspec', '~> 2.8.0'
44
44
  gem 'flexmock', '~> 0.8.10'
45
45
  gem 'zk-server', '~> 1.1.4'
46
+ gem 'test-unit', :platforms => [:ruby_22]
46
47
  end
47
48
 
48
49
  # Specify your gem's dependencies in zk.gemspec
@@ -1,5 +1,10 @@
1
1
  This file notes feature differences and bugfixes contained between releases.
2
2
 
3
+ ### v1.9.6 ###
4
+
5
+ * Fixes from @rickypai for ruby 2.2 (#89)
6
+ * Remove dependency on logging gem #90 (h/t: @eric)
7
+
3
8
  ### v1.9.5 ###
4
9
 
5
10
  * Really clear hooks when clear! is called #83 (h/t: Liam Stewart)
data/lib/zk.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'rubygems'
2
2
 
3
- require 'logging'
4
3
  require 'zookeeper'
5
4
 
6
5
  # XXX: after 1.0 we'll need this
@@ -23,7 +22,7 @@ end
23
22
  require 'zk/core_ext'
24
23
  require 'zk/exceptions'
25
24
  require 'zk/extensions'
26
- require 'zk/logging'
25
+ require 'zk/logger'
27
26
  require 'zk/event'
28
27
  require 'zk/stat'
29
28
  require 'zk/subscription'
@@ -307,6 +306,3 @@ module ZK
307
306
  cnx_str # the possibly-modified connection string (with chroot info)
308
307
  end
309
308
  end
310
-
311
- ZK::Logging.set_default
312
-
@@ -39,7 +39,7 @@ module ZK
39
39
  include StateMixin
40
40
  include Unixisms
41
41
  include Conveniences
42
- include Logging
42
+ include Logger
43
43
 
44
44
  DEFAULT_THREADPOOL_SIZE = 1
45
45
 
@@ -60,7 +60,7 @@ module ZK
60
60
  }.freeze
61
61
 
62
62
  class Base
63
- include Logging
63
+ include Logger
64
64
 
65
65
  attr_reader :zk, :vote_path, :root_election_node
66
66
 
@@ -6,7 +6,7 @@ module ZK
6
6
  # you never really need to initialize this yourself
7
7
  class EventHandler
8
8
  include Java::OrgApacheZookeeper::Watcher if defined?(JRUBY_VERSION)
9
- include ZK::Logging
9
+ include ZK::Logger
10
10
 
11
11
  # @private
12
12
  VALID_WATCH_TYPES = [:data, :child].freeze
@@ -1,7 +1,7 @@
1
1
  module ZK
2
2
  module EventHandlerSubscription
3
3
  class Base < Subscription::Base
4
- include ZK::Logging
4
+ include ZK::Logger
5
5
 
6
6
  # the path this subscription is for
7
7
  # @return [String]
@@ -1,6 +1,6 @@
1
1
  module ZK
2
2
  module ForkHook
3
- include ZK::Logging
3
+ include ZK::Logger
4
4
  extend self
5
5
 
6
6
  @mutex = Mutex.new unless @mutex
@@ -94,6 +94,10 @@ module ZK
94
94
  register(:after_child, callable || blk)
95
95
  end
96
96
 
97
+ def self.logger
98
+ @logger ||= ::ZK.logger || Zookeeper::Logger::ForwardingLogger.for(::ZK::Logger.wrapped_logger, _zk_logger_name)
99
+ end
100
+
97
101
  class ForkSubscription < Subscription::Base
98
102
  attr_reader :hook_type
99
103
 
@@ -108,4 +112,5 @@ module ZK
108
112
  def self.install_fork_hook
109
113
  require 'zk/install_fork_hooks'
110
114
  end
115
+
111
116
  end # ZK
@@ -8,7 +8,7 @@ module ZK
8
8
  # author, and it may be corrected sometime in the future.
9
9
  #
10
10
  class LockerBase
11
- include ZK::Logging
11
+ include ZK::Logger
12
12
  include ZK::Exceptions
13
13
 
14
14
  # @private
@@ -0,0 +1,34 @@
1
+ module ZK
2
+ # use the ZK.logger if non-nil (to allow users to override the logger)
3
+ # otherwise, use a Loggging logger based on the class name
4
+ module Logger
5
+ def self.wrapped_logger
6
+ if defined?(@@wrapped_logger)
7
+ @@wrapped_logger
8
+ else
9
+ @@wrapped_logger = ::Logger.new(STDERR).tap { |l| l.level = ::Logger::FATAL }
10
+ end
11
+ end
12
+
13
+ def self.wrapped_logger=(log)
14
+ @@wrapped_logger = log
15
+ end
16
+
17
+ # @private
18
+ module ClassMethods
19
+ def logger
20
+ ::ZK.logger || Zookeeper::Logger::ForwardingLogger.for(::ZK::Logger.wrapped_logger, _zk_logger_name)
21
+ end
22
+ end
23
+
24
+ def self.included(base)
25
+ # return false if base < self # avoid infinite recursion
26
+ base.extend(ClassMethods)
27
+ end
28
+
29
+ def logger
30
+ @logger ||= (::ZK.logger || self.class.logger)
31
+ end
32
+ end
33
+ end
34
+
@@ -2,7 +2,7 @@ module ZK
2
2
  class NodeDeletionWatcher
3
3
  include Zookeeper::Constants
4
4
  include Exceptions
5
- include Logging
5
+ include Logger
6
6
 
7
7
  # @private
8
8
  module Constants
@@ -18,7 +18,7 @@ module ZK
18
18
  # complexity.
19
19
  #
20
20
  class Base
21
- include Logging
21
+ include Logger
22
22
 
23
23
  attr_reader :connections #:nodoc:
24
24
 
@@ -7,7 +7,7 @@ module ZK
7
7
  # be passed the subscription instance
8
8
  module Subscription
9
9
  class Base
10
- include ZK::Logging
10
+ include ZK::Logger
11
11
 
12
12
  # the object from which we will attempt to #unregister on
13
13
  # XXX: need a better name for this
@@ -4,7 +4,7 @@ module ZK
4
4
  # You will not have a useful return value from `call` so this is only useful
5
5
  # for background processing.
6
6
  class ThreadedCallback
7
- include ZK::Logging
7
+ include ZK::Logger
8
8
  include ZK::Exceptions
9
9
 
10
10
  attr_reader :callback
@@ -1,7 +1,7 @@
1
1
  module ZK
2
2
  # a simple threadpool for running blocks of code off the main thread
3
3
  class Threadpool
4
- include Logging
4
+ include Logger
5
5
  include Exceptions
6
6
 
7
7
  DEFAULT_SIZE = 5
@@ -1,3 +1,3 @@
1
1
  module ZK
2
- VERSION = "1.9.5"
2
+ VERSION = "1.9.6"
3
3
  end
@@ -5,7 +5,7 @@ require 'rspec/core/formatters/progress_formatter'
5
5
  # easier to match up tests with the SQL they produce
6
6
  class LoggingProgressBarFormatter < RSpec::Core::Formatters::ProgressFormatter
7
7
  def example_started(example)
8
- ::Logging.logger['spec'].write(yellow("\n=====<([ #{example.full_description} ])>=====\n"))
8
+ SpecGlobalLogger.logger << yellow("\n=====<([ #{example.full_description} ])>=====\n")
9
9
  super
10
10
  end
11
11
  end
@@ -49,7 +49,7 @@ RSpec.configure do |config|
49
49
  require 'zk-server'
50
50
 
51
51
  config.before(:suite) do
52
- ::Logging.logger['spec'].debug { "Starting zookeeper service" }
52
+ SpecGlobalLogger.logger.debug { "Starting zookeeper service" }
53
53
  ZK::Server.run do |c|
54
54
  c.client_port = ZK.test_port
55
55
  c.force_sync = false
@@ -58,7 +58,7 @@ RSpec.configure do |config|
58
58
  end
59
59
 
60
60
  config.after(:suite) do
61
- ::Logging.logger['spec'].debug { "stopping zookeeper service" }
61
+ SpecGlobalLogger.logger.debug { "stopping zookeeper service" }
62
62
  ZK::Server.shutdown
63
63
  end
64
64
  end
@@ -1,6 +1,6 @@
1
1
  class BogusMongoid
2
2
  include ZK::Mongoid::Locking
3
- include ZK::Logging
3
+ include ZK::Logger
4
4
 
5
5
  attr_reader :id
6
6
 
@@ -1,5 +1,5 @@
1
1
  class ClientForker
2
- include ZK::Logging
2
+ include ZK::Logger
3
3
  attr_reader :base_path, :cnx_args, :stat
4
4
 
5
5
  def self.run(cnx_args, base_path)
@@ -1,6 +1,6 @@
1
1
  class EventCatcher
2
2
  extend Forwardable
3
- include ZK::Logging
3
+ include ZK::Logger
4
4
 
5
5
  def_delegators :@mutex, :synchronize
6
6
 
@@ -1,68 +1,36 @@
1
1
  module ZK
2
2
  TEST_LOG_PATH = File.join(ZK::ZK_ROOT, 'test.log')
3
3
 
4
- def self.logging_gem_setup
5
- layout_opts = {
6
- :pattern => '%.1l, [%d #%p] (%9.9T) %25.25c{2}: %m\n',
7
- }
8
-
9
- layout_opts[:date_pattern] = ZK.jruby? ? '%H:%M:%S.%3N' : '%H:%M:%S.%6N'
10
-
11
- layout = ::Logging.layouts.pattern(layout_opts)
12
-
13
- appender = ENV['ZK_DEBUG'] ? ::Logging.appenders.stderr : ::Logging.appenders.file(ZK::TEST_LOG_PATH)
14
- appender.layout = layout
15
- # appender.immediate_at = "debug,info,warn,error,fatal"
16
- # appender.auto_flushing = true
17
- appender.auto_flushing = 25
18
- appender.flush_period = 5
19
-
20
- %w[ZK ClientForker spec Zookeeper].each do |name|
21
- ::Logging.logger[name].tap do |log|
22
- log.appenders = [appender]
23
- log.level = :debug
4
+ def self.setup_test_logger
5
+ log =
6
+ if ENV['ZK_DEBUG']
7
+ ::Logger.new(STDERR)
8
+ else
9
+ ::Logger.new(TEST_LOG_PATH)
24
10
  end
25
- end
26
-
27
- # this logger is kinda noisy
28
- ::Logging.logger['ZK::EventHandler'].level = :info
29
-
30
- Zookeeper.logger = ::Logging.logger['Zookeeper']
31
- Zookeeper.logger.level = ENV['ZOOKEEPER_DEBUG'] ? :debug : :warn
32
-
33
- ZK::ForkHook.after_fork_in_child { ::Logging.reopen }
34
- end
35
11
 
12
+ log.level = ::Logger::DEBUG
36
13
 
37
- def self.stdlib_logger_setup
38
- require 'logger'
39
- log = ::Logger.new($stderr).tap {|l| l.level = ::Logger::DEBUG }
40
- ZK.logger = log
41
- Zookeeper.logger = log
14
+ ZK::Logger.wrapped_logger = log
42
15
  end
43
16
  end
44
17
 
45
- ZK.logging_gem_setup
46
- # ZK.stdlib_logger_setup
47
-
48
- # Zookeeper.logger = ZK.logger.clone_new_log(:progname => 'zoo')
49
- # Zookeeper.logger = ZK.logger
50
- # Zookeeper.set_debug_level(4)
18
+ ZK.setup_test_logger
51
19
 
52
20
  module SpecGlobalLogger
21
+ extend self
22
+
53
23
  def logger
54
- @spec_global_logger ||= ::Logging.logger['spec']
24
+ @spec_global_logger ||= Zookeeper::Logger::ForwardingLogger.for(ZK::Logger.wrapped_logger, 'spec')
55
25
  end
56
26
 
57
27
  # sets the log level to FATAL for the duration of the block
58
28
  def mute_logger
59
- zk_log = Logging.logger['ZK']
60
- orig_level, zk_log.level = zk_log.level, :off
61
- orig_zoo_level, Zookeeper.debug_level = Zookeeper.debug_level, Zookeeper::Constants::ZOO_LOG_LEVEL_ERROR
29
+ zk_log = ZK::Logger.wrapped_logger
30
+
31
+ orig_level, zk_log.level = zk_log.level, ::Logger::FATAL
62
32
  yield
63
33
  ensure
64
34
  zk_log.level = orig_level
65
- Zookeeper.debug_level = orig_zoo_level
66
35
  end
67
36
  end
68
-
data/zk.gemspec CHANGED
@@ -13,7 +13,6 @@ Gem::Specification.new do |s|
13
13
  s.description = s.summary + "\n"
14
14
 
15
15
  s.add_runtime_dependency 'zookeeper', '~> 1.4.0'
16
- s.add_runtime_dependency 'logging', '~> 1.8.2'
17
16
 
18
17
  s.files = `git ls-files`.split("\n")
19
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.5
4
+ version: 1.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan D. Simms
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-12 00:00:00.000000000 Z
12
+ date: 2015-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: zookeeper
@@ -25,20 +25,6 @@ dependencies:
25
25
  - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.4.0
28
- - !ruby/object:Gem::Dependency
29
- name: logging
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ~>
33
- - !ruby/object:Gem::Version
34
- version: 1.8.2
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ~>
40
- - !ruby/object:Gem::Version
41
- version: 1.8.2
42
28
  description: ! 'A high-level wrapper around the zookeeper driver
43
29
 
44
30
  '
@@ -91,7 +77,7 @@ files:
91
77
  - lib/zk/locker/locker_base.rb
92
78
  - lib/zk/locker/semaphore.rb
93
79
  - lib/zk/locker/shared_locker.rb
94
- - lib/zk/logging.rb
80
+ - lib/zk/logger.rb
95
81
  - lib/zk/message_queue.rb
96
82
  - lib/zk/mongoid.rb
97
83
  - lib/zk/node_deletion_watcher.rb
@@ -167,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
153
  version: '0'
168
154
  requirements: []
169
155
  rubyforge_project:
170
- rubygems_version: 2.4.5
156
+ rubygems_version: 2.2.2
171
157
  signing_key:
172
158
  specification_version: 4
173
159
  summary: A high-level wrapper around the zookeeper driver
@@ -1,36 +0,0 @@
1
- module ZK
2
- # use the ZK.logger if non-nil (to allow users to override the logger)
3
- # otherwise, use a Loggging logger based on the class name
4
- module Logging
5
- extend ZK::Concern
6
-
7
- included do
8
- def self.logger
9
- ::ZK.logger || ::Logging.logger[logger_name]
10
- end
11
- end
12
-
13
- def self.set_default
14
- ::Logging.logger['ZK'].tap do |ch_root|
15
- ::Logging.appenders.stderr.tap do |serr|
16
- serr.layout = ::Logging.layouts.pattern(
17
- :pattern => '%.1l, [%d #p] %c30.30{2}: %m\n',
18
- :date_pattern => '%Y-%m-%d %H:%M:%S.%6N'
19
- )
20
-
21
- serr.auto_flushing = 25
22
- serr.flush_period = 5
23
-
24
- ch_root.add_appenders(serr)
25
- end
26
-
27
- ch_root.level = ENV['ZK_DEBUG'] ? :debug : :off
28
- end
29
- end
30
-
31
- def logger
32
- self.class.logger
33
- end
34
- end
35
- end
36
-