rsense-server 0.5.2 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59a7e403afc05e2f67e50e7d33c8d526a7a61159
4
- data.tar.gz: 8f0a7e59751031424ffb131f92502da089aa79da
3
+ metadata.gz: f8baee56e544b5d2b5226f349d5f4056d3b07a2f
4
+ data.tar.gz: 246f872f84091d4ef65706bc71616a1f00106c5f
5
5
  SHA512:
6
- metadata.gz: edff3e46860b8f24bc07895f106a34535299b10c366409bc7b89e51ef57fffe0f462233f4dae6d4e923e5677eff0b79a19684fcfcd58f2297e552a3f3ca561ad
7
- data.tar.gz: 4017afb091033435c0a1f915af0fc2249310bcc009155fc67efe1ed07e00d5f2d4ccb98b75f65a5bb194d88fe63f795631231701afc4c93d9ed61bd9269af37b
6
+ metadata.gz: 1fcecf455fcb3e7e5ceba461046d4d304fe148473167195b529cedf8948a4e0aef29c496d8314f1e8ec534b02cd5c1729b2b348856412991b8ba4d6d730ffecb
7
+ data.tar.gz: 80b8afdbb2fc95f328c6cb68f97d0e8bd0c4b9230ca213663c858b4b881024c5292180afa9cd9ba87438ade0cbda6befc528f546747811a1986b993e952835ee
@@ -1,6 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
1
3
  require "rsense/server"
2
4
  require "rsense/server/config"
3
5
  require "optparse"
6
+ require "awesome_print"
4
7
 
5
8
  SOCKET_PATH = '127.0.0.1:'
6
9
  DEFAULT_PORT = 47367
@@ -62,9 +65,8 @@ class RsenseApp < Sinatra::Base
62
65
  set :port, PORT
63
66
 
64
67
  def setup(jsondata)
65
- if PROJMAN.roptions && PROJMAN.roptions.project_path.to_s =~ /#{jsondata["project"]}/
66
- changed = check_options(jsondata)
67
- return if changed && changed.empty?
68
+ if PROJMAN.roptions && PROJMAN.roptions.project_path.to_s =~ /#{jsondata["project"]}/ && PROJMAN.rcommand && PROJMAN.roptions.file.to_s =~ /#{jsondata["file"]}/
69
+ PROJMAN.roptions = Rsense::Server::Options.new(jsondata)
68
70
  PROJMAN.rcommand.options = PROJMAN.roptions
69
71
  else
70
72
  PROJMAN.roptions = Rsense::Server::Options.new(jsondata)
@@ -72,20 +74,6 @@ class RsenseApp < Sinatra::Base
72
74
  end
73
75
  end
74
76
 
75
- def check_options(data)
76
- changed = []
77
- data.each do |k, v|
78
- if PROJMAN.roptions.respond_to? k.to_sym
79
- keyval = PROJMAN.roptions.send k.to_sym
80
- unless keyval.to_s =~ /#{v}/
81
- PROJMAN.roptions.__send__("#{k}=", v)
82
- changed << k
83
- end
84
- end
85
- end
86
- changed
87
- end
88
-
89
77
  def code_completion
90
78
  if PROJMAN.roptions.code
91
79
  candidates = PROJMAN.rcommand.code_completion(PROJMAN.roptions.file, PROJMAN.roptions.location, PROJMAN.roptions.code)
@@ -108,6 +96,8 @@ class RsenseApp < Sinatra::Base
108
96
  Thread.new do
109
97
  if PROJMAN.rcommand.placeholders.first
110
98
  proj, feat = PROJMAN.rcommand.placeholders.shift
99
+ puts "Add deps: "
100
+ puts feat
111
101
  PROJMAN.rcommand.rrequire(proj, feat, true, 0)
112
102
  end
113
103
  end
@@ -1,6 +1,6 @@
1
1
  require "pathname"
2
- require "pry"
3
2
  require "rsense-core"
3
+ require "pry"
4
4
  require_relative "./listeners/find_definition_event_listener"
5
5
  require_relative "./listeners/where_event_listener"
6
6
  require_relative "./command/special_meth"
@@ -68,7 +68,10 @@ class Rsense::Server::Command::Command
68
68
  if feature
69
69
  files = Dir.glob(Pathname.new(args.first.node.position.file).dirname.join("#{feature}*"))
70
70
  files.each do |f|
71
- rload(project, f, "UTF-8", false)
71
+ pth = Pathname.new(f).expand_path
72
+ if pth.file?
73
+ rload(project, f, "UTF-8", false)
74
+ end
72
75
  end
73
76
  end
74
77
  end
@@ -89,9 +92,13 @@ class Rsense::Server::Command::Command
89
92
 
90
93
  def rload(project, file, encoding, prep)
91
94
  file = Pathname.new(file)
95
+ feature = file.basename.to_s.sub(file.extname, "")
92
96
  return LoadResult.alreadyLoaded() if project.loaded?(file)
93
- return if file.extname =~ /(\.so|\.dylib|\.dll|\.java|\.class|\.c$|\.h$|\.m$|\.js|\.html|\.css)/
97
+ return LoadResult.alreadyLoaded() if project.loaded?(feature)
98
+ return if file.extname =~ /(\.so|\.dylib|\.dll|\.java|\.class|\.jar|\.c$|\.h$|\.m$|\.js|\.html|\.css)/
99
+ project.loaded << feature
94
100
  project.loaded << file
101
+
95
102
  oldmain = @context.main
96
103
 
97
104
  if prep
@@ -100,8 +107,11 @@ class Rsense::Server::Command::Command
100
107
  @context.main = false
101
108
  end
102
109
 
