elrpc 0.0.5 → 0.0.6
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/lib/elrpc/version.rb +1 -1
- data/lib/elrpc.rb +2 -1
- data/sample/sample-client.el +55 -0
- data/sample/sample.rb +21 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0842836d2200968a4a098eda7ba03664cce8aa7
|
4
|
+
data.tar.gz: 53583612a724a0570cd9e072d6401bd3e4d560b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58e64d2116678181e6ae2880ea22050714c26c711deac3e5e896132a901612e3afe234d43168e0d52128ea7fba3e8e9b1e482d8046ca7e09a8e5f92ef5216af5
|
7
|
+
data.tar.gz: 39465ff5784968f8495f53329dac6eb393cb408417008c1e02ed365771a3e7bc77d21a98b4b8c3001e72fe5063e9325cabc5c1514a4c546018c11f356bb6dfec
|
data/lib/elrpc/version.rb
CHANGED
data/lib/elrpc.rb
CHANGED
@@ -529,7 +529,8 @@ module Elrpc
|
|
529
529
|
@logger.debug "[rcvloop] Socket closed!"
|
530
530
|
break
|
531
531
|
end
|
532
|
-
|
532
|
+
body.force_encoding("utf-8")
|
533
|
+
@logger.debug "Parse : #{body}/#{body.encoding}"
|
533
534
|
ast = parser.parse(body)
|
534
535
|
raise "Unexpected multiple s-expression : #{body}" if ast.size != 1
|
535
536
|
ast = ast[0].to_ruby
|
@@ -0,0 +1,55 @@
|
|
1
|
+
(require 'epc)
|
2
|
+
|
3
|
+
(let (epc)
|
4
|
+
;; start a server process
|
5
|
+
;; bundle exec
|
6
|
+
(setq epc (epc:start-epc "bundle" '("exec" "ruby" "sample.rb")))
|
7
|
+
|
8
|
+
;; system ruby
|
9
|
+
;;(setq epc (epc:start-epc "ruby" '("sample.rb")))
|
10
|
+
|
11
|
+
;; debug process (manual connection)
|
12
|
+
;;(setq epc (epc:start-epc-debug 8888))
|
13
|
+
|
14
|
+
;; asynchronous calling
|
15
|
+
(deferred:$
|
16
|
+
(epc:call-deferred epc 'echo '("hello"))
|
17
|
+
(deferred:nextc it
|
18
|
+
(lambda (x) (message "Return : %S" x))))
|
19
|
+
|
20
|
+
;; synchronous calling (debug purpose)
|
21
|
+
(message "%S" (epc:call-sync epc 'echo '(world)))
|
22
|
+
|
23
|
+
(epc:call-sync epc 'inject '(0 + (1 2 3 4)))
|
24
|
+
(epc:call-sync epc 'inject '(1 * (1 2 3 4)))
|
25
|
+
(epc:call-sync epc 'inject '("" + ("1" "2" "3" "4")))
|
26
|
+
|
27
|
+
;; kill the server process
|
28
|
+
(epc:stop-epc epc)
|
29
|
+
)
|
30
|
+
|
31
|
+
;; just `eval-last-sexp' here
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
data/sample/sample.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'elrpc'
|
4
|
+
|
5
|
+
# start server
|
6
|
+
server = Elrpc.start_server()
|
7
|
+
|
8
|
+
server.def_method "echo" do |*arg|
|
9
|
+
arg
|
10
|
+
end
|
11
|
+
|
12
|
+
server.def_method "add" do |a,b|
|
13
|
+
a+b
|
14
|
+
end
|
15
|
+
|
16
|
+
server.def_method "inject","init, op, list","Enumerable#inject" do |init, op, list|
|
17
|
+
list.inject(init, op)
|
18
|
+
end
|
19
|
+
|
20
|
+
# sleep the main thread and wait for closing connection
|
21
|
+
server.wait
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elrpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SAKURAI Masashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elparser
|
@@ -84,6 +84,8 @@ files:
|
|
84
84
|
- sample/echo-client.el
|
85
85
|
- sample/echo-client.rb
|
86
86
|
- sample/echo.rb
|
87
|
+
- sample/sample-client.el
|
88
|
+
- sample/sample.rb
|
87
89
|
- test/_add.rb
|
88
90
|
- test/_call_echo.rb
|
89
91
|
- test/_echo.rb
|