dizby 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -2
  3. data/.travis.yml +24 -0
  4. data/.yardopts +3 -2
  5. data/Gemfile +20 -1
  6. data/LICENSE.md +357 -0
  7. data/Rakefile +6 -28
  8. data/dizby.gemspec +6 -10
  9. data/gemfiles/Gemfile.ci +12 -0
  10. data/gemfiles/Gemfile.doc +12 -0
  11. data/lib/dizby/access/control_list.rb +4 -0
  12. data/lib/dizby/access/entry.rb +4 -0
  13. data/lib/dizby/access/insecure.rb +5 -1
  14. data/lib/dizby/access/list.rb +4 -0
  15. data/lib/dizby/converter/simple.rb +4 -0
  16. data/lib/dizby/converter/timed.rb +4 -0
  17. data/lib/dizby/distributed/array.rb +17 -9
  18. data/lib/dizby/distributed/object.rb +4 -0
  19. data/lib/dizby/distributed/proxy.rb +10 -9
  20. data/lib/dizby/distributed/semi_proxy.rb +4 -0
  21. data/lib/dizby/distributed/undumpable.rb +4 -0
  22. data/lib/dizby/distributed/unknown.rb +11 -8
  23. data/lib/dizby/error.rb +4 -0
  24. data/lib/dizby/protocol/basic.rb +4 -0
  25. data/lib/dizby/protocol/manager.rb +4 -0
  26. data/lib/dizby/protocol/refined.rb +5 -1
  27. data/lib/dizby/protocols/dead.rb +4 -0
  28. data/lib/dizby/protocols/secure.rb +4 -0
  29. data/lib/dizby/protocols/tcp.rb +4 -0
  30. data/lib/dizby/protocols/unix.rb +4 -0
  31. data/lib/dizby/server/abstract.rb +5 -1
  32. data/lib/dizby/server/basic.rb +4 -0
  33. data/lib/dizby/server/registration.rb +4 -0
  34. data/lib/dizby/service.rb +5 -1
  35. data/lib/dizby/stream/client.rb +5 -1
  36. data/lib/dizby/stream/connection.rb +5 -1
  37. data/lib/dizby/stream/messenger.rb +4 -0
  38. data/lib/dizby/stream/query_ref.rb +4 -0
  39. data/lib/dizby/stream/readable.rb +4 -0
  40. data/lib/dizby/stream/writable.rb +4 -0
  41. data/lib/dizby/tunnel/abstract.rb +9 -4
  42. data/lib/dizby/tunnel/basic.rb +4 -0
  43. data/lib/dizby/tunnel/basic_spawn.rb +11 -6
  44. data/lib/dizby/tunnel/bidirectional_strategy.rb +4 -0
  45. data/lib/dizby/tunnel/factory.rb +4 -0
  46. data/lib/dizby/tunnel/local_strategy.rb +4 -0
  47. data/lib/dizby/tunnel/spawn_command.rb +7 -2
  48. data/lib/dizby/tunnel/spawned.rb +4 -0
  49. data/lib/dizby/tunnel/tunnelable_local.rb +4 -0
  50. data/lib/dizby/tunnel/tunnelable_remote.rb +4 -0
  51. data/lib/dizby/utility/classic_access.rb +4 -0
  52. data/lib/dizby/utility/configurable.rb +4 -0
  53. data/lib/dizby/utility/delegator.rb +4 -0
  54. data/lib/dizby/utility/force_bind.rb +6 -0
  55. data/lib/dizby/utility/io_barrier.rb +4 -0
  56. data/lib/dizby/utility/log.rb +17 -10
  57. data/lib/dizby/utility/monitor.rb +4 -0
  58. data/lib/dizby/utility/polymorphic_delegated.rb +4 -0
  59. data/lib/dizby/utility/self_pipe.rb +12 -7
  60. data/lib/dizby/utility/semi_built.rb +4 -0
  61. data/lib/dizby/utility/string.rb +4 -0
  62. data/lib/dizby/utility/timed_collection.rb +4 -0
  63. data/lib/dizby/utility/timed_state.rb +4 -0
  64. data/lib/dizby/version.rb +5 -1
  65. data/lib/dizby/worker/connection.rb +4 -0
  66. data/lib/dizby/worker/invoke_method.rb +4 -0
  67. data/lib/dizby/worker/server.rb +4 -0
  68. data/lib/dizby.rb +4 -0
  69. data/tasks/ghpages.rake +30 -0
  70. data/tasks/rubocop.rake +14 -0
  71. data/tasks/test.rake +25 -0
  72. data/tasks/yard.rake +13 -0
  73. data/test/test_helper.rb +4 -0
  74. metadata +12 -104
  75. data/.yardext/config_access_handler.rb +0 -84
  76. data/LICENSE +0 -24
