rails-footnotes 4.1.8 → 7.0.0

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
1
  ---
2
- SHA1:
3
- metadata.gz: 21fa093ff6eaf5b53695cfaed61637fa8e4c8187
4
- data.tar.gz: 79e79b4486adcd087d948cc6d2d9f4959b6ac2bd
2
+ SHA256:
3
+ metadata.gz: 67dd876890a76a0d5907902934ec0fd233d143c002a5dc67572f2015f6f3ef0a
4
+ data.tar.gz: be6c1412e334b99111f4c0e5eb702c79f1e213aa39bc01750478b7c9823d7363
5
5
  SHA512:
6
- metadata.gz: 0873a5dbe0233b3f87b43748bfe402227116892233b09fb964c2ab692c35dc0a09e6f02f348ba5696b5bb9922b08490afabb04805be9af994a72856420581826
7
- data.tar.gz: 1b88bc094b480f831319fa08b8c56fe0ac43356b5ca31ad1d492eee4cbe1bdadd438b05fc46bb22a5232fa1447398dd2a7d64e776177238e24c8f59f2f23c2cc
6
+ metadata.gz: c752688540b1f643dc25faf90fcdb879ac0477aa463acb423ec24011eb76d3d84160b1a583630d7002699ae181dc083cff17f7e2a6d46bdf75ba52f4416dd270
7
+ data.tar.gz: a9010b8aead77c935804b045e4b227f04979a6a2b31bd367c90a06d5dcbf96cc31a2c83dd6d868c59824f650213d84bf9e4690bb7bf06d15e389b5fd6489a1c7
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "daily"
7
+ - package-ecosystem: "bundler"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "daily"
@@ -0,0 +1,19 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Set up Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ bundler-cache: true
18
+ - name: Run tests
19
+ run: bin/rspec
@@ -0,0 +1,33 @@
1
+ name: "Merge updates"
2
+ on:
3
+ workflow_run:
4
+ workflows: ["CI"]
5
+ types: ["completed"]
6
+ branches: ["dependabot/**"]
7
+ jobs:
8
+ merge:
9
+ name: "Merge"
10
+ runs-on: "ubuntu-latest"
11
+ permissions:
12
+ contents: write
13
+ issues: write
14
+ pull-requests: write
15
+ if: >
16
+ github.event.workflow_run.event == 'pull_request' &&
17
+ github.event.workflow_run.conclusion == 'success' &&
18
+ github.actor == 'dependabot[bot]'
19
+ steps:
20
+ - name: "Merge pull request"
21
+ uses: "actions/github-script@v7"
22
+ with:
23
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
24
+ script: |
25
+ const pullRequest = context.payload.workflow_run.pull_requests[0]
26
+ const repository = context.repo
27
+
28
+ await github.rest.pulls.merge({
29
+ merge_method: "merge",
30
+ owner: repository.owner,
31
+ pull_number: pullRequest.number,
32
+ repo: repository.repo,
33
+ })
data/.gitignore CHANGED
@@ -1,16 +1,10 @@
1
- .*
2
- !.gitignore
3
- !.gitmodules
4
- !.travis.yml
5
- !*.example
6
1
  *.gem
7
2
  .bundle
