easy-serve 0.12 → 0.13

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +118 -8
  3. data/lib/easy-serve.rb +4 -1
  4. metadata +18 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c1e18a947084b2aa2f1508159eef9d102f90d0f
4
- data.tar.gz: ae49fefd0aa53336007d2745d0f5471970950aac
3
+ metadata.gz: 9f0c7199f4598926d54910efbcc21489ea6b9793
4
+ data.tar.gz: 46a5d4023cce3f45a79e536c083c1a419da4355f
5
5
  SHA512:
6
- metadata.gz: b4d08db27f7c8240213ac5934cfafa08bb595b6dbea4402e09b09102f0b84133ef018f912868349166940d9c7c74b45fc3cc3b0acccb97372c6bb4814434d87f
7
- data.tar.gz: e1551d47c03786400d81a0e949fd94cc18e153faebc58345e3d540a40db9950b372903135b534cf040ef2471aa0a0b97b6d9b89dee4d7e6f19962b7dcef86fb8
6
+ metadata.gz: 5656ded4b61e2e2b7a20355e8ffe82a5dba46665eabb5d6f79333bc7a67c74b25282d3cc146dfb7bb419640dfafa4dfbcfe8974e2ece491d7bd5b6449d749cc7
7
+ data.tar.gz: 6e2d92e58745e7bd10ec19fa08a74777df0bc10c460549d703e991364f2ed1891a4d6e350a0751fb668e9c5f46a085021b68f63f840440d608bfde69c5ce85c3
data/README.md CHANGED
@@ -1,17 +1,127 @@
1
- easy-serve
2
- ==========
1
+ EasyServe
2
+ =========
3
3
 
4
4
  Framework for starting tcp/unix services and connected clients under one parent process and on remote hosts.
5
5
 
6
- use cases
6
+ EasyServe takes the headache out of:
7
+
8
+ * Choosing unused unix socket paths and tcp ports.
9
+
10
+ * Starting service processes with open server sockets, and handing off connections to user code.
11
+
12
+ * Storing a services file (yaml) listing service addresses, represented as unix socket path or tcp address and port.
13
+
14
+ * Ensuring that tcp service addresses will make sense from remote networks, to the extent possible.
15
+
16
+ * Reading the services file locally or remotely over ssh.
17
+
18
+ * Setting up client connections and handing off sockets to user code in each client, whether child process or remote, whether unix or tcp.
19
+
20
+ * Tunneling connections over ssh, if desired.
21
+
22
+ * Working around poor support for dynamic port forwarding in old versions of OpenSSH.
23
+
24
+ * Choosing between -L and -R styles of tunneling, depending on whether the remote process starts independently of the services.
25
+
26
+ * Avoiding race conditions in the service setup phase.
27
+
28
+ * Propagating log settings among all distributed clients (defaulting to a minimal format more readable than the usual default).
29
+
30
+ * Pushing script code to remote ruby instances.
31
+
32
+ * Pulling remote log messages and backtraces back into local log message stream.
33
+
34
+ * Protecting services from interrupt signals when running interactively.
35
+
36
+ * Stopping "passive" clients when they are no longer needed (by "active" clients).
37
+
38
+ * Cleaning up.
39
+
40
+ Combine with other libraries for the functionality that EasyServe does not provide:
41
+
42
+ * Protocols built on top of sockets.
43
+
44
+ * Daemonization.
45
+
46
+ * IO multiplexing, concurrency, asynchrony, etc.
47
+
48
+ * Process supervision and monitoring.
49
+
50
+ * Config management and distribution.
51
+
52
+ * Code distribution.
53
+
54
+ Use cases
7
55
  ---------
8
56
 
9
- 1. start some procs with unix sockets established among them and
10
- clean up afterwards [simple](examples/simple.rb) [multi](examples/multi.rb)
57
+ 1. Start some processes with unix sockets established among them and
58
+ clean up afterwards: [simple](examples/simple.rb) and
59
+ [multi](examples/multi.rb)
11
60
 