@@ -1,24 +1,32 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/distributed/object'
5
9
  require 'dizby/distributed/undumpable'
6
10
 
7
11
  module Dizby
8
12
  class DistributedArray
9
13
  def initialize(ary, server)
10
- @ary = ary.map do |obj|
11
- if obj.is_a? UndumpableObject
12
- DistributedObject.new(obj, server)
13
- else
14
- begin
15
- Marshal.dump(obj)
16
- obj
17
- rescue
14
+ @ary =
15
+ ary.map do |obj|
16
+ if obj.is_a? UndumpableObject
18
17
  DistributedObject.new(obj, server)
18
+ else
19
+ self.class.distribute_if_necessary(obj)
19
20
  end
20
21
  end
21
- end
22
+ end
23
+
24
+ def self.distribute_if_necessary(obj)
25
+ Marshal.dump(obj)
26
+ rescue
27
+ DistributedObject.new(obj, server)
28
+ else
29
+ obj
22
30
  end
23
31
 
24
32
  def self._load(str)
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/distributed/proxy'
5
9
  require 'dizby/access/insecure'
6
10
 
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/distributed/unknown'
5
9
 
6
10
  module Dizby
@@ -15,15 +19,12 @@ module Dizby
15
19
  @conn.send_request(@ref, msg_id, *args, &block)
16
20
  succ, result = @conn.recv_reply
17
21
 
18
- if succ
19
- result
20
- elsif result.is_a?(UnknownObject)
21
- fail result
22
- else
23
- bt = Dizby.proxy_backtrace(@conn.remote_uri, result)
24
- result.set_backtrace(bt + caller)
25
- fail result
26
- end
22
+ return result if succ
23
+ fail result if result.is_a?(UnknownObject)
24
+
25
+ bt = Dizby.proxy_backtrace(@conn.remote_uri, result)
26
+ result.set_backtrace(bt + caller)
27
+ fail result
27
28
  end
28
29
 
29
30
  undef :to_s
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/server/registration'
5
9
  require 'dizby/distributed/proxy'
6
10
 
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  module Dizby
5
9
  module UndumpableObject
6
10
  def _dump(_)
@@ -1,19 +1,22 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/error'
5
9
 
6
10
  module Dizby
7
11
  class UnknownObject
8
12
  def initialize(err, buf)
9
- case err.to_s
10
- when /uninitialized constant (\S+)/
11
- @name = $~[1]
12
- when %r{undefined class/module (\S+)}
13
- @name = $~[1]
14
- else
15
- @name = nil
16
- end
13
+ @name =
14
+ case err.to_s
15
+ when /uninitialized constant (\S+)/
16
+ $~[1]
17
+ when %r{undefined class/module (\S+)}
18
+ $~[1]
19
+ end
17
20
 
18
21
  @buf = buf
19
22
  end
data/lib/dizby/error.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  module Dizby
5
9
  class DistributedError < RuntimeError; end
