rails-footnotes 3.7.1.pre → 3.7.1
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/.gitignore +1 -0
- data/{README → README.rdoc} +23 -47
- data/lib/rails-footnotes/version.rb +1 -1
- data/rails-footnotes.gemspec +0 -1
- data/test/footnotes_test.rb +18 -3
- data/test/test_helper.rb +3 -2
- metadata +9 -20
data/.gitignore
CHANGED
data/{README → README.rdoc}
RENAMED
@@ -1,13 +1,4 @@
|
|
1
|
-
Rails Footnotes
|
2
|
-
License: MIT
|
3
|
-
Version: 3.7.0
|
4
|
-
|
5
|
-
You can also read this README in pretty html at the GitHub project Wiki page
|
6
|
-
|
7
|
-
http://wiki.github.com/josevalim/rails-footnotes
|
8
|
-
|
9
|
-
Description
|
10
|
-
-----------
|
1
|
+
= Rails Footnotes
|
11
2
|
|
12
3
|
If you are developing in Rails you should know the plugin! It displays
|
13
4
|
footnotes in your application for easy debugging, such as sessions,
|
@@ -16,28 +7,25 @@ request parameters, cookies, filter chain, routes, queries, etc.
|
|
16
7
|
Even more, it contains links to open files directly in your editor including
|
17
8
|
your backtrace lines.
|
18
9
|
|
10
|
+
== Installation
|
19
11
|
|
20
|
-
|
21
|
-
------------
|
22
|
-
|
23
|
-
Since this branch aims Rails 3 support, if you want to use it with Rails 2.3 you should check this branch:
|
12
|
+
NOTE: Since this branch aims Rails 3 support, if you want to use it with Rails 2.3 you should check this branch:
|
24
13
|
|
25
|
-
|
14
|
+
https://github.com/josevalim/rails-footnotes/tree/rails2
|
26
15
|
|
27
16
|
Install Rails Footnotes is very easy.
|
28
17
|
|
29
|
-
Rails
|
18
|
+
=== Rails 3.x
|
30
19
|
|
31
|
-
|
20
|
+
gem 'rails-footnotes', '>= 3.7', :group => :development
|
32
21
|
|
33
|
-
|
22
|
+
=== Rails 2.x
|
34
23
|
|
35
|
-
|
24
|
+
In RAILS_ROOT/config/environments/development.rb (yes, you want it only in development):
|
36
25
|
|
37
|
-
|
26
|
+
gem "rails-footnotes", '< 3.7.0', :group => :development
|
38
27
|
|
39
|
-
Configuration
|
40
|
-
-------------
|
28
|
+
== Configuration
|
41
29
|
|
42
30
|
For version greater then 3.7.0
|
43
31
|
|
@@ -50,8 +38,7 @@ add something like this to config/initializers/footnotes.rb:
|
|
50
38
|
# ... other init code
|
51
39
|
end
|
52
40
|
|
53
|
-
Hooks
|
54
|
-
-------------
|
41
|
+
=== Hooks
|
55
42
|
|
56
43
|
Footnotes.setup do |config|
|
57
44
|
config.before {|controller, filter| filter.notes = controller.class.name =~ /Message/ && \
|
@@ -63,7 +50,7 @@ Hooks
|
|
63
50
|
If you are not using Textmate as text editor, in your environment.rb or
|
64
51
|
in an initializer do:
|
65
52
|
|
66
|
-
|
53
|
+
Footnotes::Filter.prefix = 'mvim://open?url=file://%s&line=%d&column=%d'
|
67
54
|
|
68
55
|
for MacVim
|
69
56
|
|
@@ -75,31 +62,27 @@ By default, footnotes are appended at the end of the page with default styleshee
|
|
75
62
|
to change their position, you can define a div with id "footnotes_holder" or define your own stylesheet
|
76
63
|
by turning footnotes stylesheet off:
|
77
64
|
|
78
|
-
|
65
|
+
Footnotes::Filter.no_style = true
|
79
66
|
|
80
67
|
Another option is to allow multiple notes to be opened at the same time:
|
81
68
|
|
82
|
-
|
69
|
+
Footnotes::Filter.multiple_notes = true
|
83
70
|
|
84
71
|
If you have New Relic RPM installed, you may want to turn off query explains
|
85
72
|
(explains can slows things down)
|
86
73
|
|
87
|
-
|
74
|
+
Footnotes::Notes::QueriesNote.sql_explain = false
|
88
75
|
|
89
76
|
Finally, you can control which notes you want to show. The default are:
|
90
77
|
|
91
|
-
|
78
|
+
Footnotes::Filter.notes = [:session, :cookies, :params, :filters, :routes, :env, :queries, :log, :general]
|
92
79
|
|
93
|
-
|
94
|
-
Creating your own notes
|
95
|
-
-----------------------
|
80
|
+
== Creating your own notes
|
96
81
|
|
97
82
|
Create your notes to integrate with Footnotes is easy.
|
98
83
|
|
99
84
|
1. Create a Footnotes::Notes::YourExampleNote class
|
100
|
-
|
101
85
|
2. Implement the necessary methods (check abstract_note.rb file in lib/notes)
|
102
|
-
|
103
86
|
3. Append your example note in Footnotes::Filter.notes array (usually at the end of your environment file or in an initializer):
|
104
87
|
|
105
88
|
For example, to create a note that shows info about the user logged in your application you just have to do:
|
@@ -139,35 +122,28 @@ Then put in your environment:
|
|
139
122
|
|
140
123
|
Footnotes::Filter.notes += [:current_user]
|
141
124
|
|
142
|
-
|
143
|
-
Colaborators
|
144
|
-
------------
|
125
|
+
== Colaborators
|
145
126
|
|
146
127
|
* Leon Li - http://github.com/scorpio
|
147
128
|
* Keenan Brock - http://github.com/kbrock
|
148
129
|
* Ivan Storck - http://github.com/ivanoats
|
149
130
|
* Kris Chamber - http://github.com/kristopher
|
150
131
|
|
151
|
-
|
152
|
-
Bugs and Feedback
|
153
|
-
-----------------
|
132
|
+
== Bugs and Feedback
|
154
133
|
|
155
134
|
If you discover any bugs, please send an e-mail to keenan@thebrocks.net
|
156
135
|
If you just want to give some positive feedback or drop a line, that's fine too!
|
157
136
|
|
158
|
-
|
159
|
-
Version 3.x
|
160
|
-
-----------
|
137
|
+
=== Version 3.x
|
161
138
|
|
162
139
|
This plugin was maintained until version 3.6 by José Valim
|
163
140
|
|
164
141
|
Copyright (c) 2009 José Valim (jose@plataformatec.com.br)
|
165
|
-
http://blog.plataformatec.com.br
|
142
|
+
http://blog.plataformatec.com.br
|
166
143
|
|
167
|
-
Version 2.0
|
168
|
-
-----------
|
144
|
+
=== Version 2.0
|
169
145
|
|
170
146
|
This plugin was created and maintained until version 2.0 by Duane Johnson:
|
171
147
|
|
172
148
|
Copyright (c) 2006 InquiryLabs, Inc.
|
173
|
-
http://blog.inquirylabs.com
|
149
|
+
http://blog.inquirylabs.com
|
data/rails-footnotes.gemspec
CHANGED
data/test/footnotes_test.rb
CHANGED
@@ -10,6 +10,10 @@ module Footnotes::Notes
|
|
10
10
|
def self.to_sym; :test; end
|
11
11
|
def valid?; true; end
|
12
12
|
end
|
13
|
+
|
14
|
+
class NoteXNote < TestNote; end
|
15
|
+
class NoteYNote < TestNote; end
|
16
|
+
class NoteZNote < TestNote; end
|
13
17
|
end
|
14
18
|
|
15
19
|
class FootnotesTest < Test::Unit::TestCase
|
@@ -30,7 +34,7 @@ class FootnotesTest < Test::Unit::TestCase
|
|
30
34
|
index = @controller.response.body.index(/This is the HTML page/)
|
31
35
|
assert_equal 334, index
|
32
36
|
end
|
33
|
-
|
37
|
+
|
34
38
|
def test_foonotes_included
|
35
39
|
footnotes_perform!
|
36
40
|
assert_not_equal $html, @controller.response.body
|
@@ -167,7 +171,18 @@ class FootnotesTest < Test::Unit::TestCase
|
|
167
171
|
after = " Notes</body>"
|
168
172
|
assert_equal after, @controller.response.body.split("\n")[12]
|
169
173
|
end
|
170
|
-
|
174
|
+
|
175
|
+
def test_hooks
|
176
|
+
Footnotes::Filter.notes = [:note_x, :note_y, :note_z]
|
177
|
+
Footnotes.setup {|config| config.before {|controller, filter| filter.notes -= [:note_y] }}
|
178
|
+
Footnotes::Filter.start!(@controller)
|
179
|
+
assert_equal [:note_x, :note_z], Footnotes::Filter.notes
|
180
|
+
|
181
|
+
Footnotes.setup {|config| config.after {|controller, filter| filter.notes -= [:note_y] }}
|
182
|
+
@footnotes.close!(@controller)
|
183
|
+
assert_equal [:note_x, :note_z], Footnotes::Filter.notes
|
184
|
+
end
|
185
|
+
|
171
186
|
protected
|
172
187
|
# First we make sure that footnotes will perform (long life to mocha!)
|
173
188
|
# Then we call add_footnotes!
|
@@ -204,4 +219,4 @@ $html = <<HTML
|
|
204
219
|
<p>You will be glad to know that no changes need to be made to any of your CSS files.</p>
|
205
220
|
</body>
|
206
221
|
</html>
|
207
|
-
HTML
|
222
|
+
HTML
|
data/test/test_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'test/unit'
|
2
1
|
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
3
|
require 'mocha'
|
4
4
|
|
5
5
|
ENV['RAILS_ENV'] = 'test'
|
@@ -7,4 +7,5 @@ ENV['RAILS_ENV'] = 'test'
|
|
7
7
|
require 'active_support'
|
8
8
|
require 'active_support/all' unless Class.respond_to?(:cattr_accessor)
|
9
9
|
require 'rails-footnotes/footnotes'
|
10
|
-
require 'rails-footnotes/notes/abstract_note'
|
10
|
+
require 'rails-footnotes/notes/abstract_note'
|
11
|
+
require "rails-footnotes"
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-footnotes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 3.7.1
|
4
|
+
prerelease:
|
5
|
+
version: 3.7.1
|
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-04-
|
13
|
+
date: 2011-04-25 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
type: :development
|
36
36
|
version_requirements: *id002
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
38
|
+
name: mocha
|
39
39
|
prerelease: false
|
40
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
@@ -45,28 +45,17 @@ dependencies:
|
|
45
45
|
version: "0"
|
46
46
|
type: :development
|
47
47
|
version_requirements: *id003
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: mocha
|
50
|
-
prerelease: false
|
51
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
|
-
requirements:
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: "0"
|
57
|
-
type: :development
|
58
|
-
version_requirements: *id004
|
59
48
|
- !ruby/object:Gem::Dependency
|
60
49
|
name: rails
|
61
50
|
prerelease: false
|
62
|
-
requirement: &
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
63
52
|
none: false
|
64
53
|
requirements:
|
65
54
|
- - ">="
|
66
55
|
- !ruby/object:Gem::Version
|
67
56
|
version: 3.0.0
|
68
57
|
type: :development
|
69
|
-
version_requirements: *
|
58
|
+
version_requirements: *id004
|
70
59
|
description: Every Rails page has footnotes that gives information about your application and links back to your editor.
|
71
60
|
email:
|
72
61
|
- keenan@thebrocks.net
|
@@ -82,7 +71,7 @@ files:
|
|
82
71
|
- Gemfile
|
83
72
|
- Gemfile.lock
|
84
73
|
- MIT-LICENSE
|
85
|
-
- README
|
74
|
+
- README.rdoc
|
86
75
|
- Rakefile
|
87
76
|
- lib/rails-footnotes.rb
|
88
77
|
- lib/rails-footnotes/backtracer.rb
|
@@ -128,9 +117,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
118
|
none: false
|
130
119
|
requirements:
|
131
|
-
- - "
|
120
|
+
- - ">="
|
132
121
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
122
|
+
version: "0"
|
134
123
|
requirements: []
|
135
124
|
|
136
125
|
rubyforge_project: rails-footnotes
|