rsense 0.5.10 → 0.5.11

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: c5420015ec9acd58fe3fc45e87327d3bda83cac2
4
- data.tar.gz: 9bf9aac240294f434f8809d5adef9ba7da07505b
3
+ metadata.gz: ec442a29560df18a630c76fc285cbe3a55d4a3d3
4
+ data.tar.gz: c563b490f170176d5b29a69d2eecd819a217fa1d
5
5
  SHA512:
6
- metadata.gz: 8f740b06f4810eb845c7972beeb6ba4672997d907a7ad976792be1d8c1bbc0ec5971dfebf9a1e49661704a96784674aa477fcb9c693506d6197bff8ab85f2ffc
7
- data.tar.gz: 2975ffa4503db0c10625321fcd64ca4428083c3d5ded73de26210df8f1af75b081fa693f7ec3ee4a9255dfb69f11ac6c2eb4428ed8023fcc1909b7198ea0db8a
6
+ metadata.gz: 503bbe40ef6d373e99abd2713147a5f0f50e9ee58325f15a55663403c6b058a458287e20f91fa5cae355cf08186d36f426b702295d3f1ce174362778a85bb78d
7
+ data.tar.gz: f4399af94027ee674196bcfd8fa9d8aa7f6434e608fe2d8b9f17528b69a610d10e17bdcd804e8fe760a9e9c145802ca9eed9581cd2a1a9ad09e6bb784f268130
data/README.md CHANGED
@@ -12,6 +12,7 @@ RSense is currently under heavy development and ready for testing. Currently we
12
12
 
13
13
 
14
14
  ## Installation
15
+ RSense is installed via RubyGems. It works well installed via Bundler as that gives it access to your application's LOAD_PATH very easily, and ensures it's installed into the same Ruby as your other dependencies if you happen to be using a version management tool like `rbenv`. Otherwise, be sure to install it with the proper version of Ruby.
15
16
 
16
17
  Add this line to your application's Gemfile:
17
18
 
@@ -29,18 +30,22 @@ Or install it yourself as:
29
30
 
30
31
  Install one of these plugins:
