rails-footnotes 3.7.3 → 3.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rails-footnotes.rb +1 -0
- data/lib/rails-footnotes/backtracer.rb +32 -0
- data/lib/rails-footnotes/notes/javascripts_note.rb +2 -0
- data/lib/rails-footnotes/notes/partials_note.rb +2 -0
- data/lib/rails-footnotes/notes/stylesheets_note.rb +2 -0
- data/lib/rails-footnotes/version.rb +1 -1
- data/spec/notes/javascripts_note_spec.rb +6 -0
- data/spec/notes/partials_notes_spec.rb +6 -0
- data/spec/notes/stylesheets_note_spec.rb +6 -0
- data/spec/spec_helper.rb +4 -0
- metadata +9 -2
data/lib/rails-footnotes.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rails/backtrace_cleaner'
|
2
|
+
class Rails::BacktraceCleaner
|
3
|
+
def replace_filter(index, &block)
|
4
|
+
@filters[index] = block
|
5
|
+
end
|
6
|
+
|
7
|
+
def clean(backtrace, kind = :silent)
|
8
|
+
safe = super.map {|l| l.html_safe}
|
9
|
+
def safe.join(*args)
|
10
|
+
(joined = super).html_safe
|
11
|
+
end
|
12
|
+
safe
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
backtrace_cleaner = Rails.backtrace_cleaner
|
17
|
+
backtrace_cleaner.replace_filter(0) do |line|
|
18
|
+
if match = line.match(/^(.+):(\d+):in/) || match = line.match(/^(.+):(\d+)\s*$/)
|
19
|
+
file, line_number = match[1], match[2]
|
20
|
+
%[<a href="#{Footnotes::Filter.prefix(file, line_number, 1).html_safe}">#{line.sub("#{Rails.root.to_s}/",'').html_safe}</a>].html_safe
|
21
|
+
else
|
22
|
+
line
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
gems_paths = (Gem.path + [Gem.default_dir]).uniq.map!{ |p| Regexp.escape(p) }
|
27
|
+
unless gems_paths.empty?
|
28
|
+
gems_regexp = %r{\>#{gems_paths.join('|')}/gems/}
|
29
|
+
backtrace_cleaner.replace_filter(3) {|line| line.sub(gems_regexp, '>') }
|
30
|
+
end
|
31
|
+
backtrace_cleaner.remove_silencers!
|
32
|
+
backtrace_cleaner.add_silencer { |line| line !~ /\>\/?(app|config|lib|test)/ }
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rails-footnotes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 3.7.
|
5
|
+
version: 3.7.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Keenan Brock
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-26 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- Rakefile
|
78
78
|
- lib/rails-footnotes.rb
|
79
79
|
- lib/rails-footnotes/abstract_note.rb
|
80
|
+
- lib/rails-footnotes/backtracer.rb
|
80
81
|
- lib/rails-footnotes/footnotes.rb
|
81
82
|
- lib/rails-footnotes/notes/all.rb
|
82
83
|
- lib/rails-footnotes/notes/assigns_note.rb
|
@@ -100,6 +101,9 @@ files:
|
|
100
101
|
- rails-footnotes.gemspec
|
101
102
|
- spec/abstract_note_spec.rb
|
102
103
|
- spec/footnotes_spec.rb
|
104
|
+
- spec/notes/javascripts_note_spec.rb
|
105
|
+
- spec/notes/partials_notes_spec.rb
|
106
|
+
- spec/notes/stylesheets_note_spec.rb
|
103
107
|
- spec/spec_helper.rb
|
104
108
|
homepage: http://github.com/josevalim/rails-footnotes
|
105
109
|
licenses: []
|
@@ -131,4 +135,7 @@ summary: Every Rails page has footnotes that gives information about your applic
|
|
131
135
|
test_files:
|
132
136
|
- spec/abstract_note_spec.rb
|
133
137
|
- spec/footnotes_spec.rb
|
138
|
+
- spec/notes/javascripts_note_spec.rb
|
139
|
+
- spec/notes/partials_notes_spec.rb
|
140
|
+
- spec/notes/stylesheets_note_spec.rb
|
134
141
|
- spec/spec_helper.rb
|