8
- Gemfile.lock
9
- pkg/*
10
- /bin
3
+ .rspec_results
11
4
  /coverage
12
- tags
13
5
  /doc
14
6
  /myapp
15
- spec/tmp
7
+ pkg/*
16
8
  spec/log
9
+ spec/tmp
10
+ tags
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/Gemfile CHANGED
@@ -1,3 +1,13 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ ruby file: ".ruby-version"
6
+
7
+ gem "capybara", "~> 3.35"
8
+ gem "nokogiri", "~> 1.12"
9
+ gem "pry", "~> 0.14.1"
10
+ gem "rake", "~> 13.0"
11
+ gem "rspec-rails", "~> 6.0"
12
+ gem "sprockets-rails", "~> 3.2"
13
+ gem "matrix", "~> 0.4.2"
data/Gemfile.lock ADDED
@@ -0,0 +1,217 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rails-footnotes (7.0.0)
5
+ rails (~> 7.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (7.0.8)
11
+ actionpack (= 7.0.8)
12
+ activesupport (= 7.0.8)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (7.0.8)
16
+ actionpack (= 7.0.8)
17
+ activejob (= 7.0.8)
18
+ activerecord (= 7.0.8)
19
+ activestorage (= 7.0.8)
20
+ activesupport (= 7.0.8)
21
+ mail (>= 2.7.1)
22
+ net-imap
23
+ net-pop
24
+ net-smtp
25
+ actionmailer (7.0.8)
26
+ actionpack (= 7.0.8)
27
+ actionview (= 7.0.8)
28
+ activejob (= 7.0.8)
29
+ activesupport (= 7.0.8)
30
+ mail (~> 2.5, >= 2.5.4)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
34
+ rails-dom-testing (~> 2.0)
35
+ actionpack (7.0.8)
36
+ actionview (= 7.0.8)
37
+ activesupport (= 7.0.8)
38
+ rack (~> 2.0, >= 2.2.4)
39
+ rack-test (>= 0.6.3)
40
+ rails-dom-testing (~> 2.0)
41
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
+ actiontext (7.0.8)
43
+ actionpack (= 7.0.8)
44
+ activerecord (= 7.0.8)
45
+ activestorage (= 7.0.8)
46
+ activesupport (= 7.0.8)
47
+ globalid (>= 0.6.0)
48
+ nokogiri (>= 1.8.5)
49
+ actionview (7.0.8)
50
+ activesupport (= 7.0.8)
51
+ builder (~> 3.1)
52
+ erubi (~> 1.4)
53
+ rails-dom-testing (~> 2.0)
54
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
+ activejob (7.0.8)
56
+ activesupport (= 7.0.8)
57
+ globalid (>= 0.3.6)
58
+ activemodel (7.0.8)
59
+ activesupport (= 7.0.8)
60
+ activerecord (7.0.8)
61
+ activemodel (= 7.0.8)
62
+ activesupport (= 7.0.8)
63
+ activestorage (7.0.8)
64
+ actionpack (= 7.0.8)
65
+ activejob (= 7.0.8)
66
+ activerecord (= 7.0.8)
67
+ activesupport (= 7.0.8)
68
+ marcel (~> 1.0)
69
+ mini_mime (>= 1.1.0)
70
+ activesupport (7.0.8)
71
+ concurrent-ruby (~> 1.0, >= 1.0.2)
72
+ i18n (>= 1.6, < 2)
73
+ minitest (>= 5.1)
74
+ tzinfo (~> 2.0)
75
+ addressable (2.8.5)
76
+ public_suffix (>= 2.0.2, < 6.0)
77
+ builder (3.2.4)
78
+ capybara (3.39.2)
79
+ addressable
80
+ matrix
81
+ mini_mime (>= 0.1.3)
82
+ nokogiri (~> 1.8)
83
+ rack (>= 1.6.0)
84
+ rack-test (>= 0.6.3)
85
+ regexp_parser (>= 1.5, < 3.0)
86
+ xpath (~> 3.2)
87
+ coderay (1.1.3)
88
+ concurrent-ruby (1.2.2)
89
+ crass (1.0.6)
90
+ date (3.3.4)
91
+ diff-lcs (1.5.0)
92
+ erubi (1.12.0)
93
+ globalid (1.2.1)
94
+ activesupport (>= 6.1)
95
+ i18n (1.14.1)
96
+ concurrent-ruby (~> 1.0)
97
+ loofah (2.22.0)
98
+ crass (~> 1.0.2)
99
+ nokogiri (>= 1.12.0)
100
+ mail (2.8.1)
101
+ mini_mime (>= 0.1.1)
102
+ net-imap
103
+ net-pop
104
+ net-smtp
105
+ marcel (1.0.2)
106
+ matrix (0.4.2)
107
+ method_source (1.0.0)
108
+ mini_mime (1.1.5)
109
+ minitest (5.20.0)
110
+ net-imap (0.4.6)
111
+ date
112
+ net-protocol
113
+ net-pop (0.1.2)
114
+ net-protocol
115
+ net-protocol (0.2.2)
116
+ timeout
117
+ net-smtp (0.4.0)
118
+ net-protocol
119
+ nio4r (2.6.1)
120
+ nokogiri (1.15.5-arm64-darwin)
121
+ racc (~> 1.4)
122
+ nokogiri (1.15.5-x86_64-linux)
123
+ racc (~> 1.4)
124
+ pry (0.14.2)
125
+ coderay (~> 1.1)
126
+ method_source (~> 1.0)
127
+ public_suffix (5.0.4)
128
+ racc (1.7.3)
129
+ rack (2.2.8)
130
+ rack-test (2.1.0)
131
+ rack (>= 1.3)
132
+ rails (7.0.8)
133
+ actioncable (= 7.0.8)
134
+ actionmailbox (= 7.0.8)
135
+ actionmailer (= 7.0.8)
136
+ actionpack (= 7.0.8)
137
+ actiontext (= 7.0.8)
138
+ actionview (= 7.0.8)
139
+ activejob (= 7.0.8)
140
+ activemodel (= 7.0.8)
141
+ activerecord (= 7.0.8)
142
+ activestorage (= 7.0.8)
143
+ activesupport (= 7.0.8)
144
+ bundler (>= 1.15.0)
145
+ railties (= 7.0.8)
146
+ rails-dom-testing (2.2.0)
147
+ activesupport (>= 5.0.0)
148
+ minitest
149
+ nokogiri (>= 1.6)
150
+ rails-html-sanitizer (1.6.0)
151
+ loofah (~> 2.21)
152
+ nokogiri (~> 1.14)
153
+ railties (7.0.8)
154
+ actionpack (= 7.0.8)
155
+ activesupport (= 7.0.8)
156
+ method_source
157
+ rake (>= 12.2)
158
+ thor (~> 1.0)
159
+ zeitwerk (~> 2.5)
160
+ rake (13.1.0)
161
+ regexp_parser (2.8.2)
162
+ rspec-core (3.12.2)
163
+ rspec-support (~> 3.12.0)
164
+ rspec-expectations (3.12.3)
165
+ diff-lcs (>= 1.2.0, < 2.0)
166
+ rspec-support (~> 3.12.0)
167
+ rspec-mocks (3.12.6)
168
+ diff-lcs (>= 1.2.0, < 2.0)
169
+ rspec-support (~> 3.12.0)
170
+ rspec-rails (6.1.0)
171
+ actionpack (>= 6.1)
172
+ activesupport (>= 6.1)
173
+ railties (>= 6.1)
174
+ rspec-core (~> 3.12)
175
+ rspec-expectations (~> 3.12)
176
+ rspec-mocks (~> 3.12)
177
+ rspec-support (~> 3.12)
178
+ rspec-support (3.12.1)
179
+ sprockets (4.2.1)
180
+ concurrent-ruby (~> 1.0)
181
+ rack (>= 2.2.4, < 4)
182
+ sprockets-rails (3.4.2)
183
+ actionpack (>= 5.2)
184
+ activesupport (>= 5.2)
185
+ sprockets (>= 3.0.0)
186
+ thor (1.3.0)
187
+ timeout (0.4.1)
188
+ tzinfo (2.0.6)
189
+ concurrent-ruby (~> 1.0)
190
+ websocket-driver (0.7.6)
191
+ websocket-extensions (>= 0.1.0)
192
+ websocket-extensions (0.1.5)
193
+ xpath (3.2.0)
194
+ nokogiri (~> 1.8)
195
+ zeitwerk (2.6.12)
196
+
197
+ PLATFORMS
198
+ arm64-darwin-20
199
+ arm64-darwin-22
200
+ arm64-darwin-23
201
+ x86_64-linux
202
+
203
+ DEPENDENCIES
204
+ capybara (~> 3.35)
205
+ matrix (~> 0.4.2)
206
+ nokogiri (~> 1.12)
207
+ pry (~> 0.14.1)
208
+ rails-footnotes!
209
+ rake (~> 13.0)
210
+ rspec-rails (~> 6.0)
211
+ sprockets-rails (~> 3.2)
212
+
213
+ RUBY VERSION
214
+ ruby 3.2.2p53
215
+
216
+ BUNDLED WITH
217
+ 2.4.22
data/README.rdoc CHANGED
@@ -1,6 +1,4 @@
1
- = Rails Footnotes
2
-
3
- {<img src="https://travis-ci.org/josevalim/rails-footnotes.png" />}[https://travis-ci.org/josevalim/rails-footnotes]
1
+ = Rails 7 Footnotes
4
2
 
5
3
  Rails footnotes displays footnotes in your application for easy debugging, such as sessions,
6
4
  request parameters, cookies, filter chain, routes, queries, etc.
@@ -10,17 +8,11 @@ your backtrace lines.
10
8
 
11
9
  == Installation
12
10
 
13
- NOTE: Since this branch aims for Rails 3.2+ support, if you want to use footnotes with Rails 2.3 you should use this branch:
14
-
15
- https://github.com/josevalim/rails-footnotes/tree/rails2
16
-
17
- Installing Rails Footnotes is very easy.
11
+ Add to your `Gemfile`:
18
12
 
19
- === Rails 3.2.x/4.x
13
+ gem "rails-footnotes", "~> 5.0"
20
14
 
21
- gem 'rails-footnotes', '~> 4.0'
22
-
23
- After you install RailsFootnotes and add it to your Gemfile, you need to run the generator:
15
+ Run `bundle install`, then the generator:
24
16
 
25
17
  rails generate rails_footnotes:install
26
18
 
@@ -37,7 +29,7 @@ This will create an initializer with default config and some examples.
37
29
 
38
30
  === Editor links
39
31
 
40
- Textmate, MacVim and Sublime Text 2 are compatible.
32
+ Textmate, MacVim and Sublime Text 3 are compatible.
41
33
 
42
34
  *MacVim*
43
35
 
@@ -52,17 +44,11 @@ the second %d is replaced by the column number.
52
44
  Take note that the order in which the file name (%s), line number (%d) and column number (%d) appears is important.
53
45
  We assume that they appear in that order. "foo://line=%d&file=%s" (%d precedes %s) would throw out an error.
54
46
 
55
- *Sublime* *Text* *2*
56
-
57
- 1. Keep the Textmate prefix, <tt>f.prefix = 'txmt://open?url=file://%s&line=%d&column=%d'</tt>
47
+ *Sublime* *Text* *3*
58
48
 
59
- 2. Install {subl-handler}[https://github.com/asuth/subl-handler]
49
+ Install {subl}[https://github.com/dhoulb/subl], then use:
60
50
 
61
- 3. Open subl-handler. Go to preferences (SublHandler > Preferences), and point "Path to subl" to your installed instance. (EG, /Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl). Note: do not escape the whitespaces, subl-handler accounts for those.
62
-
63
- 4. Install {RCDefault}[http://www.rubicode.com/Software/RCDefaultApp]. It's OSX 10.2, but it works.
64
-
65
- 5. Go to RCDefaultApp (OS System Preferences > DefaultApps). Go to URL section, select "tmxt" extension, and set default applicaiton to "SublHandler".
51
+ f.prefix = 'subl://open?url=file://%s&line=%d&column=%d'
66
52
 
67
53
  *Use* *with* *Vagrant* (*and* *other* *virtual* *machines*)
68
54
 
@@ -156,39 +142,7 @@ If you'd like the footnote, to be at a different place (perhaps for aesthetical
156
142
  <div id="footnotes_holder"></div>
157
143
  at an appropriate place, your notes will now appear inside div#footnotes_holder
158
144
 
159
- == Collaborators
160
-
161
- * Leon Li - http://github.com/scorpio
162
- * Keenan Brock - http://github.com/kbrock
163
- * Ivan Storck - http://github.com/ivanoats
164
- * Kris Chamber - http://github.com/kristopher
165
- * Roman V. Babenko - http://github.com/romanvbabenko
166
- * Adrien Siami - http://github.com/intrepidd
167
-
168
145
  == Bugs and Feedback
169
146
 
170
147
  If you discover any bugs, please open an issue.
171
148
  If you just want to give some positive feedback or drop a line, that's fine too!
172
-
173
- === Version 4.x
174
-
175
- Starting from version 4.0, Adren Siami is the maintainer of this plugin.
176
-
177
- === Version 3.x
178
-
179
- This plugin was maintained until version 4.0 by Roman V. Babenko
180
-
181
- Copyright (c) 2010-2014 Roman V. Babenko (romanvbabenko@gmail.com)
182
- http://romanvbabenko.com
183
-
184
- This plugin was maintained until version 3.6 by José Valim
185
-
186
- Copyright (c) 2009 José Valim (jose@plataformatec.com.br)
187
- http://blog.plataformatec.com.br
188
-
189
- === Version 2.0
190
-
191
- This plugin was created and maintained until version 2.0 by Duane Johnson:
192
-
193
- Copyright (c) 2006 InquiryLabs, Inc.
194
- http://blog.inquirylabs.com
data/bin/rake ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
@@ -1,11 +1,10 @@
1
- defined?(Footnotes) && Footnotes.setup do |f|
1
+ Footnotes.setup do |f|
2
2
  # Whether or not to enable footnotes
3
3
  f.enabled = Rails.env.development?
4
- # You can also use a lambda / proc to conditionally toggle footnotes
5
- # Example :
4
+ # You can also use a lambda / proc to conditionally toggle footnotes, like
6
5
  # f.enabled = -> { User.current.admin? }
7
6
  # Beware of thread-safety though, Footnotes.enabled is NOT thread safe
8
- # and should not be modified anywhere else.
7
+ # and should not be modified outside this initializer.
9
8
 
10
9
  # Only toggle some notes :
11
10
  # f.notes = [:session, :cookies, :params, :filters, :routes, :env, :queries, :log]
@@ -24,4 +23,4 @@ defined?(Footnotes) && Footnotes.setup do |f|
24
23
 
25
24
  # Allow to open multiple notes :
26
25
  # f.multiple_notes = true
27
- end
26
+ end if defined?(Footnotes) && Footnotes.respond_to?(:setup)
@@ -2,31 +2,23 @@ require 'active_support/concern'
2
2
 
3
3
  module Footnotes
4
4
  module RailsFootnotesExtension
5
-
6
5
  extend ActiveSupport::Concern
7
6
 
8
7
  included do
9
- if Rails::VERSION::MAJOR >= 5
10
- prepend_before_action :rails_footnotes_before_filter
11
- after_action :rails_footnotes_after_filter
12
- else
13
- prepend_before_filter :rails_footnotes_before_filter
14
- after_filter :rails_footnotes_after_filter
15
- end
8
+ prepend_before_action :rails_footnotes_before_filter
9
+ after_action :rails_footnotes_after_filter
16
10
  end
17
11
 
18
12
  def rails_footnotes_before_filter
19
- if Footnotes.enabled?(self)
20
- Footnotes::Filter.start!(self)
21
- end
13
+ Footnotes::Filter.start!(self) if Footnotes.enabled?(self)
22
14
  end
23
15
 
24
16
  def rails_footnotes_after_filter
25
- if Footnotes.enabled?(self)
26
- filter = Footnotes::Filter.new(self)
27
- filter.add_footnotes!
28
- filter.close!(self)
29
- end
17
+ return unless Footnotes.enabled?(self)
18
+
19
+ filter = Footnotes::Filter.new(self)
20
+ filter.add_footnotes!
21
+ filter.close!(self)
30
22
  end
31
23
  end
32
24
  end
@@ -47,7 +47,7 @@ module Footnotes
47
47
  if args.empty?
48
48
  @@prefix
49
49
  else
50
- args.map! { |arg| URI.escape(arg.to_s) }
50
+ args.map! { |arg| arg.to_s.split("/").map{|s| ERB::Util.url_encode(s) }.join("/") }
51
51
 
52
52
  if @@prefix.respond_to? :call
53
53
  @@prefix.call *args
@@ -116,7 +116,8 @@ module Footnotes
116
116
  end
117
117
 
118
118
  def valid_format?
119
- ['text/html', nil].include? @controller.response.content_type
119
+ format = @controller.response.content_type
120
+ format.nil? || format.include?("text/html")
120
121
  end
121
122
 
122
123
  def valid_content_type?
@@ -169,7 +170,7 @@ module Footnotes
169
170
  #footnotes_debug table td {padding: 5px; border-bottom: 1px solid #ccc;}
170
171
  #footnotes_debug table td strong {color: #9b1b1b;}
171
172
  #footnotes_debug table th {padding: 5px; border-bottom: 1px solid #ccc;}
172
- #footnotes_debug table tr:nth-child(2n) td {background: #eee;}
173
+ #footnotes_debug table tr:nth-child(2n) td {background: #f5f5f5;}
173
174
  #footnotes_debug table tr:nth-child(2n + 1) td {background: #fff;}
174
175
  #footnotes_debug tbody {text-align: left;}
175
176
  #footnotes_debug .name_values td {vertical-align: top;}
@@ -16,9 +16,9 @@ module Footnotes
16
16
  :@view_runtime,
17
17
  :@marked_for_same_origin_verification
18
18
  ]
19
- cattr_accessor :ignored_assigns, :instance_writter => false
19
+ cattr_accessor :ignored_assigns, :instance_writer => false
20
20
  @@ignored_assigns_pattern = /^@_/
21
- cattr_accessor :ignored_assigns_pattern, :instance_writter => false
21
+ cattr_accessor :ignored_assigns_pattern, :instance_writer => false
22
22
 
23
23
  def initialize(controller)
24
24
  @controller = controller
@@ -14,7 +14,7 @@ module Footnotes
14
14
  end
15
15
 
16
16
  def valid?
17
- prefix? && controller_filename && File.exists?(controller_filename)
17
+ prefix? && controller_filename && File.exist?(controller_filename)
18
18
  end
19
19
 
20
20
  protected
@@ -24,14 +24,15 @@ module Footnotes
24
24
 
25
25
  protected
26
26
  def scan_text(text)
27
- []
27
+ raise NotImplementedError, "implement this in your subclass"
28
28
  end
29
29
 
30
30
  def parse_files!
31
- asset_paths = Rails.application.config.assets.paths
31
+ asset_paths = Rails.application.config.try(:assets).try(:paths) || []
32
32
  linked_files = []
33
33
 
34
34
  @files.collect do |file|
35
+ file.gsub!(/-[a-f0-9]{64}\./, '.')
35
36
  base_name = File.basename(file)
36
37
  asset_paths.each do |asset_path|
37
38
  results = Dir[File.expand_path(base_name, asset_path) + '*']
@@ -1,7 +1,7 @@
1
1
  module Footnotes
2
2
  module Notes
3
3
  class QueriesNote < AbstractNote
4
- cattr_accessor :alert_db_time, :alert_sql_number, :orm, :ignored_regexps, :instance_writter => false
4
+ cattr_accessor :alert_db_time, :alert_sql_number, :orm, :ignored_regexps, :instance_writer => false
5
5
  @@alert_db_time = 16.0
6
6
  @@alert_sql_number = 8
7
7
  @@query_subscriber = nil
@@ -23,8 +23,8 @@ module Footnotes
23
23
  def title
24
24
  queries = self.events.count
25
25
  total_time = self.events.map(&:duration).sum
26
- query_color = generate_red_color(self.events.count, alert_sql_number)
27
- db_color = generate_red_color(total_time, alert_db_time)
26
+ query_color = alert_color(self.events.count, alert_sql_number)
27
+ db_color = alert_color(total_time, alert_db_time)
28
28
 
29
29
  <<-TITLE
30
30
  <span style="background-color:#{query_color}">Queries (#{queries})</span>
@@ -57,17 +57,16 @@ module Footnotes
57
57
 
58
58
  protected
59
59
  def print_name_and_time(name, time)
60
- "<span style='background-color:#{generate_red_color(time, alert_ratio)}'>#{escape(name || 'SQL')} (#{'%.3fms' % time})</span>"
60
+ "<span style='background-color:#{alert_color(time, alert_ratio)}'>#{escape(name || 'SQL')} (#{'%.3fms' % time})</span>"
61
61
  end
62
62
 
63
63
  def print_query(query)
64
64
  escape(query.to_s.gsub(/(\s)+/, ' ').gsub('`', ''))
65
65
  end
66
66
 
67
- def generate_red_color(value, alert)
68
- c = ((value.to_f/alert).to_i - 1) * 16
69
- c = 0 if c < 0; c = 15 if c > 15; c = (15-c).to_s(16)
70
- "#ff#{c*4}"
67
+ def alert_color(value, threshold)
68
+ return 'transparent' if value < threshold
69
+ '#ffff00'
71
70
  end
72
71
 
73
72
  def alert_ratio
@@ -103,7 +102,7 @@ module Footnotes
103
102
  attr_accessor :events, :ignore_regexps
104
103
 
105
104
  def initialize(orm)
106
- super()
105
+ super()
107
106
  @events = []
108
107
  orm.each {|adapter| ActiveSupport::LogSubscriber.attach_to adapter, self}
109
108
  end
@@ -27,13 +27,14 @@ module Footnotes
27
27
  end
28
28
 
29
29
  def valid?
30
- prefix? && filename && File.exists?(filename)
30
+ prefix? && filename && File.exist?(filename)
31
31
  end
32
32
 
33
33
  protected
34
34
 
35
35
  def filename
36
- @filename ||= self.class.template[:file]
36
+ return @filename if defined?(@filename)
37
+ @filename = self.class.template.try(:[], :file)
37
38
  end
38
39
 
39
40
  end
@@ -1,3 +1,3 @@
1
1
  module Footnotes
2
- VERSION = "4.1.8"
2
+ VERSION = "7.0.0"
3
3
  end
@@ -5,7 +5,6 @@ require 'rails-footnotes/each_with_rescue'
5
5
  require 'rails-footnotes/filter'
6
6
  require 'rails-footnotes/notes/all'
7
7
  require 'rails-footnotes/extension'
8
- require 'active_support/deprecation'
9
8
 
10
9
  module Footnotes
11
10
  mattr_accessor :before_hooks
@@ -37,11 +36,6 @@ module Footnotes
37
36
  delegate :font_size=, :to => Filter
38
37
  end
39
38
 
40
- def self.run!
41
- ActiveSupport::Deprecation.warn "run! is deprecated and will be removed from future releases, use Footnotes.setup or Footnotes.enabled instead.", caller
42
- Footnotes.enabled = true
43
- end
44
-
45
39
  def self.before(&block)
46
40
  @@before_hooks << block
47
41
  end
@@ -67,6 +61,8 @@ module Footnotes
67
61
  end
68
62
  end
69
63
 
70
- ActionController::Base.send(:include, Footnotes::RailsFootnotesExtension)
64
+ ActiveSupport.on_load(:action_controller) do
65
+ ActionController::Base.send(:include, Footnotes::RailsFootnotesExtension)
66
+ end
71
67
 
72
68
  load Rails.root.join('.rails_footnotes') if Rails.root && Rails.root.join('.rails_footnotes').exist?
@@ -6,22 +6,16 @@ Gem::Specification.new do |s|
6
6
  s.name = "rails-footnotes"
7
7
  s.version = Footnotes::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Roman V. Babenko", "José Valim", "Keenan Brock", "Duane Johnson", "Adrien Siami"]
10
- s.email = ["romanvbabenko@gmail.com"]
11
- s.homepage = "http://github.com/josevalim/rails-footnotes"
9
+ s.authors = ["Roman V. Babenko", "José Valim", "Keenan Brock", "Duane Johnson", "Adrien Siami", "André Arko"]
10
+ s.email = ["andre@arko.net"]
11
+ s.homepage = "http://github.com/indirect/rails-footnotes"
12
12
  s.summary = %q{Every Rails page has footnotes that gives information about your application and links back to your editor.}
13
13
  s.description = %q{Every Rails page has footnotes that gives information about your application and links back to your editor.}
14
14
 
15
- s.rubyforge_project = "rails-footnotes"
16
-
17
- s.add_dependency "rails", ">= 3.2"
18
-
19
- s.add_development_dependency "rspec-rails", '~> 3.3.2'
20
- s.add_development_dependency "sprockets-rails", '~> 2.0'
21
- s.add_development_dependency "capybara"
15
+ s.add_dependency "rails", "~> 7.0"
16
+ s.required_ruby_version = ">= 3.0"
22
17
 
23
18
  s.files = `git ls-files`.split("\n")
24
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
- s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
26
20
  s.require_paths = ["lib"]
27
21
  end
data/renovate.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "ruby-version": {
3
+ "enabled": true
4
+ }
5
+ }
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts .js
2
+ //= link_directory ../stylesheets .css
@@ -0,0 +1 @@
1
+ FILES INDEX
@@ -1,10 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class FilesController < ApplicationController
4
-
5
- def index
6
- end
4
+ def index
7
5
  end
6
+ end
8
7
 
9
8
  describe FilesController, type: :controller do
10
9
  render_views
@@ -19,6 +18,7 @@ describe FilesController, type: :controller do
19
18
 
20
19
  it 'includes stylesheets assets in the response' do
21
20
  get :index
21
+ expect(response.body).to include("FILES INDEX")
22
22
  js_debug = first('fieldset#javascripts_debug_info div', visible: false)
23
23
  expect(js_debug).to have_selector('li a', visible: false, count: 1)
24
24
  expect(js_debug).to have_selector('li a', text: /foobar\.js/, visible: false)
@@ -3,15 +3,15 @@ require 'spec_helper'
3
3
  class FootnotesController < ActionController::Base
4
4
 
5
5
  def foo
6
- render :text => HTML_DOCUMENT, :content_type => 'text/html'
6
+ render inline: HTML_DOCUMENT, content_type: 'text/html'
7
7
  end
8
8
 
9
9
  def foo_holder
10
- render :text => '<html><body><div id="footnotes_holder"></div></body></html>'
10
+ render inline: '<html><body><div id="footnotes_holder"></div></body></html>'
11
11
  end
12
12
 
13
13
  def foo_js
14
- render :text => '<script></script>', :content_type => 'text/javascript'
14
+ render inline: '<script></script>', content_type: 'text/javascript'
15
15
  end
16
16
 
17
17
  def foo_download
@@ -75,7 +75,7 @@ describe FootnotesController, type: :controller do
75
75
  describe 'when request is xhr' do
76
76
  include_context 'has_no_footnotes'
77
77
  before do
78
- xhr :get, :foo
78
+ get :foo, xhr: true
79
79
  end
80
80
  end
81
81
 
@@ -10,7 +10,7 @@ describe 'log note', type: :controller do
10
10
  def index
11
11
  Rails.logger.error 'foo'
12
12
  Rails.logger.warn 'bar'
13
- render :text => '<html><head></head><body></body></html>', :content_type => 'text/html'
13
+ render inline: '<html><head></head><body></body></html>', content_type: 'text/html'
14
14
  end
15
15
  end
16
16
 
@@ -9,11 +9,11 @@ end
9
9
  describe Footnotes::Notes::EnvNote do
10
10
  let(:controller) {
11
11
  FootnotesEnvController.new.tap { |c|
12
- c.template = Object.new
13
- c.request = ActionController::TestRequest.new
14
- c.response = ActionController::TestResponse.new
12
+ c.template = Object.new
13
+ c.request = ActionDispatch::TestRequest.create
14
+ c.response = ActionDispatch::TestResponse.new
15
15
  c.response_body = %Q(<html><body></body></html>)
16
- c.params = {}
16
+ c.params = {}
17
17
  }
18
18
  }
19
19
 
@@ -30,8 +30,8 @@ describe "Footnotes" do
30
30
  before do
31
31
  @controller = FootnotesController.new
32
32
  @controller.template = Object.new
33
- @controller.request = ActionController::TestRequest.new
34
- @controller.response = ActionController::TestResponse.new
33
+ @controller.request = ActionDispatch::TestRequest.create
34
+ @controller.response = ActionDispatch::TestResponse.new
35
35
  @controller.response_body = HTML_DOCUMENT.dup
36
36
  @controller.params = {}
37
37
 
@@ -48,6 +48,7 @@ describe "Footnotes" do
48
48
  context "response_body is file" do
49
49
  before do
50
50
  @file = Tempfile.new("test")
51
+ def @file.body; read; end
51
52
  @file.write "foobarbaz"
52
53
  @file.rewind
53
54
  end
@@ -89,7 +90,7 @@ describe "Footnotes" do
89
90
  end
90
91
 
91
92
  specify "footnotes_included_when_content_type_is_html" do
92
- @controller.response.content_type = 'text/html'
93
+ @controller.response.content_type = 'text/html; charset=utf-8'
93
94
  footnotes_perform!
94
95
  expect(@controller.response.body).not_to eql HTML_DOCUMENT
95
96
  end
@@ -25,7 +25,7 @@ describe Footnotes::Notes::AssignsNote do
25
25
  specify {expect(note.send(:to_table)).to eql [
26
26
  ["Name", "Value"],
27
27
  ["<strong>@action_has_layout</strong><br /><em>TrueClass</em>", "true"],
28
- ["<strong>@status</strong><br /><em>Fixnum</em>", "200"]
28
+ ["<strong>@status</strong><br /><em>Integer</em>", "200"]
29
29
  ]}
30
30
 
31
31
  describe "Ignored Assigns" do
@@ -43,7 +43,7 @@ describe Footnotes::Notes::AssignsNote do
43
43
  [
44
44
  ["Name", "Value"],
45
45
  ["<strong>@action_has_layout</strong><br /><em>TrueClass</em>", "true"],
46
- ["<strong>@status</strong><br /><em>Fixnum</em>", "200"]
46
+ ["<strong>@status</strong><br /><em>Integer</em>", "200"]
47
47
  ], {:summary=>"Debug information for Assigns (2)"})
48
48
  note.content
49
49
  end
@@ -2,10 +2,16 @@ require 'spec_helper'
2
2
  require 'action_controller'
3
3
  require "rails-footnotes/notes/files_note"
4
4
 
5
+ class ConcreteFilesNote < Footnotes::Notes::FilesNote
6
+ def scan_text(text)
7
+ []
8
+ end
9
+ end
10
+
5
11
  describe Footnotes::Notes::FilesNote do
6
12
 
7
13
  let(:note) do
8
- Footnotes::Notes::FilesNote.new(double('controller', :response => double('', :body => '')))
14
+ ConcreteFilesNote.new(double('controller', :response => double('', :body => '')))
9
15
  end
10
16
 
11
17
  subject { note }
@@ -2,11 +2,17 @@ require "spec_helper"
2
2
  require "rails-footnotes/notes/view_note"
3
3
 
4
4
  describe Footnotes::Notes::ViewNote do
5
-
6
5
  it "should not be valid if view file not exist" do
7
6
  note = Footnotes::Notes::ViewNote.new(double)
8
7
  allow(note).to receive(:filename).and_return(nil)
9
8
 
10
9
  expect(note).not_to be_valid
11
10
  end
11
+
12
+ it "should not explode if template is nil" do
13
+ Footnotes::Notes::ViewNote.template = nil
14
+
15
+ note = Footnotes::Notes::ViewNote.new(double)
16
+ expect(note).to_not be_valid
17
+ end
12
18
  end
data/spec/spec_helper.rb CHANGED
@@ -35,6 +35,7 @@ RSpec.configure do |config|
35
35
 
36
36
  config.include Capybara::DSL
37
37
  config.include Helpers
38
+ config.example_status_persistence_file_path = ".rspec_results"
38
39
 
39
40
  Rails.application.routes.draw do
40
41
  get 'footnotes/foo'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-footnotes
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.8
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman V. Babenko
@@ -9,83 +9,48 @@ authors:
9
9
  - Keenan Brock
10
10
  - Duane Johnson
11
11
  - Adrien Siami
12
- autorequire:
12
+ - André Arko
13
+ autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
- date: 2016-01-15 00:00:00.000000000 Z
16
+ date: 2023-11-29 00:00:00.000000000 Z
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency
18
19
  name: rails
19
- requirement: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: '3.2'
24
- type: :runtime
25
- prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- version: '3.2'
31
- - !ruby/object:Gem::Dependency
32
- name: rspec-rails
33
20
  requirement: !ruby/object:Gem::Requirement
34
21
  requirements:
35
22
  - - "~>"
36
23
  - !ruby/object:Gem::Version
37
- version: 3.3.2
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- requirements:
42
- - - "~>"
43
- - !ruby/object:Gem::Version
44
- version: 3.3.2
45
- - !ruby/object:Gem::Dependency
46
- name: sprockets-rails
47
- requirement: !ruby/object:Gem::Requirement
48
- requirements:
49
- - - "~>"
50
- - !ruby/object:Gem::Version
51
- version: '2.0'
52
- type: :development
24
+ version: '7.0'
25
+ type: :runtime
53
26
  prerelease: false
54
27
  version_requirements: !ruby/object:Gem::Requirement
55
28
  requirements:
56
29
  - - "~>"
57
30
  - !ruby/object:Gem::Version
58
- version: '2.0'
59
- - !ruby/object:Gem::Dependency
60
- name: capybara
61
- requirement: !ruby/object:Gem::Requirement
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- version: '0'
66
- type: :development
67
- prerelease: false
68
- version_requirements: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: '0'
31
+ version: '7.0'
73
32
  description: Every Rails page has footnotes that gives information about your application
74
33
  and links back to your editor.
75
34
  email:
76
- - romanvbabenko@gmail.com
35
+ - andre@arko.net
77
36
  executables: []
78
37
  extensions: []
79
38
  extra_rdoc_files: []
80
39
  files:
40
+ - ".github/dependabot.yml"
41
+ - ".github/workflows/ci.yml"
42
+ - ".github/workflows/merge-dependabot.yml"
81
43
  - ".gitignore"
82
44
  - ".rspec.example"
83
- - ".travis.yml"
45
+ - ".ruby-version"
84
46
  - CHANGELOG
85
47
  - Gemfile
48
+ - Gemfile.lock
86
49
  - MIT-LICENSE
87
50
  - README.rdoc
88
51
  - Rakefile
52
+ - bin/rake
53
+ - bin/rspec
89
54
  - gemfiles/Gemfile.rails-3.2.22
90
55
  - gemfiles/Gemfile.rails-4.0.x
91
56
  - gemfiles/Gemfile.rails-4.1.x
@@ -118,7 +83,9 @@ files:
118
83
  - lib/rails-footnotes/notes/view_note.rb
119
84
  - lib/rails-footnotes/version.rb
120
85
  - rails-footnotes.gemspec
86
+ - renovate.json
121
87
  - spec/abstract_note_spec.rb
88
+ - spec/app/assets/config/manifest.js
122
89
  - spec/app/assets/javascripts/foobar.js
123
90
  - spec/app/assets/stylesheets/foobar.css
124
91
  - spec/app/views/files/index.html.erb
@@ -139,10 +106,10 @@ files:
139
106
  - spec/notes/stylesheets_note_spec.rb
140
107
  - spec/notes/view_note_spec.rb
141
108
  - spec/spec_helper.rb
142
- homepage: http://github.com/josevalim/rails-footnotes
109
+ homepage: http://github.com/indirect/rails-footnotes
143
110
  licenses: []
144
111
  metadata: {}
145
- post_install_message:
112
+ post_install_message:
146
113
  rdoc_options: []
147
114
  require_paths:
148
115
  - lib
@@ -150,21 +117,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
150
117
  requirements:
151
118
  - - ">="
152
119
  - !ruby/object:Gem::Version
153
- version: '0'
120
+ version: '3.0'
154
121
  required_rubygems_version: !ruby/object:Gem::Requirement
155
122
  requirements:
156
123
  - - ">="
157
124
  - !ruby/object:Gem::Version
158
125
  version: '0'
159
126
  requirements: []
160
- rubyforge_project: rails-footnotes
161
- rubygems_version: 2.5.0
162
- signing_key:
127
+ rubygems_version: 3.4.10
128
+ signing_key:
163
129
  specification_version: 4
164
130
  summary: Every Rails page has footnotes that gives information about your application
165
131
  and links back to your editor.
166
132
  test_files:
167
133
  - spec/abstract_note_spec.rb
134
+ - spec/app/assets/config/manifest.js
168
135
  - spec/app/assets/javascripts/foobar.js
169
136
  - spec/app/assets/stylesheets/foobar.css
170
137
  - spec/app/views/files/index.html.erb
data/.travis.yml DELETED
@@ -1,25 +0,0 @@
1
- cache: bundler
2
- sudo: false
3
- script: "bundle exec rake"
4
- rvm:
5
- - 1.9.3
6
- - 2.0.0
7
- - 2.1.7
8
- - 2.2.3
9
- gemfile:
10
- - gemfiles/Gemfile.rails-3.2.22
11
- - gemfiles/Gemfile.rails-4.0.x
12
- - gemfiles/Gemfile.rails-4.1.x
13
- - gemfiles/Gemfile.rails-4.2.x
14
- - gemfiles/Gemfile.rails-edge
15
- matrix:
16
- allow_failures:
17
- - gemfile: gemfiles/Gemfile.rails-edge
18
- - gemfile: gemfiles/Gemfile.rails-3.2.22
19
- exclude:
20
- - rvm: 1.9.3
21
- gemfile: gemfiles/Gemfile.rails-edge
22
- - rvm: 2.0.0
23
- gemfile: gemfiles/Gemfile.rails-edge
24
- - rvm: 2.1.7
25
- gemfile: gemfiles/Gemfile.rails-edge