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 CHANGED
@@ -1,30 +1,32 @@
1
- # Xray
1
+ Xray
2
+ ====
2
3
 
3
- ### Reveal the structure of your UI.
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
- ### Current Support
12
+ ## Current Support
12
13
 
13
- Xray is in early stages and currently supports only Rails 3.1+ with use of the asset pipeline as a requirement.
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
- ### Installation
21
+ ## Installation
21
22
 
22
- Add to your Gemfile, preferably under your development group:
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, open your browser, and press `cmd+ctrl+x` to see the overlay.
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
- ### Configuration
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
- ### How this works
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
- ### Contributing
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
- Xray.ViewSpecimen.add @el, info
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
@@ -1,3 +1,3 @@
1
1
  module Xray
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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-01 00:00:00.000000000 Z
12
+ date: 2013-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails