easy-serve 0.10 → 0.11
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.
- checksums.yaml +4 -4
- data/COPYING +1 -1
- data/lib/easy-serve.rb +49 -10
- data/lib/easy-serve/remote/eval-mgr.rb +7 -1
- data/lib/easy-serve/remote/run-mgr.rb +1 -1
- metadata +22 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ef2c07a293530b91eacbd1630d63507acddedab
|
4
|
+
data.tar.gz: 004b52c5e9f3399f60a882f6302b648e900c8afe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ab412543120bca229865bff3b1f4a66bca28ec4bef4336feacd5c0c392a04a7a9672a6452c93539d49f6344ae8e642c3ed46b92c9773b81a2f0f1dbfa423f88
|
7
|
+
data.tar.gz: ec3d64c1e104eae2f79ed87fb918e992d3bf25ead58374a55cf38da332421b7e8c84c16e2007ca7e8913bd0ad50c5887ad5b47cabc6347bc967c617f72ce60fe
|
data/COPYING
CHANGED
data/lib/easy-serve.rb
CHANGED
@@ -6,7 +6,7 @@ require 'fileutils'
|
|
6
6
|
require 'easy-serve/service'
|
7
7
|
|
8
8
|
class EasyServe
|
9
|
-
VERSION = "0.
|
9
|
+
VERSION = "0.11"
|
10
10
|
|
11
11
|
class EasyFormatter < Logger::Formatter
|
12
12
|
Format = "%s: %s: %s\n"
|
@@ -162,12 +162,26 @@ class EasyServe
|
|
162
162
|
|
163
163
|
def start_services
|
164
164
|
if @owner
|
165
|
+
if services_file
|
166
|
+
begin
|
167
|
+
FileUtils.ln_s services_file, ".lock.#{services_file}"
|
168
|
+
# Successful creation of the lock file gives this process the
|
169
|
+
# right to create the services_file itself.
|
170
|
+
rescue Errno::EEXIST
|
171
|
+
raise Errno::EEXIST, "Services at #{services_file} already exist."
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
165
175
|
log.debug {"starting services"}
|
166
176
|
yield
|
167
177
|
|
168
178
|
if services_file
|
169
|
-
|
170
|
-
|
179
|
+
begin
|
180
|
+
File.open(services_file, "w") do |f|
|
181
|
+
YAML.dump(services, f)
|
182
|
+
end
|
183
|
+
ensure
|
184
|
+
FileUtils.rm_f ".lock.#{services_file}"
|
171
185
|
end
|
172
186
|
end
|
173
187
|
end
|
@@ -188,7 +202,7 @@ class EasyServe
|
|
188
202
|
if base
|
189
203
|
"#{base}-#{name}"
|
190
204
|
else
|
191
|
-
File.join(tmpdir, "sock-#{name}")
|
205
|
+
File.join(tmpdir, "sock-#{name}") ## permissions?
|
192
206
|
end
|
193
207
|
end
|
194
208
|
|
@@ -222,6 +236,36 @@ class EasyServe
|
|
222
236
|
|
223
237
|
MAX_TRIES = 10
|
224
238
|
|
239
|
+
# Start a service named +name+. The name is referenced in #child, #local,
|
240
|
+
# and #remote to connect a new process to this service.
|
241
|
+
#
|
242
|
+
# The +proto+ can be either :unix (the default) or :tcp; the value can also
|
243
|
+
# be specifed with the proto: key-value argument.
|
244
|
+
#
|
245
|
+
# Other key-value arguments are:
|
246
|
+
#
|
247
|
+
# :path :: for unix sockets, path to the socket file to be created
|
248
|
+
#
|
249
|
+
# :base :: for unix sockets, a base string for constructing the
|
250
|
+
# socket filename, if :path option is not provided;
|
251
|
+
# if neither :path nor :base specified, socket is in a tmp dir
|
252
|
+
# with filename based on +name+.
|
253
|
+
#
|
254
|
+
# :bind_host :: interface this service listens on, such as:
|
255
|
+
#
|
256
|
+
# "0.0.0.0", "<any>" (same)
|
257
|
+
#
|
258
|
+
# "localhost", "127.0.0.1" (same)
|
259
|
+
#
|
260
|
+
# or a specific hostname.
|
261
|
+
#
|
262
|
+
# :connect_host :: host specifier used by remote clients to connect.
|
263
|
+
# By default, this is constructed from the bind_host.
|
264
|
+
# For example, with bind_host: "<any>", the default
|
265
|
+
# connect_host is the current hostname (see #host_name).
|
266
|
+
#
|
267
|
+
# :port :: port this service listens on; defaults to 0 to choose a free port
|
268
|
+
#
|
225
269
|
def service name, proto = nil, **opts
|
226
270
|
proto ||= opts.delete(:proto) || :unix
|
227
271
|
case proto
|
@@ -232,7 +276,7 @@ class EasyServe
|
|
232
276
|
opts[:connect_host] ||=
|
233
277
|
case opts[:bind_host]
|
234
278
|
when nil, "0.0.0.0", /\A<any>\z/i
|
235
|
-
host_name
|
279
|
+
host_name
|
236
280
|
when "localhost", "127.0.0.1"
|
237
281
|
"localhost"
|
238
282
|
end
|
@@ -270,11 +314,6 @@ class EasyServe
|
|
270
314
|
c
|
271
315
|
end
|
272
316
|
|
273
|
-
def client *args, &block
|
274
|
-
warn "EasyServe#client is deprecated; use #child"
|
275
|
-
child *args, &block
|
276
|
-
end
|
277
|
-
|
278
317
|
def local *service_names
|
279
318
|
conns = service_names.map {|sn| services[sn].connect}
|
280
319
|
yield(*conns) if block_given?
|
@@ -34,7 +34,13 @@ def EasyServe.manage_remote_eval_client msg
|
|
34
34
|
pr = eval "proc do |conns, host, log| #{eval_string}; end"
|
35
35
|
pr[conns, host, log]
|
36
36
|
rescue => ex
|
37
|
-
puts "ez error", ex
|
37
|
+
puts "ez error", ex.inspect
|
38
|
+
lineno = (Integer(ex.backtrace[0][/(\d+):/, 1]) rescue nil)
|
39
|
+
if lineno
|
40
|
+
lines = eval_string.lines
|
41
|
+
puts " #{lineno-1} --> " + lines[lineno-1]
|
42
|
+
end
|
43
|
+
puts ex.backtrace
|
38
44
|
end
|
39
45
|
end
|
40
46
|
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy-serve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.11'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel VanderWerf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
description: Framework for starting tcp/unix services and connected clients under
|
@@ -33,30 +33,30 @@ extra_rdoc_files:
|
|
33
33
|
- README.md
|
34
34
|
- COPYING
|
35
35
|
files:
|
36
|
-
- README.md
|
37
36
|
- COPYING
|
38
|
-
-
|
39
|
-
-
|
40
|
-
- lib/easy-serve/service/tunnelled.rb
|
41
|
-
- lib/easy-serve/service.rb
|
42
|
-
- lib/easy-serve/remote/eval.rb
|
43
|
-
- lib/easy-serve/remote/run-mgr.rb
|
44
|
-
- lib/easy-serve/remote/run.rb
|
45
|
-
- lib/easy-serve/remote/drb.rb
|
46
|
-
- lib/easy-serve/remote/eval-mgr.rb
|
47
|
-
- lib/easy-serve.rb
|
48
|
-
- examples/remote-run.rb
|
49
|
-
- examples/remote-multi-server.rb
|
37
|
+
- README.md
|
38
|
+
- examples/multi.rb
|
50
39
|
- examples/passive.rb
|
51
|
-
- examples/remote-eval-passive.rb
|
52
40
|
- examples/remote-drb.rb
|
53
|
-
- examples/remote-
|
54
|
-
- examples/
|
41
|
+
- examples/remote-eval-passive.rb
|
42
|
+
- examples/remote-eval.rb
|
55
43
|
- examples/remote-manual.rb
|
44
|
+
- examples/remote-multi-server.rb
|
45
|
+
- examples/remote-run-script.rb
|
46
|
+
- examples/remote-run.rb
|
56
47
|
- examples/simple.rb
|
57
48
|
- examples/tunnel/client.rb
|
58
49
|
- examples/tunnel/server.rb
|
59
|
-
-
|
50
|
+
- lib/easy-serve.rb
|
51
|
+
- lib/easy-serve/remote.rb
|
52
|
+
- lib/easy-serve/remote/drb.rb
|
53
|
+
- lib/easy-serve/remote/eval-mgr.rb
|
54
|
+
- lib/easy-serve/remote/eval.rb
|
55
|
+
- lib/easy-serve/remote/run-mgr.rb
|
56
|
+
- lib/easy-serve/remote/run.rb
|
57
|
+
- lib/easy-serve/service.rb
|
58
|
+
- lib/easy-serve/service/accessible.rb
|
59
|
+
- lib/easy-serve/service/tunnelled.rb
|
60
60
|
homepage: https://github.com/vjoel/easy-serve
|
61
61
|
licenses:
|
62
62
|
- BSD
|
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
86
|
rubyforge_project:
|
87
|
-
rubygems_version: 2.
|
87
|
+
rubygems_version: 2.2.2
|
88
88
|
signing_key:
|
89
89
|
specification_version: 4
|
90
90
|
summary: Framework for starting tcp/unix services and connected clients under one
|