-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
242 lines (212 loc) · 14 KB
/
index.html
File metadata and controls
242 lines (212 loc) · 14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if IE 9]> <html class="no-js ie9" lang="en"> <![endif]-->
<!-- Consider adding an manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 9]><!--> <html class="no-js" lang="en" itemscope="" itemtype="http://schema.org/Product"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<!-- Use the .htaccess and remove these lines to avoid edge case issues.
More info: h5bp.com/b/378 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>RSense Sees All</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="humans.txt">
<link rel="shortcut icon" href="favicon.png" type="image/x-icon">
<!-- Facebook Metadata /-->
<meta property="fb:page_id" content="">
<meta property="og:image" content="">
<meta property="og:description" content="">
<meta property="og:title" content="">
<!-- Google+ Metadata /-->
<meta itemprop="name" content="">
<meta itemprop="description" content="">
<meta itemprop="image" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<link rel="stylesheet" href="css/gumby.css">
<link rel="stylesheet" href="css/prism.css">
<script src="bower_components/gumby/js/libs/modernizr-2.6.2.min.js"></script>
</head>
<body>
<script>
var oldieCheck = Boolean(document.getElementsByTagName('html')[0].className.match(/\soldie\s/g));
if(!oldieCheck) {
document.write('<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"><\/script>');
} else {
document.write('<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"><\/script>');
}
</script>
<script>
if(!window.jQuery) {
if(!oldieCheck) {
document.write('<script src="bower_components/gumby/js/libs/jquery-2.0.2.min.js"><\/script>');
} else {
document.write('<script src="bower_components/gumby/js/libs/jquery-1.10.1.min.js"><\/script>');
}
}
</script>
<script gumby-touch="js/libs" src="bower_components/gumby/js/libs/gumby.js"></script>
<script src="bower_components/gumby/js/libs/ui/gumby.retina.js"></script>
<script src="bower_components/gumby/js/libs/ui/gumby.fixed.js"></script>
<script src="bower_components/gumby/js/libs/ui/gumby.skiplink.js"></script>
<script src="bower_components/gumby/js/libs/ui/gumby.toggleswitch.js"></script>
<script src="bower_components/gumby/js/libs/ui/gumby.checkbox.js"></script>
<script src="bower_components/gumby/js/libs/ui/gumby.radiobtn.js"></script>
<script src="bower_components/gumby/js/libs/ui/gumby.tabs.js"></script>
<script src="bower_components/gumby/js/libs/ui/gumby.navbar.js"></script>
<script src="bower_components/gumby/js/libs/ui/jquery.validation.js"></script>
<script src="bower_components/gumby/js/libs/gumby.init.js"></script>
<script src="bower_components/gumby/js/plugins.js"></script>
<script src="bower_components/gumby/js/main.js"></script>
<script src="js/prism.js"></script>
<!-- Change UA-XXXXX-X to be your site's ID -->
<!--<script>
window._gaq = [['_setAccount','UAXXXXXXXX1'],['_trackPageview'],['_trackPageLoadTime']];
Modernizr.load({
load: ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js'
});
</script>-->
<!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
chromium.org/developers/how-tos/chrome-frame-getting-started -->
<!--[if lt IE 7 ]>
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
<script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
<![endif]-->
<div class="pretty navbar row" id="nav4">
<a class="toggle" gumby-trigger="#nav4 > ul" href="#"><i class="icon-menu"></i></a>
<h1 class="four columns logo">
<a href="#">
<img src="img/rsense.png" gumby-retina="">
</a>
</h1>
<ul class="eight columns">
<li><a href="#about">About</a></li>
<li>
<a href="#">Documentation</a>
<div class="dropdown">
<ul>
<li><a href="#installation">Installation</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#plugin-authors">Plugin Authors</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#credits">Credits</a></li>
<li><a href="#community">Community</a></li>
</ul>
</div>
</li>
<li><a href="https://github.com/rsense/rsense">Github</a></li>
<li><a href="https://gitter.im/rsense/rsense">Community</a></li>
</ul>
</div>
<div class="row">
<div class="row">
<h2 id="about">About</h2>
<p>RSense is a tool for doing static analysis of Ruby source code. Rsense is used in conjunction with an editor plugin.</p>
<p>RSense is currently under heavy development and ready for testing. Currently we need to improve the homepage and develop plugins for code_completion. In the near future we'll also be ready to implement some of the other basic features like <code>find-definition</code>. After that, there's plenty to do in the long term. See the waffle link below to find out where you can pitch in. It would be awesome if you helped get things done.</p>
<p><img src="https://cloud.githubusercontent.com/assets/1395968/3344028/5b3c2f0a-f8a6-11e3-8952-c0f7155cb19e.gif" alt="Rsense in Atom editor"></p>
<h2 id="installation">Installation</h2>
<p>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.</p>
<p>Add this line to your application's Gemfile:</p>
<pre class="line-numbers language-bash"><code class="language-bash">gem 'rsense'
</code></pre><p>And then execute:</p>
<pre class="line-numbers language-bash"><code class="language-bash">$ bundle
</code></pre><p>Or install it yourself as:</p>
<pre class="line-numbers language-bash"><code class="language-bash">$ gem install rsense
</code></pre><h2 id="usage">Usage</h2>
<p>Install one of these plugins:</p>
<ul>
<li><a href="https://atom.io/packages/rsense">Atom: rsense/atom-rsense</a></li>
<li><a href="https://github.com/rsense/rsense.tmbundle">Textmate2: rsense/rsense.tmbundle</a></li>
<li><a href="https://github.com/rsense/SublimeRsense">Sublime Text: rsense/SublimeRsense</a></li>
</ul>
<p>The Rsense server is started from the commandline with:</p>
<pre class="line-numbers language-bash"><code class="language-bash">$ rsense start
</code></pre><p>It takes two potential options: <code class="language-bash">--port</code> and <code class="language-bash">--path</code>.</p>
<p>Currently there are plugins for Atom, Sublime Text and Textmate2. If the community does not contribute Vim and Emacs plugins, we will eventually do so.</p>
<p><strong>When using Rsense, please be patient. After starting the server, Rsense can take some time to warm up and to load your projects dependencies into it's graph. It's quite fast after returning the initial completion and we will continue working to optimize this.</strong></p>
<p><img src="https://cloud.githubusercontent.com/assets/1395968/3489447/9fae5abc-052d-11e4-9dd9-447e36f1e112.gif" alt="Rsense in Sublime Text editor"></p>
<h2 id="plugin-authors">Plugin Authors</h2>
<p>Rsense plugins are easy to implement. First your plugin may want to ensure the Rsense server has been started. It can do this by shelling out to the command line with <code class="language-bash">rsense start</code>. Alternately, you can instruct your users to start it from the command line. The server can optionally take a port number like this: <code class="language-bash">rsense start --port 12345</code>. The default port is <code class="language-bash">47367</code>. It also takes a project path, in case the user has a <code class="language-bash">.rsense</code> config file there. For now, this config file is not very useful, but it may become so in the future.</p>
<p>The rsense server will be running at <code class="language-bash">http://localhost:47367</code> (or an alternate port if you specify one). It communicates via json. You need to send it json like the following example, via POST:</p>
<pre class="line-numbers language-javascript"><code class="language-javascript">
{
"command": "code_completion",
"project": "spec/fixtures/test_gem",
"file": "spec/fixtures/test_gem/lib/sample.rb",
"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",
"location": {
"row": 18,
"column": 7
}
}
</code></pre>
<p>For now, <code class="language-bash">code_completion</code> is the only command available, but this will change in the future. </p>
<p>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.</p>
<p>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.</p>
<p>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 from which the above json was generated for use as a test-case.</p>
<p>Rsense will return json that looks like the below:</p>
<pre class="line-numbers language-javascript"><code class="language-javascript">
{
"completions":
[
{
"name":"taint",
"qualified_name":"Object#taint",
"base_name":"Object",
"kind":"METHOD"
},
{
"name":"methods",
"qualified_name":"Object#methods",
"base_name":"Object",
"kind":"METHOD"
}
]
}
</code></pre>
<p>Here is a working curl example:</p>
<pre class="line-numbers language-bash"><code class="language-bash">
curl -XPOST -H "Content-Type: application/json" \
-d '{"command": "code_completion", "project": "~/code/rsense/rsense-server/spec/fixtures/test_gem", "file": "~/code/rsense/rsense-server/spec/fixtures/test_gem/lib/sample.rb", "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", "location": { "row": 18, "column": 7 }}' \
http://localhost:47367
</code></pre>
<p>Rsense currently only does completions at callsites, or points in the code where you would type '.' or '::'. Bear that in mind when designing an editor plugin.</p>
<p>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:</p>
<pre class="line-numbers language-bash"><code class="language-bash">
_rsense_commandline.rb --project=/home/projects/myproject --filepath=/home/projects/myproject/lib/test_case.rb --text='class TestCase
def junk
"Hello"
end
end
tt = TestCase.new
tt.
' --location='7:3'
</code></pre>
<h2 id="contributing">Contributing</h2>
<p>Contributions can only be accepted if they include tests.</p>
<ol>
<li>Fork it ( <a href="https://github.com/[my-github-username]/rsense/fork">https://github.com/[my-github-username]/rsense/fork</a> )</li>
<li>Create your feature branch (<code>git checkout -b my-new-feature</code>)</li>
<li>Commit your changes (<code>git commit -am 'Add some feature'</code>)</li>
<li>Push to the branch (<code>git push origin my-new-feature</code>)</li>
<li>Create a new Pull Request</li>
</ol>
<h2 id="license">License</h2>
<p>RSense is distributed under the term of
<a href="http://gplv3.fsf.org/">GPLv3+</a>.</p>
<h2 id="credits">Credits</h2>
<p>Rsense was originally designed and implemented by <a href="https://github.com/m2ym/">Matsuyama Tomohiro(@m2ym)</a>, and his hard work is still at the core of rsense today. All of the algorithms for type-detection were implemented by him, with inspiration from multiple places. You can read about his original version at <a href="http://cx4a.org/software/rsense/">Rsense: A Ruby Development tools for Emacs, Vim and Others</a></p>
<p>In 2013, a major undertaking by @edubkendo to bring it current and improve its usefulness to rubyists was sponsored by the @jruby organization as a Google Summer of Code project.</p>
<p>Special thanks belongs to <a href="https://github.com/enebo">Tom Enebo (@enebo)</a> who provided excellent mentorship, code, architectural suggestions and more throughout the course of the update.</p>
<h2 id="community">Community</h2>
<p><a href="https://gitter.im/rsense/rsense"><img src="https://badges.gitter.im/rsense/rsense.png" alt="Gitter chat"></a></p>
<p><a href="https://waffle.io/rsense/rsense"><img src="https://badge.waffle.io/rsense/rsense.png?label=ready&title=Ready" alt="Stories in Ready"></a></p>
<p><a href="https://github.com/rsense/rsense">Github</a></p>
</div>
</div>
</body>
</html>