rails-footnotes 3.6.3 → 3.6.4

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- Copyright (c) 2006 Coda Hale
2
- Copyright (c) 2008 José Valim (jose.valim at gmail dot com)
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining
5
- a copy of this software and associated documentation files (the
6
- "Software"), to deal in the Software without restriction, including
7
- without limitation the rights to use, copy, modify, merge, publish,
8
- distribute, sublicense, and/or sell copies of the Software, and to
9
- permit persons to whom the Software is furnished to do so, subject to
10
- the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2006 Coda Hale
2
+ Copyright (c) 2008 José Valim (jose.valim at gmail dot com)
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README CHANGED
@@ -1,141 +1,140 @@
1
- Rails Footnotes
2
- License: MIT
3
- Version: 3.6.3
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
-
10
- Description
11
- -----------
12
-
13
- If you are developing in Rails you should know the plugin! It displays
14
- footnotes in your application for easy debugging, such as sessions,
15
- request parameters, cookies, filter chain, routes, queries, etc.
16
-
17
- Even more, it contains links to open files directly in your editor including
18
- your backtrace lines.
19
-
20
-
21
- Installation
22
- ------------
23
-
24
- Install Rails Footnotes is very easy. If you are running on Rails 2.3 just run
25
- the following:
26
-
27
- gem sources -a http://gemcutter.org
28
- sudo gem install rails-footnotes
29
-
30
- In RAILS_ROOT/config/environments/development.rb (yes, you want it only in development):
31
-
32
- config.gem "rails-footnotes", :source => "http://gemcutter.org"
33
-
34
- If you want it as plugin, just do:
35
-
36
- script/plugin install git://github.com/josevalim/rails-footnotes.git
37
-
38
- Configuration
39
- -------------
40
-
41
- If you are not using Textmate as text editor, in your environment.rb or
42
- in an initializer do:
43
-
44
- if defined?(Footnotes)
45
- Footnotes::Filter.prefix = 'txmt://open?url=file://%s&line=%d&column=%d'
46
- end
47
-
48
- Where you are going to choose a prefix compatible with your text editor. The %s is
49
- replaced by the name of the file, the first %d is replaced by the line number and
50
- the second %d is replaced by the column.
51
-
52
- By default, footnotes are appended at the end of the page with default stylesheet. If you want
53
- to change their position, you can define a div with id "footnotes_holder" or define your own stylesheet
54
- by turning footnotes stylesheet off:
55
-
56
- Footnotes::Filter.no_style = true
57
-
58
- Another option is to allow multiple notes to be opened at the same time:
59
-
60
- Footnotes::Filter.multiple_notes = true
61
-
62
- Finally, you can control which notes you want to show. The default are:
63
-
64
- Footnotes::Filter.notes = [:session, :cookies, :params, :filters, :routes, :env, :queries, :log, :general]
65
-
66
-
67
- Creating your own notes
68
- -----------------------
69
-
70
- Create your notes to integrate with Footnotes is easy.
71
-
72
- 1. Create a Footnotes::Notes::YourExampleNote class
73
-
74
- 2. Implement the necessary methods (check abstract_note.rb file in lib/notes)
75
-
76
- 3. Append your example note in Footnotes::Filter.notes array (usually at the end of your environment file or in an initializer):
77
-
78
- For example, to create a note that shows info about the user logged in your application you just have to do:
79
-
80
- module Footnotes
81
- module Notes
82
- class CurrentUserNote < AbstractNote
83
- # This method always receives a controller
84
- #
85
- def initialize(controller)
86
- @current_user = controller.instance_variable_get("@current_user")
87
- end
88
-
89
- # The name that will appear as legend in fieldsets
90
- #
91
- def legend
92
- "Current user: #{@current_user.name}"
93
- end
94
-
95
- # This Note is only valid if we actually found an user
96
- # If it's not valid, it won't be displayed
97
- #
98
- def valid?
99
- @current_user
100
- end
101
-
102
- # The fieldset content
103
- #
104
- def content
105
- escape(@current_user.inspect)
106
- end
107
- end
108
- end
109
- end
110
-
111
- Then put in your environment:
112
-
113
- Footnotes::Filter.notes += [:current_user]
114
-
115
-
116
- Colaborators
117
- ------------
118
-
119
- * Leon Li - http://github.com/scorpio
120
- * Keenan Brock - http://github.com/kbrock
121
- * Ivan Storck - http://github.com/ivanoats
122
- * Kris Chamber - http://github.com/kristopher
123
-
124
-
125
- Bugs and Feedback
126
- -----------------
127
-
128
- If you discover any bugs, please send an e-mail to jose@plataformatec.com.br
129
- If you just want to give some positive feedback or drop a line, that's fine too!
130
-
131
- Copyright (c) 2009 José Valim (jose@plataformatec.com.br)
132
- http://blog.plataformatec.com.br/
133
-
134
-
135
- Version 2.0
136
- -----------
137
-
138
- This plugin was created and maintained until version 2.0 by Duane Johnson:
139
-
140
- Copyright (c) 2006 InquiryLabs, Inc.
141
- http://blog.inquirylabs.com/
1
+ Rails Footnotes
2
+ License: MIT
3
+ Version: 3.6.4
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
+
10
+ Description
11
+ -----------
12
+
13
+ If you are developing in Rails you should know the plugin! It displays
14
+ footnotes in your application for easy debugging, such as sessions,
15
+ request parameters, cookies, filter chain, routes, queries, etc.
16
+
17
+ Even more, it contains links to open files directly in your editor including
18
+ your backtrace lines.
19
+
20
+
21
+ Installation
22
+ ------------
23
+
24
+ Install Rails Footnotes is very easy. If you are running on Rails 2.3 just run
25
+ the following:
26
+
27
+ sudo gem install rails-footnotes
28
+
29
+ In RAILS_ROOT/config/environments/development.rb (yes, you want it only in development):
30
+
31
+ config.gem "rails-footnotes"
32
+
33
+ If you want it as plugin, just do:
34
+
35
+ script/plugin install git://github.com/josevalim/rails-footnotes.git
36
+
37
+ Configuration
38
+ -------------
39
+
40
+ If you are not using Textmate as text editor, in your environment.rb or
41
+ in an initializer do:
42
+
43
+ if defined?(Footnotes)
44
+ Footnotes::Filter.prefix = 'txmt://open?url=file://%s&amp;line=%d&amp;column=%d'
45
+ end
46
+
47
+ Where you are going to choose a prefix compatible with your text editor. The %s is
48
+ replaced by the name of the file, the first %d is replaced by the line number and
49
+ the second %d is replaced by the column.
50
+
51
+ By default, footnotes are appended at the end of the page with default stylesheet. If you want
52
+ to change their position, you can define a div with id "footnotes_holder" or define your own stylesheet
53
+ by turning footnotes stylesheet off:
54
+
55
+ Footnotes::Filter.no_style = true
56
+
57
+ Another option is to allow multiple notes to be opened at the same time:
58
+
59
+ Footnotes::Filter.multiple_notes = true
60
+
61
+ Finally, you can control which notes you want to show. The default are:
62
+
63
+ Footnotes::Filter.notes = [:session, :cookies, :params, :filters, :routes, :env, :queries, :log, :general]
64
+
65
+
66
+ Creating your own notes
67
+ -----------------------
68
+
69
+ Create your notes to integrate with Footnotes is easy.
70
+
71
+ 1. Create a Footnotes::Notes::YourExampleNote class
72
+
73
+ 2. Implement the necessary methods (check abstract_note.rb file in lib/notes)
74
+
75
+ 3. Append your example note in Footnotes::Filter.notes array (usually at the end of your environment file or in an initializer):
76
+
77
+ For example, to create a note that shows info about the user logged in your application you just have to do:
78
+
79
+ module Footnotes
80
+ module Notes
81
+ class CurrentUserNote < AbstractNote
82
+ # This method always receives a controller
83
+ #
84
+ def initialize(controller)
85
+ @current_user = controller.instance_variable_get("@current_user")
86
+ end
87
+
88
+ # The name that will appear as legend in fieldsets
89
+ #
90
+ def legend
91
+ "Current user: #{@current_user.name}"
92
+ end
93
+
94
+ # This Note is only valid if we actually found an user
95
+ # If it's not valid, it won't be displayed
96
+ #
97
+ def valid?
98
+ @current_user
99
+ end
100
+
101
+ # The fieldset content
102
+ #
103
+ def content
104
+ escape(@current_user.inspect)
105
+ end
106
+ end
107
+ end
108
+ end
109
+
110
+ Then put in your environment:
111
+
112
+ Footnotes::Filter.notes += [:current_user]
113
+
114
+
115
+ Colaborators
116
+ ------------
117
+
118
+ * Leon Li - http://github.com/scorpio
119
+ * Keenan Brock - http://github.com/kbrock
120
+ * Ivan Storck - http://github.com/ivanoats
121
+ * Kris Chamber - http://github.com/kristopher
122
+
123
+
124
+ Bugs and Feedback
125
+ -----------------
126
+
127
+ If you discover any bugs, please send an e-mail to jose@plataformatec.com.br
128
+ If you just want to give some positive feedback or drop a line, that's fine too!
129
+
130
+ Copyright (c) 2009 José Valim (jose@plataformatec.com.br)
131
+ http://blog.plataformatec.com.br/
132
+
133
+
134
+ Version 2.0
135
+ -----------
136
+
137
+ This plugin was created and maintained until version 2.0 by Duane Johnson:
138
+
139
+ Copyright (c) 2006 InquiryLabs, Inc.
140
+ http://blog.inquirylabs.com/
data/Rakefile CHANGED
@@ -1,12 +1,12 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
4
 
