rails6-footnotes 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ci.yml +25 -0
- data/.gitignore +15 -0
- data/.rspec.example +1 -0
- data/CHANGELOG +129 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +187 -0
- data/MIT-LICENSE +21 -0
- data/README.rdoc +188 -0
- data/Rakefile +18 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/gemfiles/Gemfile.rails-3.2.22 +5 -0
- data/gemfiles/Gemfile.rails-4.0.x +6 -0
- data/gemfiles/Gemfile.rails-4.1.x +5 -0
- data/gemfiles/Gemfile.rails-4.2.x +5 -0
- data/gemfiles/Gemfile.rails-edge +5 -0
- data/lib/generators/rails_footnotes/install_generator.rb +14 -0
- data/lib/generators/templates/rails_footnotes.rb +26 -0
- data/lib/rails-footnotes.rb +68 -0
- data/lib/rails-footnotes/abstract_note.rb +178 -0
- data/lib/rails-footnotes/each_with_rescue.rb +36 -0
- data/lib/rails-footnotes/extension.rb +24 -0
- data/lib/rails-footnotes/filter.rb +359 -0
- data/lib/rails-footnotes/notes/all.rb +1 -0
- data/lib/rails-footnotes/notes/assigns_note.rb +60 -0
- data/lib/rails-footnotes/notes/controller_note.rb +55 -0
- data/lib/rails-footnotes/notes/cookies_note.rb +17 -0
- data/lib/rails-footnotes/notes/env_note.rb +24 -0
- data/lib/rails-footnotes/notes/files_note.rb +49 -0
- data/lib/rails-footnotes/notes/filters_note.rb +51 -0
- data/lib/rails-footnotes/notes/javascripts_note.rb +16 -0
- data/lib/rails-footnotes/notes/layout_note.rb +26 -0
- data/lib/rails-footnotes/notes/log_note.rb +47 -0
- data/lib/rails-footnotes/notes/log_note/note_logger.rb +59 -0
- data/lib/rails-footnotes/notes/params_note.rb +21 -0
- data/lib/rails-footnotes/notes/partials_note.rb +38 -0
- data/lib/rails-footnotes/notes/queries_note.rb +121 -0
- data/lib/rails-footnotes/notes/routes_note.rb +60 -0
- data/lib/rails-footnotes/notes/session_note.rb +27 -0
- data/lib/rails-footnotes/notes/stylesheets_note.rb +16 -0
- data/lib/rails-footnotes/notes/view_note.rb +41 -0
- data/lib/rails-footnotes/version.rb +3 -0
- data/lib/rails6-footnotes.rb +1 -0
- data/rails-footnotes.gemspec +22 -0
- data/spec/abstract_note_spec.rb +89 -0
- data/spec/app/assets/config/manifest.js +2 -0
- data/spec/app/assets/javascripts/foobar.js +1 -0
- data/spec/app/assets/stylesheets/foobar.css +0 -0
- data/spec/app/views/files/index.html.erb +1 -0
- data/spec/app/views/layouts/application.html.erb +12 -0
- data/spec/app/views/partials/_foo.html.erb +1 -0
- data/spec/app/views/partials/index.html.erb +1 -0
- data/spec/controllers/files_note_controller_spec.rb +38 -0
- data/spec/controllers/footnotes_controller_spec.rb +128 -0
- data/spec/controllers/log_note_controller_spec.rb +32 -0
- data/spec/controllers/partials_note_controller_spec.rb +28 -0
- data/spec/env_note_spec.rb +73 -0
- data/spec/fixtures/html_download.html +5 -0
- data/spec/footnotes_spec.rb +234 -0
- data/spec/notes/assigns_note_spec.rb +50 -0
- data/spec/notes/controller_note_spec.rb +12 -0
- data/spec/notes/files_note_spec.rb +26 -0
- data/spec/notes/javascripts_note_spec.rb +18 -0
- data/spec/notes/stylesheets_note_spec.rb +19 -0
- data/spec/notes/view_note_spec.rb +12 -0
- data/spec/spec_helper.rb +68 -0
- metadata +153 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require "rails-footnotes/notes/javascripts_note"
|
3
|
+
|
4
|
+
describe Footnotes::Notes::JavascriptsNote do
|
5
|
+
let(:note) {described_class.new(double('controller', :response => double('body', :body => '')))}
|
6
|
+
subject {note}
|
7
|
+
|
8
|
+
it {should be_valid}
|
9
|
+
|
10
|
+
it "should return js links from html after #scan_text mehtod call" do
|
11
|
+
expect(subject.send(:scan_text, HTML_WITH_JS)).to eql ['/javascripts/all.js', '/javascripts/jquery.js']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
HTML_WITH_JS = <<-EOF
|
16
|
+
<script cache="false" src="/javascripts/all.js?1315913920" type="text/javascript"></script>
|
17
|
+
<script cache="false" src="/javascripts/jquery.js?1315913920" type="text/javascript"></script>
|
18
|
+
EOF
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require "rails-footnotes/notes/stylesheets_note"
|
3
|
+
|
4
|
+
describe Footnotes::Notes::StylesheetsNote do
|
5
|
+
|
6
|
+
let(:note) {described_class.new(double('controller', :response => double('body', :body => '')))}
|
7
|
+
subject {note}
|
8
|
+
|
9
|
+
it {should be_valid}
|
10
|
+
|
11
|
+
it "should return css link from html text after #scan_text call" do
|
12
|
+
expect(subject.send(:scan_text, HTML_WITH_CSS)).to eql ['/stylesheets/compiled/print.css', '/stylesheets/compiled/print.css']
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
HTML_WITH_CSS = <<-EOF
|
17
|
+
<link href="/stylesheets/compiled/print.css?1315913920" media="print" rel="stylesheet" type="text/css" />'
|
18
|
+
'<link href="/stylesheets/compiled/print.css?1315913920" media="print" rel="stylesheet" type="text/css" />'
|
19
|
+
EOF
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "rails-footnotes/notes/view_note"
|
3
|
+
|
4
|
+
describe Footnotes::Notes::ViewNote do
|
5
|
+
|
6
|
+
it "should not be valid if view file not exist" do
|
7
|
+
note = Footnotes::Notes::ViewNote.new(double)
|
8
|
+
allow(note).to receive(:filename).and_return(nil)
|
9
|
+
|
10
|
+
expect(note).not_to be_valid
|
11
|
+
end
|
12
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
begin
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start
|
4
|
+
rescue LoadError
|
5
|
+
end
|
6
|
+
ENV["RAILS_ENV"] ||= 'test'
|
7
|
+
require "sprockets/railtie"
|
8
|
+
require "rails-footnotes"
|
9
|
+
require 'capybara/rspec'
|
10
|
+
|
11
|
+
module FooBar
|
12
|
+
class Application < Rails::Application
|
13
|
+
config.secret_key_base = 'foobar'
|
14
|
+
config.root = Dir.new('./spec')
|
15
|
+
config.eager_load = false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
ActionController::Base.class_eval do
|
20
|
+
include Rails.application.routes.url_helpers
|
21
|
+
end
|
22
|
+
|
23
|
+
class ApplicationController < ActionController::Base
|
24
|
+
end
|
25
|
+
|
26
|
+
module Helpers
|
27
|
+
def page
|
28
|
+
Capybara::Node::Simple.new(response.body)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
RSpec.configure do |config|
|
33
|
+
|
34
|
+
Rails.application.initialize!
|
35
|
+
|
36
|
+
config.include Capybara::DSL
|
37
|
+
config.include Helpers
|
38
|
+
config.example_status_persistence_file_path = ".rspec_results"
|
39
|
+
|
40
|
+
Rails.application.routes.draw do
|
41
|
+
get 'footnotes/foo'
|
42
|
+
get 'footnotes/foo_holder'
|
43
|
+
get 'footnotes/foo_js'
|
44
|
+
get 'footnotes/foo_download'
|
45
|
+
get 'partials/index'
|
46
|
+
get 'files/index'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
require 'rspec/rails'
|
51
|
+
require 'capybara/rails'
|
52
|
+
|
53
|
+
HTML_DOCUMENT = <<EOF
|
54
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
55
|
+
<html>
|
56
|
+
<head>
|
57
|
+
<title>HTML to XHTML Example: HTML page</title>
|
58
|
+
<link rel="Stylesheet" href="htmltohxhtml.css" type="text/css" media="screen">
|
59
|
+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
60
|
+
</head>
|
61
|
+
<body>
|
62
|
+
<p>This is the HTML page. It works and is encoded just like any HTML page you
|
63
|
+
have previously done. View <a href="htmltoxhtml2.htm">the XHTML version</a> of
|
64
|
+
this page to view the difference between HTML and XHTML.</p>
|
65
|
+
<p>You will be glad to know that no changes need to be made to any of your CSS files.</p>
|
66
|
+
</body>
|
67
|
+
</html>
|
68
|
+
EOF
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails6-footnotes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 5.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roman V. Babenko
|
8
|
+
- José Valim
|
9
|
+
- Keenan Brock
|
10
|
+
- Duane Johnson
|
11
|
+
- Adrien Siami
|
12
|
+
- André Arko
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
date: 2021-08-20 00:00:00.000000000 Z
|
17
|
+
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
19
|
+
name: rails
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - "~>"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '6.0'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - "~>"
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '6.0'
|
32
|
+
description: Every Rails page has footnotes that gives information about your application
|
33
|
+
and links back to your editor.
|
34
|
+
email:
|
35
|
+
- andre@arko.net
|
36
|
+
executables:
|
37
|
+
- rake
|
38
|
+
- rspec
|
39
|
+
extensions: []
|
40
|
+
extra_rdoc_files: []
|
41
|
+
files:
|
42
|
+
- ".github/workflows/ci.yml"
|
43
|
+
- ".gitignore"
|
44
|
+
- ".rspec.example"
|
45
|
+
- CHANGELOG
|
46
|
+
- Gemfile
|
47
|
+
- Gemfile.lock
|
48
|
+
- MIT-LICENSE
|
49
|
+
- README.rdoc
|
50
|
+
- Rakefile
|
51
|
+
- bin/rake
|
52
|
+
- bin/rspec
|
53
|
+
- gemfiles/Gemfile.rails-3.2.22
|
54
|
+
- gemfiles/Gemfile.rails-4.0.x
|
55
|
+
- gemfiles/Gemfile.rails-4.1.x
|
56
|
+
- gemfiles/Gemfile.rails-4.2.x
|
57
|
+
- gemfiles/Gemfile.rails-edge
|
58
|
+
- lib/generators/rails_footnotes/install_generator.rb
|
59
|
+
- lib/generators/templates/rails_footnotes.rb
|
60
|
+
- lib/rails-footnotes.rb
|
61
|
+
- lib/rails-footnotes/abstract_note.rb
|
62
|
+
- lib/rails-footnotes/each_with_rescue.rb
|
63
|
+
- lib/rails-footnotes/extension.rb
|
64
|
+
- lib/rails-footnotes/filter.rb
|
65
|
+
- lib/rails-footnotes/notes/all.rb
|
66
|
+
- lib/rails-footnotes/notes/assigns_note.rb
|
67
|
+
- lib/rails-footnotes/notes/controller_note.rb
|
68
|
+
- lib/rails-footnotes/notes/cookies_note.rb
|
69
|
+
- lib/rails-footnotes/notes/env_note.rb
|
70
|
+
- lib/rails-footnotes/notes/files_note.rb
|
71
|
+
- lib/rails-footnotes/notes/filters_note.rb
|
72
|
+
- lib/rails-footnotes/notes/javascripts_note.rb
|
73
|
+
- lib/rails-footnotes/notes/layout_note.rb
|
74
|
+
- lib/rails-footnotes/notes/log_note.rb
|
75
|
+
- lib/rails-footnotes/notes/log_note/note_logger.rb
|
76
|
+
- lib/rails-footnotes/notes/params_note.rb
|
77
|
+
- lib/rails-footnotes/notes/partials_note.rb
|
78
|
+
- lib/rails-footnotes/notes/queries_note.rb
|
79
|
+
- lib/rails-footnotes/notes/routes_note.rb
|
80
|
+
- lib/rails-footnotes/notes/session_note.rb
|
81
|
+
- lib/rails-footnotes/notes/stylesheets_note.rb
|
82
|
+
- lib/rails-footnotes/notes/view_note.rb
|
83
|
+
- lib/rails-footnotes/version.rb
|
84
|
+
- lib/rails6-footnotes.rb
|
85
|
+
- rails-footnotes.gemspec
|
86
|
+
- spec/abstract_note_spec.rb
|
87
|
+
- spec/app/assets/config/manifest.js
|
88
|
+
- spec/app/assets/javascripts/foobar.js
|
89
|
+
- spec/app/assets/stylesheets/foobar.css
|
90
|
+
- spec/app/views/files/index.html.erb
|
91
|
+
- spec/app/views/layouts/application.html.erb
|
92
|
+
- spec/app/views/partials/_foo.html.erb
|
93
|
+
- spec/app/views/partials/index.html.erb
|
94
|
+
- spec/controllers/files_note_controller_spec.rb
|
95
|
+
- spec/controllers/footnotes_controller_spec.rb
|
96
|
+
- spec/controllers/log_note_controller_spec.rb
|
97
|
+
- spec/controllers/partials_note_controller_spec.rb
|
98
|
+
- spec/env_note_spec.rb
|
99
|
+
- spec/fixtures/html_download.html
|
100
|
+
- spec/footnotes_spec.rb
|
101
|
+
- spec/notes/assigns_note_spec.rb
|
102
|
+
- spec/notes/controller_note_spec.rb
|
103
|
+
- spec/notes/files_note_spec.rb
|
104
|
+
- spec/notes/javascripts_note_spec.rb
|
105
|
+
- spec/notes/stylesheets_note_spec.rb
|
106
|
+
- spec/notes/view_note_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
homepage: http://github.com/indirect/rails-footnotes
|
109
|
+
licenses: []
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '3.0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubygems_version: 3.2.23
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: Every Rails page has footnotes that gives information about your application
|
130
|
+
and links back to your editor.
|
131
|
+
test_files:
|
132
|
+
- spec/abstract_note_spec.rb
|
133
|
+
- spec/app/assets/config/manifest.js
|
134
|
+
- spec/app/assets/javascripts/foobar.js
|
135
|
+
- spec/app/assets/stylesheets/foobar.css
|
136
|
+
- spec/app/views/files/index.html.erb
|
137
|
+
- spec/app/views/layouts/application.html.erb
|
138
|
+
- spec/app/views/partials/_foo.html.erb
|
139
|
+
- spec/app/views/partials/index.html.erb
|
140
|
+
- spec/controllers/files_note_controller_spec.rb
|
141
|
+
- spec/controllers/footnotes_controller_spec.rb
|
142
|
+
- spec/controllers/log_note_controller_spec.rb
|
143
|
+
- spec/controllers/partials_note_controller_spec.rb
|
144
|
+
- spec/env_note_spec.rb
|
145
|
+
- spec/fixtures/html_download.html
|
146
|
+
- spec/footnotes_spec.rb
|
147
|
+
- spec/notes/assigns_note_spec.rb
|
148
|
+
- spec/notes/controller_note_spec.rb
|
149
|
+
- spec/notes/files_note_spec.rb
|
150
|
+
- spec/notes/javascripts_note_spec.rb
|
151
|
+
- spec/notes/stylesheets_note_spec.rb
|
152
|
+
- spec/notes/view_note_spec.rb
|
153
|
+
- spec/spec_helper.rb
|