12
- 2. ditto but with tcp and possibly [remote](examples/remote-eval.rb)
61
+ 2. Ditto but with tcp and possibly [remote](examples/remote-eval.rb)
13
62
 
14
- 3. ditto but through ssh [tunnels](examples/remote-eval.rb)
63
+ 3. Ditto but through ssh [tunnels](examples/remote-eval.rb)
15
64
 
16
- 4. ditto but where the tunnel is set up by the remote client, without
65
+ 4. Ditto but where the tunnel is set up by the remote client, without
17
66
  special assistance from the server [examples/tunnel](examples/tunnel)
67
+
68
+ 5. Useful for all-in-one-file examples of client-server libraries
69
+
70
+ 6. [Tupelo](https://github.com/vjoel/tupelo): a distributed programming framework using easy-serve.
71
+
72
+ Installation
73
+ ------------
74
+
75
+ Requires ruby 2.0 or later. Install easy-serve as gem:
76
+
77
+ gem install easy-serve
78
+
79
+ Synopsis
80
+ --------
81
+
82
+ ```ruby
83
+ require 'easy-serve'
84
+
85
+ EasyServe.start do |ez|
86
+ ez.log.level = Logger::ERROR
87
+
88
+ ez.start_services do
89
+ ez.service "echo", :unix do |svr|
90
+ Thread.new do
91
+ loop do
92
+ conn = svr.accept
93
+ msg = conn.read
94
+ puts msg
95
+ conn.write "echo #{msg}"
96
+ conn.close_write
97
+ end
98
+ end
99
+ end
100
+ end
101
+
102
+ ez.child "echo" do |echo_conn|
103
+ echo_conn.write "hello from client"
104
+ echo_conn.close_write
105
+ puts echo_conn.read
106
+ end
107
+ end
108
+ ```
109
+
110
+ Output:
111
+
112
+ ```
113
+ hello from client
114
+ echo hello from client
115
+ ```
116
+
117
+ Contact
118
+ =======
119
+
120
+ Joel VanderWerf, vjoel@users.sourceforge.net, [@JoelVanderWerf](https://twitter.com/JoelVanderWerf).
121
+
122
+ License and Copyright
123
+ ========
124
+
125
+ Copyright (c) 2013-2014, Joel VanderWerf
126
+
127
+ License for this project is BSD. See the COPYING file for the standard BSD license. The supporting gems developed for this project are similarly licensed.
@@ -6,7 +6,7 @@ require 'fileutils'
6
6
  require 'easy-serve/service'
7
7
 
8
8
  class EasyServe
9
- VERSION = "0.12"
9
+ VERSION = "0.13"
10
10
 
11
11
  class ServicesExistError < RuntimeError; end
12
12
 
@@ -35,6 +35,8 @@ class EasyServe
35
35
  attr_reader :children
36
36
  attr_reader :passive_children
37
37
  attr_reader :services_file
38
+
39
+ # True means do not propagate ^C to child processes.
38
40
  attr_reader :interactive
39
41
 
40
42
  # Is this a sibling process, started by the same parent process that
@@ -344,6 +346,7 @@ class EasyServe
344
346
  c
345
347
  end
346
348
 
349
+ # A local client runs in the same process, not a child process.
347
350
  def local *service_names
348
351
  conns = service_names.map {|sn| services[sn].connect}
349
352
  yield(*conns) if block_given?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy-serve
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.12'
4
+ version: '0.13'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel VanderWerf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-24 00:00:00.000000000 Z
11
+ date: 2014-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Framework for starting tcp/unix services and connected clients under
28
42
  one parent process and on remote hosts.
29
43
  email: vjoel@users.sourceforge.net
@@ -74,9 +88,9 @@ require_paths:
74
88
  - lib
75
89
  required_ruby_version: !ruby/object:Gem::Requirement
76
90
  requirements:
77
- - - ">="
91
+ - - "~>"
78
92
  - !ruby/object:Gem::Version
79
- version: '0'
93
+ version: '2.0'
80
94
  required_rubygems_version: !ruby/object:Gem::Requirement
81
95
  requirements:
82
96
  - - ">="