xray-rails 0.3.1 → 0.3.3

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
- SHA1:
3
- metadata.gz: 6a5e69196ed74df3334802769fff5046e12acba7
4
- data.tar.gz: 5cc5f2071615a6daa2a4886ec5e7f9b6f0b54721
2
+ SHA256:
3
+ metadata.gz: fddfb999d09d721a49e7cb63a2630c6e44df2ab05500f724edcc43d2f2e2fe8c
4
+ data.tar.gz: 0b94f6788077aff52eb33da34b6e8c69ec7d83de9c5e8938c77dfcbab62f08f8
5
5
  SHA512:
6
- metadata.gz: 8f1474f2f3fbcc840abf274d3381b2dd43ffc8d51879e29797b10e45277aa4d530878b6d45fb4e134aa4b391e633372cc8ee3285b909cde8cf6c293e71fa4a6a
7
- data.tar.gz: f96aa8246c8509b4a5a88f6ebb628bd03804760c604de52a735d2ceaa0636a6beed6a1eefeaae85ade28a96177a1f83a6d1ba4580d7ae7993f2a6b51f24bab92
6
+ metadata.gz: e8aecb78e16ec95b457b48c59e4958da87ef025f8bd7f0a566f999348f2d744499222aca605a4c0c4c4ba89f355f7ab88b753d6b4f76ad39a4b8ab87881a29b2
7
+ data.tar.gz: d9cd337ff33da6228337dd91a90a5c165642b78444d54d8f6cc17be9a41e5a108a6acad0854311ef03991a4ba8da399fa1ff9daba1157cd151755542f75d06c3
data/README.md CHANGED
@@ -8,9 +8,9 @@ Xray-rails
8
8
 
9
9
  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, view templates, partials, JS templates, etc.
10
10
 
11
- 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).
11
+ Xray is the missing link between the browser and your app code. Press **command+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.
12
12
 
