xray-rails 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +28 -14
- data/app/assets/javascripts/xray-backbone.js.coffee +2 -2
- data/lib/xray/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,30 +1,32 @@
|
|
1
|
-
|
1
|
+
Xray
|
2
|
+
====
|
2
3
|
|
3
|
-
### Reveal
|
4
|
+
### Reveal your UI's bones
|
4
5
|
|
5
6
|
The dev tools available to web developers in modern browsers are great. Many of us can't remember what life was like before "Inspect Element". But what we see in the compiled output sent to our browser is often the wrong level of detail - what about being able to visualize the higher level components of your UI? Controllers, templates, partials, Backbone views, etc.
|
6
7
|
|
7
|
-
Xray is the missing link between the browser and your app code. Press **cmd+ctrl+x** to reveal an overlay of what files are powering your UI - click anything to open the associated file in your editor.
|
8
|
+
Xray is the missing link between the browser and your app code. Press **cmd+ctrl+x** to reveal an overlay of what files are powering your UI - click anything to open the associated file in your editor. [Here's a GIF](http://f.cl.ly/items/1A0o3y1y3Q13103V3F1l/xray-rails-large.gif) of Xray in action.
|
8
9
|
|
9
10
|
![Screenshot](http://dl.dropbox.com/u/156655/Screenshots/xgf7ukh3fya-.png)
|
10
11
|
|
11
|
-
|
12
|
+
## Current Support
|
12
13
|
|
13
|
-
Xray is
|
14
|
+
Xray is intended to be run on Rails 3.1+ and Ruby 1.9.
|
14
15
|
|
15
16
|
So far, Xray can reveal:
|
16
17
|
|
17
18
|
* Rails views and partials
|
18
|
-
* Backbone View instances
|
19
|
+
* Backbone View instances if using the asset pipeline
|
19
20
|
|
20
|
-
|
21
|
+
## Installation
|
21
22
|
|
22
|
-
|
23
|
+
Xray depends on **jQuery**, so it will need to be included in your layout. Backbone is optional.
|
24
|
+
|
25
|
+
Xray should only be present during development. Add it to your Gemfile like so:
|
23
26
|
|
24
27
|
```ruby
|
25
28
|
group :development do
|
26
|
-
|
27
|
-
gem 'xray-rails', github: 'brentd/xray-rails'
|
29
|
+
gem 'xray-rails'
|
28
30
|
end
|
29
31
|
```
|
30
32
|
|
@@ -34,9 +36,21 @@ Then bundle and delete your cached assets:
|
|
34
36
|
$ bundle && rm -rf tmp/cache/assets
|
35
37
|
```
|
36
38
|
|
37
|
-
Restart your app,
|
39
|
+
Restart your app, visit it in your browser, and press `cmd+ctrl+x` to see the overlay.
|
40
|
+
|
41
|
+
**Note:** for Xray to insert itself into your views automatically, `config.assets.debug = true` (the default) must be set in development.rb. If you disabled this because of slow assets in Rails 3.2.13, [try this monkey patch instead](http://stackoverflow.com/a/15520932/24848) in an initializer.
|
42
|
+
|
43
|
+
Otherwise, you can insert Xray's scripts yourself, for example like so in application.js:
|
44
|
+
|
45
|
+
```js
|
46
|
+
//= require jquery
|
47
|
+
//= require xray
|
48
|
+
...
|
49
|
+
//= require backbone
|
50
|
+
//= require xray-backbone
|
51
|
+
```
|
38
52
|
|
39
|
-
|
53
|
+
## Configuration
|
40
54
|
|
41
55
|
By default, Xray will open files with Sublime Text, looking for `/usr/local/bin/subl`.
|
42
56
|
|
@@ -54,14 +68,14 @@ Or for something more complex, use the `$file` placeholder.
|
|
54
68
|
:editor: "/usr/local/bin/tmux split-window -v '/usr/local/bin/vim $file'"
|
55
69
|
```
|
56
70
|
|
57
|
-
|
71
|
+
## How this works
|
58
72
|
|
59
73
|
* During asset compilation, JS files and templates are modified to contain file path information.
|
60
74
|
* A middleware inserts `xray.js`, `xray.css`, and the Xray bar into all successful HTML response bodies.
|
61
75
|
* When the overlay is shown, `xray.js` examines the file path information inserted during asset compilation.
|
62
76
|
* Another middleware piggybacks the Rails server to respond to requests to open file paths with the user's desired editor.
|
63
77
|
|
64
|
-
|
78
|
+
## Contributing
|
65
79
|
|
66
80
|
If you have an idea, open an issue and let's talk about it, or fork away and send a pull request.
|
67
81
|
|
@@ -9,8 +9,8 @@ return unless window.Backbone && window.Xray
|
|
9
9
|
_ensureElement = Backbone.View::_ensureElement
|
10
10
|
Backbone.View::_ensureElement = ->
|
11
11
|
_.defer =>
|
12
|
-
info = Xray.constructorInfo @constructor
|
13
|
-
|
12
|
+
if info = Xray.constructorInfo @constructor
|
13
|
+
Xray.ViewSpecimen.add @el, info
|
14
14
|
_ensureElement.apply(this, arguments)
|
15
15
|
|
16
16
|
# Cleanup when view is removed.
|
data/lib/xray/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xray-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|