6
10
  class ConnectionError < DistributedError; end
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/protocol/manager'
5
9
  require 'dizby/protocol/refined'
6
10
 
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/error'
5
9
 
6
10
  module Dizby
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  module Dizby
5
9
  PROTOCOL_REGEX = {
6
10
  user: '(?:(.+?)@)',
@@ -8,7 +12,7 @@ module Dizby
8
12
  port: '(?::(\d+))',
9
13
  file: '(.+?)',
10
14
  query: '(?:\?(.*?))'
11
- }
15
+ }.freeze
12
16
 
13
17
  class RefinedProtocol
14
18
  def initialize(regex, &block)
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/protocol/basic'
5
9
  require 'dizby/server/abstract'
6
10
 
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/protocol/basic'
5
9
  require 'dizby/stream/client'
6
10
  require 'dizby/stream/connection'
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/protocol/basic'
5
9
  require 'dizby/stream/client'
6
10
  require 'dizby/stream/connection'
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/protocol/basic'
5
9
  require 'dizby/stream/client'
6
10
  require 'dizby/stream/connection'
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/protocol/manager'
5
9
  require 'dizby/distributed/object'
6
10
  require 'dizby/utility/configurable'
@@ -12,7 +16,7 @@ module Dizby
12
16
 
13
17
  def initialize(config, &log_transform)
14
18
  @config = config
15
- @log = Dizby.create_logger(config[:log] || {}, &log_transform)
19
+ @log = Dizby::Logger.new(config[:log] || {}, &log_transform)
16
20
  end
17
21
 
18
22
  attr_reader :log
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/stream/query_ref'
5
9
  require 'dizby/utility/polymorphic_delegated'
6
10
  require 'dizby/utility/self_pipe'
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/utility/monitor'
5
9
 
6
10
  module Dizby
data/lib/dizby/service.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/protocol/manager'
5
9
  require 'dizby/converter/simple'
6
10
  require 'dizby/worker/server'
@@ -50,7 +54,7 @@ module Dizby
50
54
  argc_limit: 256,
51
55
  load_limit: 256 * 1024 * 100,
52
56
  tcp_acl: nil
53
- }
57
+ }.freeze
54
58
 
55
59
  private
56
60
 
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/stream/messenger'
5
9
 
6
10
  module Dizby
@@ -21,7 +25,7 @@ module Dizby
21
25
  end
22
26
 
23
27
  def recv_reply
24
- succ, result = 2.times.map { read }
28
+ succ, result = Array.new(2) { read }
25
29
  [succ, result]
26
30
  end
27
31
  end
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/stream/messenger'
5
9
  require 'dizby/utility/self_pipe'
6
10
 
@@ -19,7 +23,7 @@ module Dizby
19
23
  def recv_request
20
24
  wait_for_stream
21
25
 
22
- ref, msg, argc = 3.times.map { read }
26
+ ref, msg, argc = Array.new(3) { read }
23
27
 
24
28
  @server.log.debug("called through proxy: #{ref} #{msg}")
25
29
  fail ConnectionError, 'too many arguments' if @server.argc_limit < argc
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/stream/readable'
5
9
  require 'dizby/stream/writable'
6
10
 
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  module Dizby
5
9
  # Acts as an array or hash index to a remote object
6
10
  class QueryRef
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/distributed/semi_proxy'
5
9
 
6
10
  module Dizby
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/distributed/undumpable'
5
9
 
6
10
  module Dizby
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'net/ssh'
5
9
 
6
10
  module Dizby
@@ -12,10 +16,11 @@ module Dizby
12
16
 
13
17
  reader, writer = IO.pipe
14
18
 
15
- @thread = Thread.start do
16
- open_ssh(writer)
17
- writer.close
18
- end
19
+ @thread =
20
+ Thread.start do
21
+ open_ssh(writer)
22
+ writer.close
23
+ end
19
24
 
20
25
  @thread.abort_on_exception = true