110
+ source = file.read
111
+ return unless check_shebang(source)
112
+
103
113
  begin
104
- @ast = @parser.parse_string(file.read, file.to_s)
114
+ @ast = @parser.parse_string(source, file.to_s)
105
115
  project.graph.load(@ast)
106
116
  result = LoadResult.new
107
117
  result.setAST(@ast)
@@ -111,15 +121,21 @@ class Rsense::Server::Command::Command
111
121
  end
112
122
  end
113
123
 
124
+ def check_shebang(source)
125
+ return true unless source.match(/^#!/)
126
+ source.match(/^(#!)(\/\w+)*\/ruby/)
127
+ end
128
+
114
129
  def rrequire(project, feature, background, loadPathLevel=0)
115
- puts feature
130
+
116
131
  encoding = "UTF-8"
117
132
 
118
133
  lplevel = @context.loadPathLevel
119
134
  @context.loadPathLevel = loadPathLevel
120
- if lplevel > 1 && background == false
135
+ if lplevel > 2 && background == false
121
136
  return @placeholders << [project, feature]
122
137
  end
138
+
123
139
  return LoadResult.alreadyLoaded() if project.loaded?(feature)
124
140
 
125
141
  if PROJMAN && PROJMAN.roptions && PROJMAN.roptions.project_path
@@ -158,12 +174,14 @@ class Rsense::Server::Command::Command
158
174
  rload(project, cp, encoding, false)
159
175
  end
160
176
  end
161
- @context.loadPathLevel = lplevel
162
177
  end
163
178
 
164
179
  def load_builtin(project)
165
180
  builtin = builtin_path(project)
166
181
  rload(project, builtin, "UTF-8", false)
182
+ project.stubs.each do |p|
183
+ rload(project, Pathname.new(p), "UTF-8", false) unless p.match(/builtin/)
184
+ end
167
185
  end
168
186
 
169
187
  def builtin_path(project)
@@ -223,6 +241,7 @@ class Rsense::Server::Command::Command
223
241
 
224
242
  candidates = []
225
243
  @receivers = []
244
+
226
245
  @context.typeSet.each do |receiver|
227
246
  @receivers << receiver
228
247
  ruby_class = receiver.getMetaClass
@@ -265,7 +284,7 @@ class Rsense::Server::Command::Command
265
284
  @context.main = true
266
285
  @type_inference_method.context = @context
267
286
  @graph = project.graph
268
- @native_attr_method.graph = graph
287
+ @native_attr_method.graph = @graph
269
288
  @graph.addSpecialMethod(Rsense::Server::Command::TYPE_INFERENCE_METHOD_NAME, @type_inference_method)
270
289
  @graph.addSpecialMethod("require", @require_method)
271
290
  @graph.addSpecialMethod("require_next", @require_next_method)
@@ -1,5 +1,4 @@
1
1
  require "jruby-parser"
2
- require "pry"
3
2
 
4
3
  module Rsense
5
4
  module Server
@@ -55,5 +54,3 @@ module Rsense
55
54
  end
56
55
  end
57
56
  end
58
-
59
-
@@ -32,7 +32,12 @@ module Rsense
32
32
  end
33
33
 
34
34
  def file=(path)
35
- @file = Pathname.new(path).expand_path
35
+ file = Pathname.new(path.to_s).expand_path
36
+ if file.exist?
37
+ @file = file
38
+ else
39
+ @file = Pathname.new(".")
40
+ end
36
41
  end
37
42
 
38
43
  def here_doc_reader(reader)
@@ -86,4 +91,3 @@ module Rsense
86
91
  end
87
92
  end
88
93
  end
89
-
@@ -1,5 +1,5 @@
1
1
  module Rsense
2
2
  module Server
3
- VERSION = "0.5.2"
3
+ VERSION = "0.5.4"
4
4
  end
5
5
  end
@@ -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"
21
+ spec.add_dependency "rsense-core", "~> 0.5.8"
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"
@@ -22,7 +22,7 @@ describe "completions" do
22
22
  it "returns completions" do
23
23
  @script = TestMockscript.new
24
24
  compls = @script.code_complete
25
- compls.size.must_equal(51)
25
+ compls.size.must_equal(58)
26
26
  end
27
27
 
28
28
  end
@@ -3,11 +3,6 @@ require "json"
3
3
  require_relative "../../spec_helper.rb"
4
4
 
5
5
  describe Rsense::Server::Command::Command do
6
- class ProjectManager
7
- attr_accessor :roptions, :rcommand, :rproject
8
- end
9
-
10
- PROJMAN = ProjectManager.new
11
6
 
12
7
  before do
13
8
  @json_path = Pathname.new("spec/fixtures/sample.json")
@@ -14,3 +14,9 @@ require_relative "../lib/rsense/server/path_info.rb"
14
14
  require_relative "../lib/rsense/server/command/special_meth.rb"
15
15
  require_relative "../lib/rsense/server/project.rb"
16
16
  require_relative "../lib/rsense/server/config.rb"
17
+
18
+ class ProjectManager
19
+ attr_accessor :roptions, :rcommand, :rproject
20
+ end
21
+
22
+ PROJMAN = ProjectManager.new
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.2
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric West
@@ -9,20 +9,20 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-13 00:00:00.000000000 Z
12
+ date: 2014-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rsense-core
16
16
  version_requirements: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: 0.5.8
21
21
  requirement: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - '>='
23
+ - - ~>
24
24
  - !ruby/object:Gem::Version
25
- version: '0'
25
+ version: 0.5.8
26
26
  prerelease: false
27
27
  type: :runtime
28
28
  - !ruby/object:Gem::Dependency