rails-footnotes 4.1.5 → 4.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG +2 -0
- data/lib/rails-footnotes/notes/files_note.rb +10 -22
- data/lib/rails-footnotes/version.rb +1 -1
- data/rails-footnotes.gemspec +1 -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 +0 -0
- data/spec/app/views/layouts/application.html.erb +12 -0
- data/spec/{views → app/views}/partials/_foo.html.erb +0 -0
- data/spec/{views → app/views}/partials/index.html.erb +0 -0
- data/spec/controllers/files_note_controller_spec.rb +44 -0
- data/spec/controllers/footnotes_controller_spec.rb +2 -2
- data/spec/controllers/log_note_controller_spec.rb +4 -4
- data/spec/controllers/partials_note_controller_spec.rb +0 -1
- data/spec/notes/files_note_spec.rb +0 -1
- data/spec/spec_helper.rb +7 -1
- metadata +30 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c57242b5f541d4d6722be87fcb7aaee885065388
|
4
|
+
data.tar.gz: 804664dc9f668fe41bf3cd4c0a3e05a72cf4bb2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f6e3da7e078c14fd7d4115d250a871c74e75319a4aa47373ebae0cbc3e0094770c24fac5b7ddac183df83eb5a73bcddd93037c09af387a91cc5d4403a1f5b32
|
7
|
+
data.tar.gz: cc4644cb39a8336493649916a3d412f03eb42ff8f8b703f88e29bbd2f6720f0e9a75e6df292a20ce5bddecd4b09a4c7b1a833b4dda4f864b57c5c8e906632510
|
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -28,32 +28,20 @@ module Footnotes
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def parse_files!
|
31
|
-
|
32
|
-
|
33
|
-
linked_files = []
|
31
|
+
asset_paths = Rails.application.config.assets.paths
|
32
|
+
linked_files = []
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
break if results.present?
|
43
|
-
end
|
44
|
-
end
|
45
|
-
@files = linked_files
|
46
|
-
else
|
47
|
-
#Original Implementation
|
48
|
-
@files.collect! do |filename|
|
49
|
-
if filename =~ %r{^/}
|
50
|
-
full_filename = File.join(File.expand_path(Rails.root), 'public', filename)
|
51
|
-
%[<a href="#{Footnotes::Filter.prefix(full_filename, 1, 1)}">#{filename}</a>]
|
52
|
-
else
|
53
|
-
%[<a href="#{filename}">#{filename}</a>]
|
34
|
+
@files.collect do |file|
|
35
|
+
base_name = File.basename(file)
|
36
|
+
asset_paths.each do |asset_path|
|
37
|
+
results = Dir[File.expand_path(base_name, asset_path) + '*']
|
38
|
+
results.each do |r|
|
39
|
+
linked_files << %[<a href="#{Footnotes::Filter.prefix(r, 1, 1)}">#{File.basename(r)}</a>]
|
54
40
|
end
|
41
|
+
break if results.present?
|
55
42
|
end
|
56
43
|
end
|
44
|
+
@files = linked_files
|
57
45
|
end
|
58
46
|
end
|
59
47
|
end
|
data/rails-footnotes.gemspec
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
// Foobar
|
File without changes
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<%= javascript_include_tag 'foobar' %>
|
5
|
+
<%= javascript_include_tag 'http://google.com/whatever.js' %>
|
6
|
+
<%= stylesheet_link_tag 'foobar' %>
|
7
|
+
<%= stylesheet_link_tag 'http://google.com/whatever.css' %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<%= yield %>
|
11
|
+
</body>
|
12
|
+
</html>
|
File without changes
|
File without changes
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class FilesController < ApplicationController
|
4
|
+
|
5
|
+
def index
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe FilesController do
|
10
|
+
|
11
|
+
render_views
|
12
|
+
include Capybara::DSL
|
13
|
+
|
14
|
+
def page
|
15
|
+
Capybara::Node::Simple.new(response.body)
|
16
|
+
end
|
17
|
+
|
18
|
+
before :all do
|
19
|
+
Footnotes.enabled = true
|
20
|
+
end
|
21
|
+
|
22
|
+
after :all do
|
23
|
+
Footnotes.enabled = false
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'includes stylesheets assets in the response' do
|
27
|
+
get :index
|
28
|
+
js_debug = first('fieldset#javascripts_debug_info div', visible: false)
|
29
|
+
expect(js_debug).to have_selector('li a', visible: false, count: 1)
|
30
|
+
expect(js_debug).to have_selector('li a', text: /foobar\.js/, visible: false)
|
31
|
+
link = js_debug.first('a', visible: false)
|
32
|
+
expect(link['href']).to eq("txmt://open?url=file://#{Rails.root.join('app', 'assets', 'javascripts', 'foobar.js')}&line=1&column=1")
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'includes css assets in the response' do
|
36
|
+
get :index
|
37
|
+
css_debug = first('fieldset#stylesheets_debug_info div', visible: false)
|
38
|
+
expect(css_debug).to have_selector('li a', visible: false, count: 1)
|
39
|
+
expect(css_debug).to have_selector('li a', text: /foobar\.css/, visible: false)
|
40
|
+
link = css_debug.first('a', visible: false)
|
41
|
+
expect(link['href']).to eq("txmt://open?url=file://#{Rails.root.join('app', 'assets', 'stylesheets', 'foobar.css')}&line=1&column=1")
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -15,7 +15,7 @@ class FootnotesController < ActionController::Base
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def foo_download
|
18
|
-
send_file Rails.root.join('
|
18
|
+
send_file Rails.root.join('fixtures', 'html_download.html'), :disposition => 'attachment'
|
19
19
|
end
|
20
20
|
|
21
21
|
end
|
@@ -72,7 +72,7 @@ describe FootnotesController do
|
|
72
72
|
|
73
73
|
it 'does not alter a html file download' do
|
74
74
|
get :foo_download
|
75
|
-
response.body.should == File.open(Rails.root.join('
|
75
|
+
response.body.should == File.open(Rails.root.join('fixtures', 'html_download.html')).read
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -3,6 +3,10 @@ require 'stringio'
|
|
3
3
|
|
4
4
|
describe 'log note' do
|
5
5
|
|
6
|
+
def page
|
7
|
+
Capybara::Node::Simple.new(response.body)
|
8
|
+
end
|
9
|
+
|
6
10
|
class ApplicationController < ActionController::Base
|
7
11
|
end
|
8
12
|
|
@@ -14,10 +18,6 @@ describe 'log note' do
|
|
14
18
|
end
|
15
19
|
end
|
16
20
|
|
17
|
-
def page
|
18
|
-
Capybara::Node::Simple.new(response.body)
|
19
|
-
end
|
20
|
-
|
21
21
|
before :all do
|
22
22
|
Footnotes.enabled = true
|
23
23
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,12 +4,14 @@ begin
|
|
4
4
|
rescue LoadError
|
5
5
|
end
|
6
6
|
ENV["RAILS_ENV"] ||= 'test'
|
7
|
+
require "sprockets/railtie"
|
7
8
|
require "rails-footnotes"
|
8
9
|
|
9
10
|
module FooBar
|
10
11
|
class Application < Rails::Application
|
11
12
|
config.secret_key_base = 'foobar'
|
12
|
-
config.root = Dir.new('
|
13
|
+
config.root = Dir.new('./spec')
|
14
|
+
config.eager_load = false
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
@@ -17,6 +19,9 @@ ActionController::Base.class_eval do
|
|
17
19
|
include Rails.application.routes.url_helpers
|
18
20
|
end
|
19
21
|
|
22
|
+
class ApplicationController < ActionController::Base
|
23
|
+
end
|
24
|
+
|
20
25
|
RSpec.configure do |config|
|
21
26
|
|
22
27
|
Rails.application.initialize!
|
@@ -27,6 +32,7 @@ RSpec.configure do |config|
|
|
27
32
|
get 'footnotes/foo_js'
|
28
33
|
get 'footnotes/foo_download'
|
29
34
|
get 'partials/index'
|
35
|
+
get 'files/index'
|
30
36
|
end
|
31
37
|
|
32
38
|
end
|
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.
|
4
|
+
version: 4.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman V. Babenko
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-02
|
15
|
+
date: 2015-03-02 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
@@ -42,6 +42,20 @@ dependencies:
|
|
42
42
|
- - "~>"
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: 2.14.0
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: test-unit
|
47
|
+
requirement: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
type: :development
|
53
|
+
prerelease: false
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
45
59
|
- !ruby/object:Gem::Dependency
|
46
60
|
name: capybara
|
47
61
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,6 +119,13 @@ files:
|
|
105
119
|
- lib/rails-footnotes/version.rb
|
106
120
|
- rails-footnotes.gemspec
|
107
121
|
- spec/abstract_note_spec.rb
|
122
|
+
- spec/app/assets/javascripts/foobar.js
|
123
|
+
- spec/app/assets/stylesheets/foobar.css
|
124
|
+
- spec/app/views/files/index.html.erb
|
125
|
+
- spec/app/views/layouts/application.html.erb
|
126
|
+
- spec/app/views/partials/_foo.html.erb
|
127
|
+
- spec/app/views/partials/index.html.erb
|
128
|
+
- spec/controllers/files_note_controller_spec.rb
|
108
129
|
- spec/controllers/footnotes_controller_spec.rb
|
109
130
|
- spec/controllers/log_note_controller_spec.rb
|
110
131
|
- spec/controllers/partials_note_controller_spec.rb
|
@@ -117,8 +138,6 @@ files:
|
|
117
138
|
- spec/notes/javascripts_note_spec.rb
|
118
139
|
- spec/notes/stylesheets_note_spec.rb
|
119
140
|
- spec/spec_helper.rb
|
120
|
-
- spec/views/partials/_foo.html.erb
|
121
|
-
- spec/views/partials/index.html.erb
|
122
141
|
homepage: http://github.com/josevalim/rails-footnotes
|
123
142
|
licenses: []
|
124
143
|
metadata: {}
|
@@ -145,6 +164,13 @@ summary: Every Rails page has footnotes that gives information about your applic
|
|
145
164
|
and links back to your editor.
|
146
165
|
test_files:
|
147
166
|
- spec/abstract_note_spec.rb
|
167
|
+
- spec/app/assets/javascripts/foobar.js
|
168
|
+
- spec/app/assets/stylesheets/foobar.css
|
169
|
+
- spec/app/views/files/index.html.erb
|
170
|
+
- spec/app/views/layouts/application.html.erb
|
171
|
+
- spec/app/views/partials/_foo.html.erb
|
172
|
+
- spec/app/views/partials/index.html.erb
|
173
|
+
- spec/controllers/files_note_controller_spec.rb
|
148
174
|
- spec/controllers/footnotes_controller_spec.rb
|
149
175
|
- spec/controllers/log_note_controller_spec.rb
|
150
176
|
- spec/controllers/partials_note_controller_spec.rb
|
@@ -157,5 +183,3 @@ test_files:
|
|
157
183
|
- spec/notes/javascripts_note_spec.rb
|
158
184
|
- spec/notes/stylesheets_note_spec.rb
|
159
185
|
- spec/spec_helper.rb
|
160
|
-
- spec/views/partials/_foo.html.erb
|
161
|
-
- spec/views/partials/index.html.erb
|