5
5
  begin
6
6
  require 'jeweler'
7
7
  Jeweler::Tasks.new do |s|
8
8
  s.name = "rails-footnotes"
9
- s.version = "3.6.3"
9
+ s.version = "3.6.4"
10
10
  s.rubyforge_project = "rails-footnotes"
11
11
  s.summary = "Every Rails page has footnotes that gives information about your application and links back to your editor."
12
12
  s.email = "jose@plataformatec.com.br"
@@ -20,19 +20,19 @@ begin
20
20
  rescue LoadError
21
21
  puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
22
22
  end
23
-
24
- desc 'Run tests for Footnotes.'
25
- Rake::TestTask.new(:test) do |t|
26
- t.pattern = 'test/**/*_test.rb'
27
- t.verbose = true
28
- end
29
-
30
- desc 'Generate documentation for Footnotes.'
31
- Rake::RDocTask.new(:rdoc) do |rdoc|
32
- rdoc.rdoc_dir = 'rdoc'
33
- rdoc.title = 'Footnotes'
34
- rdoc.options << '--line-numbers' << '--inline-source'
35
- rdoc.rdoc_files.include('README')
36
- rdoc.rdoc_files.include('MIT-LICENSE')
37
- rdoc.rdoc_files.include('lib/**/*.rb')
38
- end
23
+
24
+ desc 'Run tests for Footnotes.'
25
+ Rake::TestTask.new(:test) do |t|
26
+ t.pattern = 'test/**/*_test.rb'
27
+ t.verbose = true
28
+ end
29
+
30
+ desc 'Generate documentation for Footnotes.'
31
+ Rake::RDocTask.new(:rdoc) do |rdoc|
32
+ rdoc.rdoc_dir = 'rdoc'
33
+ rdoc.title = 'Footnotes'
34
+ rdoc.options << '--line-numbers' << '--inline-source'
35
+ rdoc.rdoc_files.include('README')
36
+ rdoc.rdoc_files.include('MIT-LICENSE')
37
+ rdoc.rdoc_files.include('lib/**/*.rb')
38
+ end
@@ -1,20 +1,20 @@
1
- if RAILS_ENV == 'development'
2
- dir = File.dirname(__FILE__)
3
- require File.join(dir, 'rails-footnotes', 'footnotes')
4
- require File.join(dir, 'rails-footnotes', 'backtracer')
5
-
6
- # Load all notes
7
- #
8
- Dir[File.join(dir, 'rails-footnotes', 'notes', '*.rb')].each do |note|
9
- require note unless note =~ /queries/ && !defined?(ActiveRecord)
10
- end
11
-
12
- # The footnotes are applied by default to all actions. You can change this
13
- # behavior commenting the after_filter line below and putting it in Your
14
- # application. Then you can cherrypick in which actions it will appear.
15
- #
16
- class ActionController::Base
17
- prepend_before_filter Footnotes::Filter
18
- after_filter Footnotes::Filter
19
- end
1
+ if RAILS_ENV == 'development'
2
+ dir = File.dirname(__FILE__)
3
+ require File.join(dir, 'rails-footnotes', 'footnotes')
4
+ require File.join(dir, 'rails-footnotes', 'backtracer')
5
+
6
+ # Load all notes
7
+ #
8
+ Dir[File.join(dir, 'rails-footnotes', 'notes', '*.rb')].each do |note|
9
+ require note unless note =~ /queries/ && !defined?(ActiveRecord)
10
+ end
11
+
12
+ # The footnotes are applied by default to all actions. You can change this
13
+ # behavior commenting the after_filter line below and putting it in Your
14
+ # application. Then you can cherrypick in which actions it will appear.
15
+ #
16
+ class ActionController::Base
17
+ prepend_before_filter Footnotes::Filter
18
+ after_filter Footnotes::Filter
19
+ end
20
20
  end