31
32
  - [rsense/atom-rsense](https://atom.io/packages/rsense)
33
+ - [rsense/SublimeRsense](https://github.com/rsense/SublimeRsense)
34
+ - [rsense/rsense.tmbundle](https://github.com/rsense/rsense.tmbundle)
35
+
36
+ Start RSense via the commandline with `rsense start`. Rsense can take two options, in case of a port conflict, you can set the port with `rsense start --port 12345`. It can also take a project path, like `rsense start --path /path/to/my/project`. When passed a project path, rsense attempts to preload the project's dependencies based on the `Gemfile.lock`.
32
37
 
33
38
  ## Plugin Authors
34
39
 
35
- Rsense plugins are easy to implement. First your plugin will need to ensure the Rsense server has been started. It can do this by shelling out to the command line with `rsense start`. The server can optionally take a port number like this: `rsense server --port 12345`. The default port is `47367`. It also takes a project path, in case the user has a `.rsense` config file there. For now, this config file is not very useful, but it may become so in the future.
40
+ Rsense plugins are easy to implement. First your plugin will need to ensure the Rsense server has been started. It can do this by shelling out to the command line with `rsense start`. The server can optionally take a port number like this: `rsense start --port 12345`. The default port is `47367`. It also takes a project path, in case the user has a `.rsense` config file there. For now, this config file is not very useful, but it may become so in the future.
36
41
 
37
- The rsense server will be running at `http://localhost:47367` (or an alternate port if you specify one). It communicates via json. You need to send it json like the following example:
42
+ The rsense server will be running at `http://localhost:47367` (or an alternate port if you specify one). It communicates via json. You need to send it json like the following example, via POST:
38
43
 
39
44
  ```json
40
45
  {
41
46
  "command": "code_completion",
42
- "project": "spec/fixtures/test_gem",
43
- "file": "spec/fixtures/test_gem/lib/sample.rb",
47
+ "project": "/home/myprojects/test_gem",
48
+ "file": "/home/myprojects/test_gem/lib/sample.rb",
44
49
  "code": "require \"sample/version\"\n\nmodule Sample\n class Sample\n attr_accessor :simple\n\n def initialize\n @simple = \"simple\"\n end\n\n def another\n \"another\"\n end\n end\nend\n\nsample = Sample::Sample.new\nsample",
45
50
  "location": {
46
51
  "row": 18,
@@ -49,7 +54,13 @@ The rsense server will be running at `http://localhost:47367` (or an alternate p
49
54
  }
50
55
  ```
51
56
 
52
- For now, `code_completion` is the only command available, but this will change in the future. Project is the root dir of the user's project. This is needed for finding information about project dependencies. Code is the text from the file where a completion is being triggered. Location should be obvious.
57
+ For now, `code_completion` is the only command available, but this will change in the future.
58
+
59
+ Use absolute paths for both paths as there's no way to be sure where the user may have rsense installed. Project is the root dir of the user's project. This is needed for finding information about project dependencies. Rsense uses project path to get information from RubyGems and Bundler about your dependencies so it can do accurate type inference. RSense uses the filepath for tracking SourcePosition. This is only slightly important for code-completion and most completions will work without it. HOWEVER, when we begin looking into source-rewriting for refactorings, or even exposing the already written Find Definition tool, it will be necessary.
60
+
61
+ `code` is the text from the file where a completion is being triggered. We send it with the command because it is unlikely the user will have saved the file. Many tools which act on source code resolve this by writing to a tempfile, but I find this to be a hacky, and unnecessary solution. Rsense takes the code directly.
62
+
63
+ Location is tricky. Editor's measure cursor position in different ways. Rsense expects 1-based numbers here, with the first row, and first column being (1, 1). With each editor I've worked with, I've found it necessary to play around until it works. But you can examine `spec/fixtures/test_gem/lib/sample.rb` for the file being from which the above json was generated for use as a test-case.
53
64
 
54
65
  Rsense will return json that looks like the below:
55
66
 
@@ -72,6 +83,19 @@ Rsense will return json that looks like the below:
72
83
  ]
73
84
  }
74
85
 
86
+ ```
87
+ Rsense now comes with a secondary executable- `_rsense_commandline.rb`. If forming json and sending commands via http is difficult from your editor, `_rsense_commandline.rb` can do it for you. Just shell out to it with the needed info, like this:
88
+
89
+ ```bash
90
+ _rsense_commandline.rb --project=/home/projects/myproject --filepath=/home/projects/myproject/lib/test_case.rb --text='class TestCase
91
+ def junk
92
+ "Hello"
93
+ end
94
+ end
95
+
96
+ tt = TestCase.new
97
+ tt.
98
+ ' --location='7:3'
75
99
  ```
76
100
 
77
101
  ## Contributing
@@ -1,3 +1,3 @@
1
1
  module Rsense
2
- VERSION = "0.5.10"
2
+ VERSION = "0.5.11"
3
3
  end
data/rsense.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "rsense-core", "~> 0.6.6"
22
- spec.add_dependency "rsense-server", "~> 0.5.11"
22
+ spec.add_dependency "rsense-server", "~> 0.5.12"
23
23
  spec.add_dependency "spoon", "~> 0.0.4"
24
24
  spec.add_dependency "jruby-jars", "~> 1.7.4"
25
25
  spec.add_dependency "jruby-parser", "~> 0.5.4"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsense
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.10
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-07-06 00:00:00.000000000 Z
12
+ date: 2014-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rsense-core
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 0.5.11
34
+ version: 0.5.12
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 0.5.11
41
+ version: 0.5.12
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: spoon
44
44
  requirement: !ruby/object:Gem::Requirement