dizby 1.5.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.rubocop.yml +2 -47
  4. data/.travis.yml +7 -7
  5. data/.yardopts +1 -16
  6. data/Gemfile +2 -17
  7. data/Rakefile +2 -8
  8. data/dizby.gemspec +9 -2
  9. data/lib/dizby.rb +0 -1
  10. data/lib/dizby/access/control_list.rb +1 -2
  11. data/lib/dizby/access/entry.rb +1 -2
  12. data/lib/dizby/access/insecure.rb +4 -5
  13. data/lib/dizby/access/list.rb +0 -1
  14. data/lib/dizby/converter/simple.rb +0 -1
  15. data/lib/dizby/converter/timed.rb +0 -1
  16. data/lib/dizby/distributed/array.rb +0 -1
  17. data/lib/dizby/distributed/object.rb +9 -9
  18. data/lib/dizby/distributed/proxy.rb +7 -7
  19. data/lib/dizby/distributed/semi_proxy.rb +2 -2
  20. data/lib/dizby/distributed/undumpable.rb +1 -2
  21. data/lib/dizby/distributed/unknown.rb +0 -1
  22. data/lib/dizby/error.rb +0 -1
  23. data/lib/dizby/protocol/basic.rb +0 -1
  24. data/lib/dizby/protocol/manager.rb +17 -20
  25. data/lib/dizby/protocol/refined.rb +0 -1
  26. data/{gemfiles/Gemfile.ci → lib/dizby/protocol/structs.rb} +4 -5
  27. data/lib/dizby/protocols/dead.rb +3 -4
  28. data/lib/dizby/protocols/secure.rb +18 -12
  29. data/lib/dizby/protocols/tcp.rb +19 -15
  30. data/lib/dizby/protocols/unix.rb +15 -15
  31. data/lib/dizby/server/abstract.rb +7 -5
  32. data/lib/dizby/server/basic.rb +5 -9
  33. data/lib/dizby/server/registration.rb +0 -1
  34. data/lib/dizby/service.rb +10 -8
  35. data/lib/dizby/stream/client.rb +0 -1
  36. data/lib/dizby/stream/connection.rb +2 -3
  37. data/lib/dizby/stream/messenger.rb +0 -1
  38. data/lib/dizby/stream/query_ref.rb +0 -1
  39. data/lib/dizby/stream/readable.rb +5 -6
  40. data/lib/dizby/stream/writable.rb +0 -1
  41. data/lib/dizby/tunnel/abstract.rb +10 -18
  42. data/lib/dizby/tunnel/basic.rb +2 -3
  43. data/lib/dizby/tunnel/basic_spawn.rb +4 -5
  44. data/lib/dizby/tunnel/bidirectional_strategy.rb +0 -1
  45. data/lib/dizby/tunnel/factory.rb +0 -1
  46. data/lib/dizby/tunnel/local_strategy.rb +0 -1
  47. data/lib/dizby/tunnel/spawn_command.rb +0 -1
  48. data/lib/dizby/tunnel/spawned.rb +0 -1
  49. data/lib/dizby/tunnel/tunnelable_local.rb +0 -1
  50. data/lib/dizby/tunnel/tunnelable_remote.rb +1 -2
  51. data/lib/dizby/utility/configurable.rb +0 -1
  52. data/lib/dizby/utility/io_barrier.rb +0 -1
  53. data/lib/dizby/utility/log.rb +0 -1
  54. data/lib/dizby/utility/monitor.rb +0 -1
  55. data/lib/dizby/utility/self_pipe.rb +0 -1
  56. data/lib/dizby/utility/semi_built.rb +0 -1
  57. data/lib/dizby/utility/string.rb +0 -1
  58. data/lib/dizby/utility/timed_collection.rb +0 -1
  59. data/lib/dizby/utility/timed_state.rb +0 -1
  60. data/lib/dizby/version.rb +1 -2
  61. data/lib/dizby/worker/connection.rb +0 -1
  62. data/lib/dizby/worker/invoke_method.rb +1 -2
  63. data/lib/dizby/worker/server.rb +0 -1
  64. data/test/test_helper.rb +1 -14
  65. metadata +93 -19
  66. data/gemfiles/Gemfile.doc +0 -12
  67. data/lib/dizby/utility/classic_access.rb +0 -31
  68. data/lib/dizby/utility/delegator.rb +0 -34
  69. data/lib/dizby/utility/force_bind.rb +0 -27
  70. data/lib/dizby/utility/polymorphic_delegated.rb +0 -65
  71. data/tasks/ghpages.rake +0 -33
  72. data/tasks/rubocop.rake +0 -14
  73. data/tasks/test.rake +0 -25
  74. data/tasks/yard.rake +0 -13