21
26
 
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/tunnel/abstract'
5
9
 
6
10
  module Dizby
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/tunnel/abstract'
5
9
  require 'dizby/error'
6
10
 
@@ -15,14 +19,15 @@ module Dizby
15
19
  def get_and_write_ports(ssh, output)
16
20
  @command.set_dynamic_mode unless @tunnel.server_port
17
21
 
18
- @channel = ssh.open_channel do |ch|
19
- ch.exec @command.to_cmd do |_, success|
20
- fail SpawnError, 'could not spawn host' unless success
22
+ @channel =
23
+ ssh.open_channel do |ch|
24
+ ch.exec @command.to_cmd do |_, success|
25
+ fail SpawnError, 'could not spawn host' unless success
21
26
 
22
- # it is already triggered if the port is set
23
- get_remote_server_port(ch) if @command.dynamic?
27
+ # it is already triggered if the port is set
28
+ get_remote_server_port(ch) if @command.dynamic?
29
+ end
24
30
  end
25
- end
26
31
 
27
32
  ssh.loop { !@channel[:triggered] } if @command.dynamic?
28
33
  @channel.eof!
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/tunnel/tunnelable_local'
5
9
  require 'dizby/tunnel/tunnelable_remote'
6
10
 
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/tunnel/local_strategy'
5
9
  require 'dizby/tunnel/bidirectional_strategy'
6
10
  require 'dizby/utility/semi_built'
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'dizby/tunnel/tunnelable_local'
5
9
 
6
10
  module Dizby
@@ -1,11 +1,16 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'shellwords'
5
9
 
6
10
  module Dizby
7
11
  class SpawnCommand
8
- TEMPLATE = "require'dizby/tunnel/spawned';Dizby::Spawned.%s('%s',%s){%s}"
12
+ TEMPLATE =
13
+ "require'dizby/tunnel/spawned';Dizby::Spawned.%s('%s',%s){%s}".freeze
9
14
 
10
15
  def initialize(data, config = {})
11
16
  @data = data
@@ -30,7 +35,7 @@ module Dizby
30
35
  args = [@mode, @uri.shellescape, @config.inspect, @data.shellescape]
31
36
  [@ruby_cmd, '-e', %("#{TEMPLATE % args}")].join ' '
32
37
  end
33
- alias_method :to_s, :to_cmd
38
+ alias to_s to_cmd
34
39
 
35
40
  class << self
36
41
  def text(script)
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  # require the whole package, minimizes command length
5
9
  require 'dizby'
6
10
  require 'dizby/utility/io_barrier'
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  module Dizby
5
9
  module TunnelableLocal
6
10
  def create_local_tunnel(ssh, server_port)
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  module Dizby
5
9
  module TunnelableRemote
6
10
  def create_remote_tunnel(ssh, client_port)
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  module Dizby
5
9
  module ClassicAttributeAccess
6
10
  def attr_reader(*args)
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  module Dizby
5
9
  module Configurable
6
10
  def config_reader(*args)
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  module Dizby
5
9
  class Delegator
6
10
  def initialize(obj)
@@ -1,9 +1,14 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  require 'force_bind' if RUBY_ENGINE == 'ruby'
5
9
 
6
10
  module Dizby
11
+ # rubocop:disable Lint/DuplicateMethods
7
12
  case RUBY_ENGINE
8
13
  when 'rbx'
9
14
  def self.force_bind(bound_obj, method)
@@ -18,4 +23,5 @@ module Dizby
18
23
  else
19
24
  fail "force binding is not supported on #{RUBY_ENGINE}"
20
25
  end
26
+ # rubocop:enable Lint/DuplicateMethods
21
27
  end
@@ -1,6 +1,10 @@
1
1
  # encoding: utf-8
2
2
  # Copyright (c) 2016 Nathan Currier
3
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
+
4
8
  module Dizby
5
9
  class IOBarrier
6
10
  def initialize(var)