rails_view_annotator 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -0
- data/Readme.md +27 -0
- data/lib/rails_view_annotator.rb +3 -0
- data/lib/rails_view_annotator/action_view/partial_renderer.rb +17 -0
- data/lib/rails_view_annotator/version.rb +3 -0
- data/rails_view_annotator.gemspec +19 -0
- metadata +9 -3
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/Readme.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Rails View Annotator
|
2
|
+
|
3
|
+
## Purpose
|
4
|
+
|
5
|
+
The Rails View Annotator simply wraps the rendering of Rails partials with html comments indicating the disk location of the rendered partial.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Simply add the gem to your Gemfile's development block.
|
10
|
+
|
11
|
+
````ruby
|
12
|
+
group :development
|
13
|
+
gem 'rails_view_annotator'
|
14
|
+
end
|
15
|
+
````
|
16
|
+
|
17
|
+
Now rendered content will have instructive comments.
|
18
|
+
|
19
|
+
````html
|
20
|
+
<!-- begin: app/views/user/_bio.html.haml -->
|
21
|
+
<div class='bio'>Ed's Bio</div>
|
22
|
+
<!-- end: app/views/user/_bio.html.haml -->
|
23
|
+
````
|
24
|
+
|
25
|
+
## License
|
26
|
+
|
27
|
+
WTFPL
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RailsViewAnnotator
|
2
|
+
def self.augment_partial_renderer klass
|
3
|
+
render = klass.instance_method :render
|
4
|
+
klass.send(:define_method, :render) do |*args|
|
5
|
+
inner = render.bind(self).call(*args)
|
6
|
+
short_identifier = Pathname.new(identifier).relative_path_from Rails.root
|
7
|
+
"<!-- begin: #{short_identifier} -->#{inner}<!-- end: #{short_identifier} -->".html_safe
|
8
|
+
end
|
9
|
+
klass.send(:include, InstanceMethods)
|
10
|
+
end
|
11
|
+
|
12
|
+
module InstanceMethods
|
13
|
+
def identifier
|
14
|
+
(@template = find_partial) ? @template.identifier : @path
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "rails_view_annotator/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "rails_view_annotator"
|
7
|
+
s.version = RailsViewAnnotator::VERSION
|
8
|
+
s.authors = ["Duncan Beevers"]
|
9
|
+
s.email = ["duncan@dweebd.com"]
|
10
|
+
s.homepage = "https://github.com/duncanbeevers/rails_view_annotator"
|
11
|
+
s.summary = "Annotate Rails partial output with source path information"
|
12
|
+
s.description = "The Rails View Annotator makes it easy to find out which partial generated which output"
|
13
|
+
|
14
|
+
s.rubyforge_project = "rails_view_annotator"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
end
|
19
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_view_annotator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.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: 2012-02-
|
12
|
+
date: 2012-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: The Rails View Annotator makes it easy to find out which partial generated
|
15
15
|
which output
|
@@ -18,7 +18,13 @@ email:
|
|
18
18
|
executables: []
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files: []
|
21
|
-
files:
|
21
|
+
files:
|
22
|
+
- Rakefile
|
23
|
+
- Readme.md
|
24
|
+
- lib/rails_view_annotator.rb
|
25
|
+
- lib/rails_view_annotator/action_view/partial_renderer.rb
|
26
|
+
- lib/rails_view_annotator/version.rb
|
27
|
+
- rails_view_annotator.gemspec
|
22
28
|
homepage: https://github.com/duncanbeevers/rails_view_annotator
|
23
29
|
licenses: []
|
24
30
|
post_install_message:
|