data/gemfiles/Gemfile.doc DELETED
@@ -1,12 +0,0 @@
1
- # encoding: utf-8
2
- # Copyright (c) 2016 Nathan Currier
3
-
4
- # This Source Code Form is subject to the terms of the Mozilla Public
5
- # License, v. 2.0. If a copy of the MPL was not distributed with this
6
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
-
8
- eval_gemfile File.expand_path('Gemfile.ci', __dir__)
9
-
10
- group :development do
11
- gem 'ghpages_deploy', require: false
12
- end
@@ -1,31 +0,0 @@
1
- # encoding: utf-8
2
- # Copyright (c) 2016 Nathan Currier
3
-
4
- # This Source Code Form is subject to the terms of the Mozilla Public
5
- # License, v. 2.0. If a copy of the MPL was not distributed with this
6
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
-
8
- module Dizby
9
- module ClassicAttributeAccess
10
- def attr_reader(*args)
11
- args.each do |method|
12
- define_method(method) do
13
- instance_variable_get(:"@#{method}")
14
- end
15
- end
16
- end
17
-
18
- def attr_writer(*args)
19
- args.each do |method|
20
- define_method("#{method}=") do |value|
21
- instance_variable_set(:"@#{method}", value)
22
- end
23
- end
24
- end
25
-
26
- def attr_accessor(*args)
27
- attr_reader(*args)
28
- attr_writer(*args)
29
- end
30
- end
31
- end
@@ -1,34 +0,0 @@
1
- # encoding: utf-8
2
- # Copyright (c) 2016 Nathan Currier
3
-
4
- # This Source Code Form is subject to the terms of the Mozilla Public
5
- # License, v. 2.0. If a copy of the MPL was not distributed with this
6
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
-
8
- module Dizby
9
- class Delegator
10
- def initialize(obj)
11
- @__delegated_object__ = obj
12
- end
13
-
14
- def instance_variable_get(sym)
15
- @__delegated_object__.instance_variable_get(sym)
16
- end
17
-
18
- def instance_variable_set(sym, value)
19
- @__delegated_object__.instance_variable_set(sym, value)
20
- end
21
-
22
- def __undelegated_get__(sym)
23
- __instance_variable_get__(sym)
24
- end
25
-
26
- def __undelegated_set__(sym, value)
27
- __instance_variable_set__(sym, value)
28
- end
29
-
30
- def method_missing(name, *args, &block)
31
- @__delegated_object__.__delegate__(name, self, *args, &block)
32
- end
33
- end
34
- end
@@ -1,27 +0,0 @@
1
- # encoding: utf-8
2
- # Copyright (c) 2016 Nathan Currier
3
-
4
- # This Source Code Form is subject to the terms of the Mozilla Public
5
- # License, v. 2.0. If a copy of the MPL was not distributed with this
6
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
-
8
- require 'force_bind' if RUBY_ENGINE == 'ruby'
9
-
10
- module Dizby
11
- # rubocop:disable Lint/DuplicateMethods
12
- case RUBY_ENGINE
13
- when 'rbx'
14
- def self.force_bind(bound_obj, method)
15
- method_args = [method.defined_in, method.executable, method.name]
16
-
17
- Method.new(bound_obj, *method_args)
18
- end
19
- when 'ruby'
20
- def self.force_bind(bound_obj, method)
21
- method.force_bind(bound_obj)
22
- end
23
- else
24
- fail "force binding is not supported on #{RUBY_ENGINE}"
25
- end
26
- # rubocop:enable Lint/DuplicateMethods
27
- end
@@ -1,65 +0,0 @@
1
- # encoding: utf-8
2
- # Copyright (c) 2016 Nathan Currier
3
-
4
- # This Source Code Form is subject to the terms of the Mozilla Public
5
- # License, v. 2.0. If a copy of the MPL was not distributed with this
6
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
-
8
- require 'dizby/utility/classic_access'
9
- require 'dizby/utility/delegator'
10
- require 'dizby/utility/force_bind'
11
-
12
- module Dizby
13
- module PolymorphicDelegated
14
- def self.included(base)
15
- base.extend(ClassMethods)
16
- base.__send__(:include, InstanceMethods)
17
-
18
- base.class_eval do
19
- intercepted = [base, Object, Kernel, BasicObject, InstanceMethods]
20
- intercepted = intercepted.map(&:instance_methods).reduce(&:-)
21
-
22
- @__delegated_methods__ =
23
- intercepted.each_with_object({}) do |name, methods|
24
- methods[name.to_sym] = base.instance_method(name)
25
- base.__send__(:undef_method, name)
26
- end
27
- end
28
- end
29
-
30
- module ClassMethods
31
- include ClassicAttributeAccess
32
-
33
- def __delegated_methods__
34
- instance_variable_get(:@__delegated_methods__)
35
- end
36
-
37
- def method_added(name)
38
- return if %i(method_missing initialize).include?(name)
39
- @__delegated_methods__[name] = instance_method(name)
40
- __send__(:undef_method, name)
41
- nil
42
- end
43
- end
44
-
45
- module InstanceMethods
46
- def __delegate__(name, delegator, *args, &block)
47
- unbound = self.class.__delegated_methods__[name]
48
-
49
- bound = Dizby.force_bind(delegator, unbound)
50
-
51
- bound.call(*args, &block)
52
- end
53
-
54
- def method_missing(name, *args, &block)
55
- args.unshift(self) if args.empty? || !args.first.is_a?(Delegator)
56
-
57
- __delegate__ name, *args, &block
58
- end
59
-
60
- def respond_to?(sym, _priv = false)
61
- super || self.class.__delegated_methods__.keys.include?(sym)
62
- end
63
- end
64
- end
65
- end
data/tasks/ghpages.rake DELETED
@@ -1,33 +0,0 @@
1
- # encoding: utf-8
2
- # Copyright (c) 2016 Nathan Currier
3
-
4
- # This Source Code Form is subject to the terms of the Mozilla Public
5
- # License, v. 2.0. If a copy of the MPL was not distributed with this
6
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
-
8
- if ENV['TRAVIS'] && ENV['DOCS']
9
- namespace :yard do
10
- if ENV['TRAVIS_PULL_REQUEST'] == 'false'
11
- require 'ghpages_deploy/rake_task'
12
-
13
- desc 'Deploy documentation to Github Pages'
14
- GithubPages::DeployTask.new(deploy: [:yard]) do |t|
15
- t.remote = 'origin'
16
- t.source = '_yardoc'
17
-
18
- tag = ENV['TRAVIS_TAG']
19
- branch = ENV['TRAVIS_BRANCH']
20
-
21
- if !tag.empty?
22
- t.register "doc/tag/#{tag}"
23
- elsif !branch.empty?
24
- t.register "doc/branch/#{branch}"
25
- end
26
- end
27
- else
28
- task :deploy do
29
- puts 'Documentation not generated for pull requests.'
30
- end
31
- end
32
- end
33
- end
data/tasks/rubocop.rake DELETED
@@ -1,14 +0,0 @@
1
- # encoding: utf-8
2
- # Copyright (c) 2016 Nathan Currier
3
-
4
- # This Source Code Form is subject to the terms of the Mozilla Public
5
- # License, v. 2.0. If a copy of the MPL was not distributed with this
6
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
-
8
- require 'rubocop/rake_task'
9
-
10
- RuboCop::RakeTask.new(:rubocop) do |t|
11
- t.fail_on_error = false
12
- end
13
-
14
- task('rubocop:auto_correct').clear
data/tasks/test.rake DELETED
@@ -1,25 +0,0 @@
1
- # encoding: utf-8
2
- # Copyright (c) 2016 Nathan Currier
3
-
4
- # This Source Code Form is subject to the terms of the Mozilla Public
5
- # License, v. 2.0. If a copy of the MPL was not distributed with this
6
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
-
8
- require 'rake/testtask'
9
-
10
- Rake::TestTask.new(:test) do |t|
11
- t.libs << 'test'
12
- t.test_files = ['test/test_helper.rb']
13
- t.pattern = 'test/**/*_test.rb'
14
- t.verbose = true
15
- end
16
-
17
- namespace :test do
18
- desc 'Generate a test coverage report'
19
- task :coverage do
20
- ENV['COVERAGE'] = 'true'
21
- task(:test).invoke
22
- end
23
- end
24
-
25
- CLOBBER.include 'coverage'
data/tasks/yard.rake DELETED
@@ -1,13 +0,0 @@
1
- # encoding: utf-8
2
- # Copyright (c) 2016 Nathan Currier
3
-
4
- # This Source Code Form is subject to the terms of the Mozilla Public
5
- # License, v. 2.0. If a copy of the MPL was not distributed with this
6
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
-
8
- require 'yard_dizby/rake_overload'
9
-
10
- YARD::Rake::YardocTask.new(:yard)
11
-
12
- CLEAN.include '.yardoc'
13
- CLOBBER.include '_yardoc'