@@ -1,34 +1,34 @@
1
- module Footnotes
2
- module Extensions
3
- module Exception
4
- def self.included(base)
5
- base.class_eval do
6
- alias_method_chain :clean_backtrace, :links
7
- end
8
- end
9
-
10
- def add_links_to_backtrace(lines)
11
- lines.collect do |line|
12
- expanded = line.gsub('#{RAILS_ROOT}', RAILS_ROOT)
13
- if match = expanded.match(/^(.+):(\d+):in/) || match = expanded.match(/^(.+):(\d+)\s*$/)
14
- file = File.expand_path(match[1])
15
- line_number = match[2]
16
- html = %[<a href="#{Footnotes::Filter.prefix(file, line_number, 1)}">#{line}</a>]
17
- else
18
- line
19
- end
20
- end
21
- end
22
-
23
- def clean_backtrace_with_links
24
- unless ::Footnotes::Filter.prefix.blank?
25
- add_links_to_backtrace(clean_backtrace_without_links)
26
- else
27
- clean_backtrace_without_links
28
- end
29
- end
30
- end
31
- end
32
- end
33
-
1
+ module Footnotes
2
+ module Extensions
3
+ module Exception
4
+ def self.included(base)
5
+ base.class_eval do
6
+ alias_method_chain :clean_backtrace, :links
7
+ end
8
+ end
9
+
10
+ def add_links_to_backtrace(lines)
11
+ lines.collect do |line|
12
+ expanded = line.gsub('#{RAILS_ROOT}', RAILS_ROOT)
13
+ if match = expanded.match(/^(.+):(\d+):in/) || match = expanded.match(/^(.+):(\d+)\s*$/)
14
+ file = File.expand_path(match[1])
15
+ line_number = match[2]
16
+ html = %[<a href="#{Footnotes::Filter.prefix(file, line_number, 1)}">#{line}</a>]
17
+ else
18
+ line
19
+ end
20
+ end
21
+ end
22
+
23
+ def clean_backtrace_with_links
24
+ unless ::Footnotes::Filter.prefix.blank?
25
+ add_links_to_backtrace(clean_backtrace_without_links)
26
+ else
27
+ clean_backtrace_without_links
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
34
  Exception.send :include, Footnotes::Extensions::Exception