xray-rails 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -6
- data/lib/xray/middleware.rb +5 -2
- data/lib/xray/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -3,26 +3,27 @@ Xray
|
|
3
3
|
|
4
4
|
### Reveal your UI's bones
|
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
|
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 visualizing the higher level components of your UI? Controllers, templates, partials, Backbone views, etc.
|
7
7
|
|
8
|
-
Xray is the missing link between the browser and your app code. Press **cmd+shift+x** (Mac) or **ctrl+shift+x** to reveal an overlay of
|
8
|
+
Xray is the missing link between the browser and your app code. Press **cmd+shift+x** (Mac) or **ctrl+shift+x** to reveal an overlay of the files that rendered your UI, and click anything to open the file in your editor. [See Xray in action](http://f.cl.ly/items/1A0o3y1y3Q13103V3F1l/xray-rails-large.gif).
|
9
9
|
|
10
10
|
![Screenshot](https://dl.dropboxusercontent.com/u/156655/xray-screenshot.png)
|
11
11
|
|
12
12
|
## Current Support
|
13
13
|
|
14
|
-
Xray is intended
|
14
|
+
Xray is intended for Rails 3.1+ and Ruby 1.9.
|
15
15
|
|
16
16
|
So far, Xray can reveal:
|
17
17
|
|
18
18
|
* Rails views and partials
|
19
19
|
* Backbone View instances if using the asset pipeline
|
20
|
+
* Javascript templates if using the asset pipeline with the .jst extension
|
20
21
|
|
21
22
|
## Installation
|
22
23
|
|
23
|
-
Xray depends on **jQuery
|
24
|
+
Xray depends on **jQuery**. Backbone is optional.
|
24
25
|
|
25
|
-
This gem should only be present during development. Add it to your Gemfile
|
26
|
+
This gem should only be present during development. Add it to your Gemfile:
|
26
27
|
|
27
28
|
```ruby
|
28
29
|
group :development do
|
@@ -38,7 +39,9 @@ $ bundle && rm -rf tmp/cache/assets
|
|
38
39
|
|
39
40
|
Restart your app, visit it in your browser, and press **cmd+shift+x** (Mac) or **ctrl+shift+x** to reveal the overlay.
|
40
41
|
|
41
|
-
|
42
|
+
#### Note about `config.assets.debug`
|
43
|
+
|
44
|
+
For Xray to insert itself into your views automatically, `config.assets.debug = true` (Rails' 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
45
|
|
43
46
|
Otherwise, you can insert Xray's scripts yourself, for example like so in application.js:
|
44
47
|
|
@@ -50,6 +53,8 @@ Otherwise, you can insert Xray's scripts yourself, for example like so in applic
|
|
50
53
|
//= require xray-backbone
|
51
54
|
```
|
52
55
|
|
56
|
+
Backbone support via `xray-backbone` is optional.
|
57
|
+
|
53
58
|
## Configuration
|
54
59
|
|
55
60
|
By default, Xray will open files with Sublime Text, looking for `/usr/local/bin/subl`.
|
data/lib/xray/middleware.rb
CHANGED
@@ -37,8 +37,11 @@ module Xray
|
|
37
37
|
status, headers, response = @app.call(env)
|
38
38
|
if should_inject_xray?(status, headers, response)
|
39
39
|
body = response.body.sub(/<body[^>]*>/) { "#{$~}\n#{xray_bar}" }
|
40
|
-
|
41
|
-
|
40
|
+
# Inject js script tags if assets are unbundled
|
41
|
+
if Rails.application.config.assets.debug
|
42
|
+
append_js!(body, 'jquery', :xray)
|
43
|
+
append_js!(body, 'backbone', :'xray-backbone')
|
44
|
+
end
|
42
45
|
headers['Content-Length'] = body.bytesize.to_s
|
43
46
|
end
|
44
47
|
[status, headers, (body ? [body] : response)]
|
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.4
|
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-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.
|
21
|
+
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.
|
29
|
+
version: 3.1.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: coffee-rails
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|