rsense-server 0.5.17 → 0.5.18
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/rsense/server/command.rb +1 -1
- data/lib/rsense/server/version.rb +1 -1
- metadata +2 -4
- data/bin/_rsense_commandline.rb +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d05634be96064b94259057fc7faf513c4d02a38
|
4
|
+
data.tar.gz: 9d111ce47e7c88217057f2591c1cfa41df816895
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08461c143a91c37714e08c37016be6c8f1f60e2a808ca59a0a02e95b7cd1c47bb094ab27ce27a693033921e91b93dc21fdd8c90ef2ee337c8791341040b7f2e4
|
7
|
+
data.tar.gz: e66e1a4f65b7b6336b3f0cb031a7ddbd193fbbab4815a40cb664dfdb14a02c5d5b6de03de1ba2d64bd24639b4a205770d7e8dc4a727cb7c7d6cc1d99eacf558f
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsense-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric West
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rsense-core
|
@@ -227,7 +227,6 @@ email:
|
|
227
227
|
- tomo@cx4a.org
|
228
228
|
executables:
|
229
229
|
- _rsense.rb
|
230
|
-
- _rsense_commandline.rb
|
231
230
|
extensions: []
|
232
231
|
extra_rdoc_files: []
|
233
232
|
files:
|
@@ -238,7 +237,6 @@ files:
|
|
238
237
|
- README.md
|
239
238
|
- Rakefile
|
240
239
|
- bin/_rsense.rb
|
241
|
-
- bin/_rsense_commandline.rb
|
242
240
|
- config/puma.rb
|
243
241
|
- lib/rsense/server.rb
|
244
242
|
- lib/rsense/server/code.rb
|
data/bin/_rsense_commandline.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'optparse'
|
4
|
-
require 'json'
|
5
|
-
require "faraday"
|
6
|
-
require "uri"
|
7
|
-
|
8
|
-
module Rsense
|
9
|
-
class Request
|
10
|
-
SOCKET_PATH = 'localhost'
|
11
|
-
DEFAULT_PORT = 47367
|
12
|
-
|
13
|
-
def self.req(jsondata)
|
14
|
-
conn = Faraday.new(uri)
|
15
|
-
|
16
|
-
conn.post do |req|
|
17
|
-
req.headers["Content-Type"] = 'application.json'
|
18
|
-
req.body = jsondata
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.uri
|
23
|
-
uri = URI::HTTP.build({host: SOCKET_PATH, port: DEFAULT_PORT})
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class Main
|
28
|
-
def self.run(jsondata)
|
29
|
-
res_body = request(jsondata).body
|
30
|
-
completions_hash = JSON.parse(res_body)
|
31
|
-
self.stringify(completions_hash)
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.stringify(completions_hash)
|
35
|
-
compls = completions_hash["completions"].map do |c|
|
36
|
-
"#{c["name"]} #{c["qualified_name"]} #{c["base_name"]} #{c["kind"]}"
|
37
|
-
end
|
38
|
-
compls.join("\n")
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.request(jsondata)
|
42
|
-
Rsense::Request.req(jsondata)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
options = { command: "code_completion" }
|
48
|
-
OptionParser.new do |opts|
|
49
|
-
opts.banner = "Usage: rsense start [options]"
|
50
|
-
|
51
|
-
opts.on("--project PROJECT", "project path") do |project|
|
52
|
-
options[:project] = project
|
53
|
-
end
|
54
|
-
|
55
|
-
opts.on("--filepath FILEPATH", "Filepath") do |filepath|
|
56
|
-
options[:file] = filepath
|
57
|
-
end
|
58
|
-
|
59
|
-
opts.on("--text TEXT", "Text") do |text|
|
60
|
-
options[:code] = text
|
61
|
-
end
|
62
|
-
|
63
|
-
opts.on("--location LOCATION", "Location") do |location|
|
64
|
-
loc = location.split(':')
|
65
|
-
row = loc.first
|
66
|
-
col = loc.last
|
67
|
-
options[:location] = { row: (row.to_i + 1), column: (col.to_i + 1) }
|
68
|
-
end
|
69
|
-
end.parse!
|
70
|
-
|
71
|
-
begin
|
72
|
-
|
73
|
-
jsondata = JSON.generate(options)
|
74
|
-
|
75
|
-
compls = Rsense::Main.run(jsondata)
|
76
|
-
puts compls
|
77
|
-
|
78
|
-
rescue Exception => e
|
79
|
-
puts "ERROR: #{e}"
|
80
|
-
end
|