rsense-server 0.5.10 → 0.5.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/bin/_rsense.rb +24 -3
- data/bin/_rsense_commandline.rb +81 -0
- data/lib/rsense/server/command/graph.rb +89 -0
- data/lib/rsense/server/command/preload.rb +39 -14
- data/lib/rsense/server/command/runtime_helper.rb +30 -0
- data/lib/rsense/server/command.rb +34 -7
- data/lib/rsense/server/config.rb +0 -2
- data/lib/rsense/server/load_path.rb +2 -1
- data/lib/rsense/server/project.rb +6 -1
- data/lib/rsense/server/version.rb +1 -1
- data/rsense-server.gemspec +1 -1
- data/spec/integration_spec.rb +1 -1
- data/spec/rsense/server/command_spec.rb +16 -19
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a93ed224e1c6d3c0e2801f7ddeac43131e643575
|
4
|
+
data.tar.gz: 6dfc2697283bb4ebdb58526798cecc0485fb772f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ee3a53cc591ae8fdedd0cfdc7777ed40b4dfe084015f09243bba47bda9de55d8db893cb77c69ae8d496630ab039d41f6e029eefe5f6013f870e89902e932f5b
|
7
|
+
data.tar.gz: 5b54aaf75b9dfde8c8f87f41a9f88a951aedbb7c575c219dd92a714b83b6d43f67a4a3d51c1d587b014d722780f4d7cbacf8b71a56165d1e271b79df3c1683f3
|
data/bin/_rsense.rb
CHANGED
@@ -19,6 +19,10 @@ OptionParser.new do |opts|
|
|
19
19
|
opts.on("-p", "--port PORT", "Port") do |port|
|
20
20
|
options[:port] = port
|
21
21
|
end
|
22
|
+
|
23
|
+
opts.on("-d", "--debug", "Debug") do |debug|
|
24
|
+
options[:debug] = true
|
25
|
+
end
|
22
26
|
end.parse!
|
23
27
|
|
24
28
|
def config(options)
|
@@ -49,11 +53,20 @@ end
|
|
49
53
|
PORT = port(options)
|
50
54
|
|
51
55
|
class ProjectManager
|
52
|
-
attr_accessor :roptions, :rcommand, :rproject
|
56
|
+
attr_accessor :roptions, :rcommand, :rproject, :debug
|
57
|
+
|
58
|
+
def debug?
|
59
|
+
@debug
|
60
|
+
end
|
53
61
|
end
|
54
62
|
|
55
63
|
def projman_set_up(projman, options)
|
56
64
|
options[:path] ||= "."
|
65
|
+
if options[:debug]
|
66
|
+
projman.debug = true
|
67
|
+
else
|
68
|
+
projman.debug = false
|
69
|
+
end
|
57
70
|
path = Pathname.new(options[:path]).expand_path
|
58
71
|
Rsense::Server::Command::Preload.load(projman, path)
|
59
72
|
end
|
@@ -72,7 +85,7 @@ class RsenseApp < Sinatra::Base
|
|
72
85
|
set :port, PORT
|
73
86
|
|
74
87
|
def setup(jsondata)
|
75
|
-
if
|
88
|
+
if project_check?(jsondata)
|
76
89
|
PROJMAN.roptions = Rsense::Server::Options.new(jsondata)
|
77
90
|
PROJMAN.rcommand.options = PROJMAN.roptions
|
78
91
|
else
|
@@ -81,13 +94,21 @@ class RsenseApp < Sinatra::Base
|
|
81
94
|
end
|
82
95
|
end
|
83
96
|
|
97
|
+
def project_check?(jsondata)
|
98
|
+
PROJMAN.roptions && PROJMAN.roptions.project_path.to_s =~ /#{jsondata["project"]}/ && PROJMAN.rcommand && PROJMAN.roptions.file && PROJMAN.roptions.file.to_s =~ /#{jsondata["file"]}/
|
99
|
+
end
|
100
|
+
|
84
101
|
def code_completion
|
85
102
|
if PROJMAN.roptions.code
|
86
103
|
candidates = PROJMAN.rcommand.code_completion(PROJMAN.roptions.file, PROJMAN.roptions.location, PROJMAN.roptions.code)
|
87
104
|
else
|
88
105
|
candidates = PROJMAN.rcommand.code_completion(PROJMAN.roptions.file, PROJMAN.roptions.location)
|
89
106
|
end
|
90
|
-
|
107
|
+
|
108
|
+
if PROJMAN.debug?
|
109
|
+
PROJMAN.rcommand.errors.each { |e| puts e }
|
110
|
+
end
|
111
|
+
|
91
112
|
completions = candidates.map do |c|
|
92
113
|
{
|
93
114
|
name: c.completion,
|
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'json'
|
5
|
+
require 'net/http'
|
6
|
+
|
7
|
+
module Rsense
|
8
|
+
class Request
|
9
|
+
SOCKET_PATH = 'http://localhost'
|
10
|
+
DEFAULT_PORT = 47367
|
11
|
+
|
12
|
+
def self.req(jsondata)
|
13
|
+
request = Net::HTTP::Post.new uri
|
14
|
+
request.body = jsondata
|
15
|
+
|
16
|
+
Net::HTTP.start(uri.host, uri.port) do |http|
|
17
|
+
http.request request
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.uri
|
22
|
+
uri = URI(SOCKET_PATH)
|
23
|
+
uri.port = DEFAULT_PORT
|
24
|
+
uri
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Main
|
29
|
+
def self.run(jsondata)
|
30
|
+
req_body = request(jsondata).body
|
31
|
+
completions_hash = JSON.parse(req_body)
|
32
|
+
self.stringify(completions_hash)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.stringify(completions_hash)
|
36
|
+
compls = completions_hash["completions"].map do |c|
|
37
|
+
"#{c["name"]} #{c["qualified_name"]} #{c["base_name"]} #{c["kind"]}"
|
38
|
+
end
|
39
|
+
compls.join("\n")
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.request(jsondata)
|
43
|
+
Rsense::Request.req(jsondata)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
options = { command: "code_completion" }
|
49
|
+
OptionParser.new do |opts|
|
50
|
+
opts.banner = "Usage: rsense start [options]"
|
51
|
+
|
52
|
+
opts.on("--project PROJECT", "project path") do |project|
|
53
|
+
options[:project] = project
|
54
|
+
end
|
55
|
+
|
56
|
+
opts.on("--filepath FILEPATH", "Filepath") do |filepath|
|
57
|
+
options[:file] = filepath
|
58
|
+
end
|
59
|
+
|
60
|
+
opts.on("--text TEXT", "Text") do |text|
|
61
|
+
options[:code] = text
|
62
|
+
end
|
63
|
+
|
64
|
+
opts.on("--location LOCATION", "Location") do |location|
|
65
|
+
loc = location.split(':')
|
66
|
+
row = loc.first
|
67
|
+
col = loc.last
|
68
|
+
options[:location] = { row: (row.to_i + 1), column: (col.to_i + 1) }
|
69
|
+
end
|
70
|
+
end.parse!
|
71
|
+
|
72
|
+
begin
|
73
|
+
|
74
|
+
jsondata = JSON.generate(options)
|
75
|
+
|
76
|
+
compls = Rsense::Main.run(jsondata)
|
77
|
+
puts compls
|
78
|
+
|
79
|
+
rescue Exception => e
|
80
|
+
puts "ERROR: #{e}"
|
81
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require "pry"
|
2
|
+
require_relative "./runtime_helper"
|
3
|
+
|
4
|
+
module Rsense
|
5
|
+
module Server
|
6
|
+
module Command
|
7
|
+
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Rsense::Server::Command::Vertex < Java::org.cx4a.rsense.typing.vertex::Vertex
|
13
|
+
|
14
|
+
def addType(type)
|
15
|
+
unless type
|
16
|
+
return false
|
17
|
+
end
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Rsense::Server::Command::Graph < Java::org.cx4a.rsense.typing::Graph
|
23
|
+
RuntimeHelper = Rsense::Server::Command::RuntimeHelper
|
24
|
+
attr_accessor :context
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
super
|
28
|
+
@context = self.runtime.getContext
|
29
|
+
end
|
30
|
+
|
31
|
+
def visitDefnNode(node)
|
32
|
+
name = node.getName()
|
33
|
+
if name.match(/new/)
|
34
|
+
return Java::org.cx4a.rsense.typing.vertex::Vertex::EMPTY
|
35
|
+
end
|
36
|
+
super
|
37
|
+
end
|
38
|
+
|
39
|
+
def visitDefsNode(node)
|
40
|
+
name = node.getName()
|
41
|
+
if name.match(/new/)
|
42
|
+
return Java::org.cx4a.rsense.typing.vertex::Vertex::EMPTY
|
43
|
+
end
|
44
|
+
super
|
45
|
+
end
|
46
|
+
|
47
|
+
def visitColon2Node(node)
|
48
|
+
target = RuntimeHelper.getNamespace(self, node)
|
49
|
+
super
|
50
|
+
end
|
51
|
+
|
52
|
+
def visitClassNode(node)
|
53
|
+
cpath = node.getCPath()
|
54
|
+
name = cpath.getName()
|
55
|
+
RuntimeHelper.getNamespace(self, cpath)
|
56
|
+
super
|
57
|
+
end
|
58
|
+
|
59
|
+
def visitFCallNode(node)
|
60
|
+
if node.name.match(/filter!/)
|
61
|
+
if node.getArgs && node.getArgs.getNodeType == Java::org.jrubyparser.ast::NodeType::BLOCKPASSNODE
|
62
|
+
block_pass = node.getArgs()
|
63
|
+
argVertices = RuntimeHelper.setupCallArgs(self, block_pass.getArgs())
|
64
|
+
block = RuntimeHelper.setupCallBlock(self, block_pass)
|
65
|
+
else
|
66
|
+
argVertices = RuntimeHelper.setupCallArgs(self, node.getArgs())
|
67
|
+
block = RuntimeHelper.setupCallBlock(self, node.getIter())
|
68
|
+
end
|
69
|
+
vertex = Java::org.cx4a.rsense.typing.vertex::CallVertex.new(node, createFreeSingleTypeVertex(context.getFrameSelf()), argVertices, block)
|
70
|
+
vertex.setPrivateVisibility(true)
|
71
|
+
return RuntimeHelper.call(self, vertex)
|
72
|
+
end
|
73
|
+
super
|
74
|
+
end
|
75
|
+
|
76
|
+
def createFreeSingleTypeVertex(type)
|
77
|
+
vertex = createFreeVertex()
|
78
|
+
vertex.addType(type)
|
79
|
+
return vertex
|
80
|
+
end
|
81
|
+
|
82
|
+
def createFreeVertex(typeSet=nil)
|
83
|
+
if typeSet
|
84
|
+
return Rsense::Server::Command::Vertex.new(nil, typeSet)
|
85
|
+
else
|
86
|
+
return Rsense::Server::Command::Vertex.new
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -1,26 +1,51 @@
|
|
1
1
|
module Rsense
|
2
2
|
module Server
|
3
3
|
module Command
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
{
|
9
|
-
"command"=>"code_completion",
|
10
|
-
"project" => path.to_s,
|
11
|
-
"file" => filepath.to_s,
|
12
|
-
"code" => "def check(testarg)\n testarg\nend\ncheck('hello')",
|
13
|
-
"location" => { "row" => 2, "column" => 10 }
|
14
|
-
}
|
4
|
+
class Preload
|
5
|
+
SourceCode = Struct.new(:name, :full_name, :path, :files, :source)
|
6
|
+
|
7
|
+
def self.stub_data(path)
|
8
|
+
{ "project" => path.to_s }
|
15
9
|
end
|
16
|
-
module_function :stub_data
|
17
10
|
|
18
|
-
def load(project_manager, path)
|
11
|
+
def self.load(project_manager, path)
|
19
12
|
PROJMAN.roptions = Rsense::Server::Options.new(stub_data(path))
|
20
13
|
PROJMAN.rcommand = Rsense::Server::Command::Command.new(PROJMAN.roptions)
|
21
14
|
end
|
22
15
|
|
23
|
-
|
16
|
+
def self.dependency_code(dependencies)
|
17
|
+
paths = dependencies.map { |d| gen_source(d) }.compact!
|
18
|
+
lib_dirs(paths)
|
19
|
+
code(paths)
|
20
|
+
paths.each { |l| concat_files(l) }
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.gen_source(d)
|
24
|
+
SourceCode.new(d.name, d.full_name, d.path.first) if d.path.first
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.code(libs)
|
28
|
+
libs.each do |l|
|
29
|
+
l.files = Dir.glob(Pathname.new(l.path).join("**/*.rb"))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.concat_files(paths)
|
34
|
+
code = paths.files.map { |f| Pathname.new(f).read }
|
35
|
+
paths.source = code.join("\n")
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.lib_dirs(paths)
|
39
|
+
paths.each { |p|
|
40
|
+
p.path = find_lib(p)
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.find_lib(path)
|
45
|
+
p = Pathname.new(path.path).expand_path
|
46
|
+
return p.dirname if p.file?
|
47
|
+
return p
|
48
|
+
end
|
24
49
|
|
25
50
|
end
|
26
51
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
java_import Java::org.cx4a.rsense.typing.vertex::MultipleAsgnVertex
|
2
|
+
|
3
|
+
module Rsense
|
4
|
+
module Server
|
5
|
+
module Command
|
6
|
+
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Rsense::Server::Command::RuntimeHelper < Java::org.cx4a.rsense.typing.runtime::RuntimeHelper
|
12
|
+
|
13
|
+
def self.getNamespace(graph, node)
|
14
|
+
if node.class.to_s.match(/Colon2ConstNode/)
|
15
|
+
left = graph.createVertex((node).getLeftNode())
|
16
|
+
object = left.singleType()
|
17
|
+
if object && object.java_object.java_kind_of?(Java::org.cx4a.rsense.ruby::RubyModule)
|
18
|
+
return object
|
19
|
+
else
|
20
|
+
return nil
|
21
|
+
end
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.get_namespace(graph, node)
|
28
|
+
self.getNamespace(graph, node)
|
29
|
+
end
|
30
|
+
end
|
@@ -7,6 +7,7 @@ require_relative "./command/type_inference_method"
|
|
7
7
|
require_relative "./command/native_attr_method"
|
8
8
|
require_relative "./command/alias_native_method"
|
9
9
|
require_relative "./command/rsense_method"
|
10
|
+
require_relative "./command/preload"
|
10
11
|
|
11
12
|
module Rsense
|
12
13
|
module Server
|
@@ -95,7 +96,7 @@ class Rsense::Server::Command::Command
|
|
95
96
|
return LoadResult.alreadyLoaded() if project.loaded?(file)
|
96
97
|
return LoadResult.alreadyLoaded() if project.loaded?(feature)
|
97
98
|
return if file.extname =~ /(\.so|\.dylib|\.dll|\.java|\.class|\.jar|\.c$|\.h$|\.m$|\.js|\.html|\.css)/
|
98
|
-
|
99
|
+
|
99
100
|
project.loaded << file
|
100
101
|
|
101
102
|
oldmain = @context.main
|
@@ -105,6 +106,7 @@ class Rsense::Server::Command::Command
|
|
105
106
|
else
|
106
107
|
@context.main = false
|
107
108
|
end
|
109
|
+
return if file.directory?
|
108
110
|
|
109
111
|
source = file.read
|
110
112
|
return unless check_shebang(source)
|
@@ -112,11 +114,24 @@ class Rsense::Server::Command::Command
|
|
112
114
|
begin
|
113
115
|
@ast = @parser.parse_string(source, file.to_s)
|
114
116
|
project.graph.load(@ast)
|
115
|
-
|
116
|
-
result.setAST(@ast)
|
117
|
-
result
|
117
|
+
|
118
118
|
rescue Java::OrgJrubyparserLexer::SyntaxException => e
|
119
119
|
@errors << e
|
120
|
+
rescue Java::JavaUtil::ConcurrentModificationException => e
|
121
|
+
@errors << e
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def load_gem(project, source)
|
126
|
+
begin
|
127
|
+
@ast = @parser.parse_string(source.source, source.name)
|
128
|
+
project.graph.load(@ast)
|
129
|
+
rescue Java::OrgJrubyparserLexer::SyntaxException => e
|
130
|
+
@errors << e
|
131
|
+
rescue Java::JavaLang::NullPointerException => e
|
132
|
+
@errors << e
|
133
|
+
rescue Java::JavaUtil::ConcurrentModificationException => e
|
134
|
+
@errors << e
|
120
135
|
end
|
121
136
|
end
|
122
137
|
|
@@ -232,8 +247,8 @@ class Rsense::Server::Command::Command
|
|
232
247
|
source = code.inject_inference_marker(location)
|
233
248
|
@ast = @parser.parse_string(source, file.to_s)
|
234
249
|
@project.graph.load(@ast)
|
235
|
-
result = Java::org.cx4a.rsense::CodeCompletionResult.new
|
236
|
-
result.setAST(@ast)
|
250
|
+
# result = Java::org.cx4a.rsense::CodeCompletionResult.new
|
251
|
+
# result.setAST(@ast)
|
237
252
|
rescue Java::OrgJrubyparserLexer::SyntaxException => e
|
238
253
|
@errors << e
|
239
254
|
end
|
@@ -304,14 +319,26 @@ class Rsense::Server::Command::Command
|
|
304
319
|
prepare_project()
|
305
320
|
end
|
306
321
|
|
322
|
+
def set_features_loaded(deps)
|
323
|
+
deps.each do |d|
|
324
|
+
@project.loaded << d.name
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
307
328
|
def prepare_project()
|
308
329
|
if @options.name
|
309
|
-
name = @
|
330
|
+
name = @options.name
|
310
331
|
else
|
311
332
|
name = "(sandbox)"
|
312
333
|
end
|
313
334
|
file = @options.project_path
|
314
335
|
@project = Rsense::Server::Project.new(name, file)
|
336
|
+
prepare(project)
|
337
|
+
set_features_loaded(@project.dependencies)
|
338
|
+
codes = Rsense::Server::Command::Preload.dependency_code(@project.dependencies)
|
339
|
+
codes.each do |c|
|
340
|
+
load_gem(@project, c)
|
341
|
+
end
|
315
342
|
end
|
316
343
|
|
317
344
|
end
|
data/lib/rsense/server/config.rb
CHANGED
@@ -22,9 +22,10 @@ module Rsense
|
|
22
22
|
start_dir = Dir.pwd
|
23
23
|
Dir.chdir(@gemfile.dirname)
|
24
24
|
lockfile = Bundler::LockfileParser.new(Bundler.read_file(@gemfile))
|
25
|
-
gem_info(lockfile)
|
25
|
+
@deps = gem_info(lockfile)
|
26
26
|
Dir.chdir(start_dir)
|
27
27
|
end
|
28
|
+
@deps
|
28
29
|
end
|
29
30
|
|
30
31
|
def gem_info(lfile)
|
@@ -1,3 +1,7 @@
|
|
1
|
+
require_relative "./command/graph"
|
2
|
+
require_relative "./command/runtime_helper"
|
3
|
+
require "rsense-core"
|
4
|
+
|
1
5
|
module Rsense
|
2
6
|
module Server
|
3
7
|
class Project
|
@@ -6,7 +10,8 @@ module Rsense
|
|
6
10
|
def initialize(name, path)
|
7
11
|
@name = name
|
8
12
|
@path = path
|
9
|
-
|
13
|
+
#@graph = Java::org.cx4a.rsense.typing::Graph.new
|
14
|
+
@graph = Rsense::Server::Command::Graph.new
|
10
15
|
@runtime = @graph.getRuntime()
|
11
16
|
@stubs = Dir.glob(Rsense::BUILTIN.join("**/*.rb"))
|
12
17
|
@load_path = Rsense::Server::LoadPath.paths
|
data/rsense-server.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib", "vendor/gems/puma-2.8.2-java/lib/"]
|
20
20
|
|
21
|
-
spec.add_dependency "rsense-core", "~> 0.6.
|
21
|
+
spec.add_dependency "rsense-core", "~> 0.6.6"
|
22
22
|
spec.add_dependency "spoon", "~> 0.0.4"
|
23
23
|
spec.add_dependency "jruby-jars", "~> 1.7.4"
|
24
24
|
spec.add_dependency "jruby-parser", "~> 0.5.4"
|
data/spec/integration_spec.rb
CHANGED
@@ -3,15 +3,13 @@ require "json"
|
|
3
3
|
require_relative "../../spec_helper.rb"
|
4
4
|
|
5
5
|
describe Rsense::Server::Command::Command do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@options = Rsense::Server::Options.new(@json)
|
11
|
-
end
|
6
|
+
json_path = Pathname.new("spec/fixtures/sample.json")
|
7
|
+
json = JSON.parse(json_path.read)
|
8
|
+
OPTIONS = Rsense::Server::Options.new(json)
|
9
|
+
COMMAND = Rsense::Server::Command::Command.new(OPTIONS)
|
12
10
|
|
13
11
|
it "can be initialized" do
|
14
|
-
Rsense::Server::Command::Command.new(
|
12
|
+
Rsense::Server::Command::Command.new(OPTIONS)
|
15
13
|
end
|
16
14
|
|
17
15
|
describe "finding dependencies" do
|
@@ -32,47 +30,46 @@ describe Rsense::Server::Command::Command do
|
|
32
30
|
"/i/smell/the/blood/of/an/englishman"
|
33
31
|
]
|
34
32
|
@stubs = Dir.glob(Rsense::BUILTIN.join("**/*.rb"))
|
35
|
-
@project = Project.new(
|
36
|
-
@command = Rsense::Server::Command::Command.new(@options)
|
33
|
+
@project = Project.new("(test-sandbox)", "spec/fixtures/test_gem/", @stubs)
|
37
34
|
end
|
38
35
|
|
39
36
|
it "finds the dependency" do
|
40
|
-
matches =
|
37
|
+
matches = COMMAND.dependency_matches(@dependencies, "foo")
|
41
38
|
matches.first.to_s.must_match(/baz/)
|
42
39
|
end
|
43
40
|
|
44
41
|
it "does not find a dependency which is not there" do
|
45
|
-
|
42
|
+
COMMAND.dependency_matches(@dependencies, "scoby").must_be_empty
|
46
43
|
end
|
47
44
|
|
48
45
|
it "finds the path in the load_path" do
|
49
|
-
@
|
46
|
+
@project.load_path = @loadpath
|
47
|
+
COMMAND.load_path_matches(@project, "def_sample").size.must_equal(1)
|
50
48
|
end
|
51
49
|
|
52
50
|
it "gathers the lib directory paths from the dependencies" do
|
53
51
|
deps = [
|
54
52
|
Dependency.new("foo", "foo.1.2", ["/foo/lib/foo.rb"]),
|
55
|
-
Dependency.new("scooby", "scooby.1.2", ["/scooby/lib/scooby.rb"])
|
56
53
|
]
|
57
|
-
paths =
|
58
|
-
|
59
|
-
paths.
|
54
|
+
paths = COMMAND.dependency_paths(deps)
|
55
|
+
|
56
|
+
paths.to_s.must_match(/\/foo\/lib/)
|
60
57
|
end
|
61
58
|
|
62
59
|
it "finds a deeply nested path" do
|
63
60
|
dep_paths = [Pathname.new("spec/fixtures/deeply"), Pathname.new("foo/bar/baz")]
|
64
|
-
matches =
|
61
|
+
matches = COMMAND.deep_check(@gempath, dep_paths, "thing")
|
65
62
|
matches.first.must_match(/nested/)
|
66
63
|
matches.size.must_equal(1)
|
67
64
|
end
|
68
65
|
|
69
66
|
it "finds the stubs" do
|
70
|
-
matches =
|
67
|
+
matches = COMMAND.stub_matches(@project, "_builtin")
|
71
68
|
matches.size.must_equal(1)
|
72
69
|
end
|
73
70
|
|
74
71
|
it "finds the _builtin" do
|
75
|
-
|
72
|
+
COMMAND.builtin_path(@project).to_s.must_match(/_builtin/)
|
76
73
|
end
|
77
74
|
end
|
78
75
|
|
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.11
|
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-06
|
12
|
+
date: 2014-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rsense-core
|
@@ -17,12 +17,12 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.6.
|
20
|
+
version: 0.6.6
|
21
21
|
requirement: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - ~>
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 0.6.
|
25
|
+
version: 0.6.6
|
26
26
|
prerelease: false
|
27
27
|
type: :runtime
|
28
28
|
- !ruby/object:Gem::Dependency
|
@@ -213,6 +213,7 @@ email:
|
|
213
213
|
- tomo@cx4a.org
|
214
214
|
executables:
|
215
215
|
- _rsense.rb
|
216
|
+
- _rsense_commandline.rb
|
216
217
|
extensions: []
|
217
218
|
extra_rdoc_files: []
|
218
219
|
files:
|
@@ -223,15 +224,18 @@ files:
|
|
223
224
|
- README.md
|
224
225
|
- Rakefile
|
225
226
|
- bin/_rsense.rb
|
227
|
+
- bin/_rsense_commandline.rb
|
226
228
|
- config/puma.rb
|
227
229
|
- lib/rsense/server.rb
|
228
230
|
- lib/rsense/server/code.rb
|
229
231
|
- lib/rsense/server/command.rb
|
230
232
|
- lib/rsense/server/command/alias_native_method.rb
|
231
233
|
- lib/rsense/server/command/completion_result.rb
|
234
|
+
- lib/rsense/server/command/graph.rb
|
232
235
|
- lib/rsense/server/command/native_attr_method.rb
|
233
236
|
- lib/rsense/server/command/preload.rb
|
234
237
|
- lib/rsense/server/command/rsense_method.rb
|
238
|
+
- lib/rsense/server/command/runtime_helper.rb
|
235
239
|
- lib/rsense/server/command/special_meth.rb
|
236
240
|
- lib/rsense/server/command/type_inference_method.rb
|
237
241
|
- lib/rsense/server/config.rb
|