13
- ![Screenshot](https://dl.dropboxusercontent.com/u/156655/xray-screenshot.png)
13
+ ![Screenshot](example/screenshot.png)
14
14
 
15
15
  ## Current Support
16
16
 
@@ -39,7 +39,7 @@ Then bundle and delete your cached assets:
39
39
  $ bundle && rm -rf tmp/cache/assets
40
40
  ```
41
41
 
42
- Restart your app, visit it in your browser, and press **cmd+shift+x** (Mac) or **ctrl+shift+x** to reveal the overlay.
42
+ Restart your app, visit it in your browser, and press **command+shift+x** (Mac) or **ctrl+shift+x** to reveal the overlay.
43
43
 
44
44
  #### Note about `config.assets.debug`
45
45
 
@@ -77,14 +77,18 @@ For something more complex, use the `$file` placeholder.
77
77
  * A middleware inserts `xray.js`, `xray.css`, and the Xray bar into all successful HTML response bodies.
78
78
  * When the overlay is shown, `xray.js` examines the inserted filepath info to build the overlay.
79
79
 
80
- ## Disabling Xray in particular templates
80
+ ## Disabling Xray
81
81
 
82
- Xray augments HTML templates by wrapping their contents with HTML comments. For some environments such as [Angular.js](http://angularjs.org/), this can cause Angular templates to stop working because Angular expects only one root node in the template HTML. You can pass in the option `xray: false` to any render statements to ensure Xray does not augment that template. Example:
82
+ Xray augments HTML templates by wrapping their contents with HTML comments. For some environments such as [Angular.js](http://angularjs.org/), this can cause Angular templates to stop working because Angular expects only one root node in the template HTML. You can pass in the option `xray: false` to any partial render statements to ensure Xray does not augment that partial. Example:
83
83
 
84
84
  ```ruby
85
- render 'show', xray: false
85
+ render partial: 'my_partial', locals: { xray: false }
86
86
  ```
87
87
 
88
+ Note that this disables Xray's HTML comment wrappers for `my_partial`, but not any sub-partials rendered within that template, if any. You must pass `xray: false` to each `render` call where you want Xray disabled.
89
+
90
+ Currently there is no way to disable Xray entirely for a given request. If this feature is important to you, please leave a comment on [issue #75](https://github.com/brentd/xray-rails/issues/75). PRs are appreciated!
91
+
88
92
  ## Contributing
89
93
 
90
94
  If you have an idea, open an issue and let's talk about it, or fork away and send a pull request.
data/lib/xray/config.rb CHANGED
@@ -5,8 +5,6 @@ module Xray
5
5
  end
6
6
 
7
7
  class Config
8
- attr_accessor :editor
9
-
10
8
  CONFIG_FILE = ".xrayconfig"
11
9
 
12
10
  def default_editor
@@ -34,7 +32,7 @@ module Xray
34
32
  end
35
33
 
36
34
  def config_file
37
- if File.exists?("#{Dir.pwd}/#{CONFIG_FILE}")
35
+ if File.exist?("#{Dir.pwd}/#{CONFIG_FILE}")
38
36
  "#{Dir.pwd}/#{CONFIG_FILE}"
39
37
  else
40
38
  "#{Dir.home}/#{CONFIG_FILE}"
data/lib/xray/engine.rb CHANGED
@@ -21,10 +21,10 @@ module Xray
21
21
  ActionView::Template.class_eval do
22
22
  extend Xray::Aliasing
23
23
 
24
- def render_with_xray(*args, &block)
24
+ def render_with_xray(*args, **kwargs, &block)
25
25
  path = identifier
26
26
  view = args.first
27
- source = render_without_xray(*args, &block)
27
+ source = render_without_xray(*args, **kwargs, &block)
28
28
 
29
29
  suitable_template = !(view.respond_to?(:mailer) && view.mailer) &&
30
30
  !path.include?('_xray_bar') &&
@@ -33,7 +33,7 @@ module Xray
33
33
 
34
34
  options = args.last.kind_of?(Hash) ? args.last : {}
35
35
 
36
- if suitable_template && !(options.has_key?(:xray) && (options[:xray] == false))
36
+ if source && suitable_template && !(options.has_key?(:xray) && (options[:xray] == false))
37
37
  Xray.augment_template(source, path)
38
38
  else
39
39
  source
@@ -55,7 +55,7 @@ module Xray
55
55
  end
56
56
 
57
57
  def self.run(filename, source, context)
58
- path = context.pathname.to_s
58
+ path = Pathname.new(context.filename).to_s
59
59
  if path =~ /^#{Rails.root}.+\.(jst)(\.|$)/
60
60
  Xray.augment_template(source, path)
61
61
  else
@@ -16,7 +16,7 @@ module Xray
16
16
  # Request for opening a file path.
17
17
  if env['PATH_INFO'] == OPEN_PATH
18
18
  req, res = Rack::Request.new(env), Rack::Response.new
19
- out, err, status = Xray.open_file(req.GET['path'])
19
+ out, _err, status = Xray.open_file(req.GET['path'])
20
20
  if status.success?
21
21
  res.status = 200
22
22
  else
data/lib/xray/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xray
2
- VERSION = "0.3.1".freeze
2
+ VERSION = "0.3.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xray-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brent Dillingham
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2024-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -118,7 +118,7 @@ homepage: https://github.com/brentd/xray-rails
118
118
  licenses:
119
119
  - MIT
120
120
  metadata: {}
121
- post_install_message:
121
+ post_install_message:
122
122
  rdoc_options: []
123
123
  require_paths:
124
124
  - lib
@@ -133,9 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  requirements: []
136
- rubyforge_project:
137
- rubygems_version: 2.6.12
138
- signing_key:
136
+ rubygems_version: 3.5.21
137
+ signing_key:
139
138
  specification_version: 4
140
139
  summary: Reveal the structure of your UI
141
140
  test_files: []