rails_view_annotator 0.0.9 → 0.0.10
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
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b4b7a1b36f7c557619abe643dad7ff6e2216b908
|
4
|
+
data.tar.gz: 599945c6bd194c518348487f6446c7c71734dc91
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 75897cd3556fc195f4c9e6624ab84dcce46df3b25af9be3455fdb79603b0544402a05a60e980f869ddddbc04b5efdcfa14ac1f6c73f646c6b0e1f4b947b74dac
|
7
|
+
data.tar.gz: 1f7397d0699415dc8d633b01ebaf0da8c64233e12793dba28eb906414e9d28cd0656f0347c7b8da3f4454071af447daec06af965a605e16e87607adc0be6ff69
|
@@ -1,9 +1,17 @@
|
|
1
1
|
module RailsViewAnnotator
|
2
|
+
# Tells for which formats the partial has been requested.
|
3
|
+
def self.extract_requested_formats_from(render_arguments)
|
4
|
+
lookup_context = render_arguments[0].lookup_context
|
5
|
+
lookup_context.formats
|
6
|
+
end
|
7
|
+
|
2
8
|
def self.augment_partial_renderer klass
|
3
|
-
|
9
|
+
stock_render = klass.instance_method :render
|
4
10
|
klass.send(:define_method, :render) do |*args|
|
5
|
-
inner =
|
11
|
+
inner = stock_render.bind(self).call(*args)
|
12
|
+
|
6
13
|
return unless identifier
|
14
|
+
|
7
15
|
short_identifier = Pathname.new(identifier).relative_path_from Rails.root
|
8
16
|
|
9
17
|
r = /^#{Regexp.escape(Rails.root.to_s)}\/([^:]+:\d+)/
|
@@ -12,11 +20,12 @@ module RailsViewAnnotator
|
|
12
20
|
|
13
21
|
descriptor = "#{short_identifier} (from #{called_from})"
|
14
22
|
|
15
|
-
if
|
23
|
+
if inner.present?
|
16
24
|
comment_pattern = "%{partial}"
|
17
|
-
|
18
|
-
template_formats
|
19
|
-
|
25
|
+
template_formats = RailsViewAnnotator.extract_requested_formats_from(args)
|
26
|
+
if template_formats.include?(:text) # Do not render any comments for raw plaintext repsonses
|
27
|
+
return inner
|
28
|
+
elsif template_formats.include?(:js)
|
20
29
|
comment_pattern = "/* begin: %{comment} */\n#{comment_pattern}/* end: %{comment} */"
|
21
30
|
elsif template_formats.empty? || template_formats.include?(:html)
|
22
31
|
comment_pattern = "<!-- begin: %{comment} -->\n#{comment_pattern}<!-- end: %{comment} -->"
|
metadata
CHANGED
@@ -1,23 +1,27 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_view_annotator
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Duncan Beevers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
11
|
+
|
12
|
+
date: 2014-09-26 00:00:00 Z
|
12
13
|
dependencies: []
|
13
|
-
|
14
|
-
|
15
|
-
email:
|
14
|
+
|
15
|
+
description: The Rails View Annotator makes it easy to find out which partial generated which output
|
16
|
+
email:
|
16
17
|
- duncan@dweebd.com
|
17
18
|
executables: []
|
19
|
+
|
18
20
|
extensions: []
|
21
|
+
|
19
22
|
extra_rdoc_files: []
|
20
|
-
|
23
|
+
|
24
|
+
files:
|
21
25
|
- Rakefile
|
22
26
|
- Readme.md
|
23
27
|
- lib/rails_view_annotator.rb
|
@@ -26,25 +30,29 @@ files:
|
|
26
30
|
- rails_view_annotator.gemspec
|
27
31
|
homepage: https://github.com/duncanbeevers/rails_view_annotator
|
28
32
|
licenses: []
|
33
|
+
|
29
34
|
metadata: {}
|
35
|
+
|
30
36
|
post_install_message:
|
31
37
|
rdoc_options: []
|
32
|
-
|
38
|
+
|
39
|
+
require_paths:
|
33
40
|
- lib
|
34
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
-
requirements:
|
36
|
-
-
|
37
|
-
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
version: '0'
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- &id001
|
44
|
+
- ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- *id001
|
44
50
|
requirements: []
|
51
|
+
|
45
52
|
rubyforge_project: rails_view_annotator
|
46
|
-
rubygems_version: 2.
|
53
|
+
rubygems_version: 2.2.2
|
47
54
|
signing_key:
|
48
55
|
specification_version: 4
|
49
56
|
summary: Annotate Rails partial output with source path information
|
50
57
|
test_files: []
|
58
|
+
|