rack-gist 1.1.5 → 1.1.6
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/VERSION +1 -1
- data/lib/rack/gist.rb +16 -13
- data/rack-gist.gemspec +1 -1
- data/spec/rack-gist_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.6
|
data/lib/rack/gist.rb
CHANGED
@@ -38,7 +38,7 @@ module Rack
|
|
38
38
|
end
|
39
39
|
end.to_html(:encoding => @options[:encoding])
|
40
40
|
body = [body]
|
41
|
-
headers['Content-Length'] =
|
41
|
+
headers['Content-Length'] = Rack::Utils.bytesize(body.first).to_s
|
42
42
|
end
|
43
43
|
[status, headers, body]
|
44
44
|
end
|
@@ -104,7 +104,7 @@ module Rack
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def css_html
|
107
|
-
"<link rel='stylesheet' href='
|
107
|
+
"<link rel='stylesheet' href='https://gist.github.com/stylesheets/gist/embed.css' />\n"
|
108
108
|
end
|
109
109
|
|
110
110
|
def jquery_link
|
@@ -114,19 +114,22 @@ module Rack
|
|
114
114
|
def jquery_helper
|
115
115
|
<<-EOJQ
|
116
116
|
<script type='text/javascript'>
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
117
|
+
//<![CDATA[
|
118
|
+
$(document).ready(function() {
|
119
|
+
$('.rack-gist').each(function() {
|
120
|
+
var url = '/gist.github.com/' + $(this).attr('gist-id');
|
121
|
+
var file = false;
|
122
|
+
if (file = $(this).attr('rack-gist-file')) {
|
123
|
+
url += '/' + file;
|
124
|
+
}
|
125
|
+
$.ajax({
|
126
|
+
url: url + '.js',
|
127
|
+
dataType: 'script',
|
128
|
+
cache: true
|
129
|
+
});
|
128
130
|
});
|
129
131
|
});
|
132
|
+
//]]>
|
130
133
|
</script>
|
131
134
|
EOJQ
|
132
135
|
end
|
data/rack-gist.gemspec
CHANGED
data/spec/rack-gist_spec.rb
CHANGED
@@ -74,7 +74,7 @@ describe "Rack::Gist" do
|
|
74
74
|
status, headers, body = a.call(mock_env('/multiple'))
|
75
75
|
status.should == 200
|
76
76
|
headers['Content-Type'].should == 'text/html'
|
77
|
-
pbody(body).should have_html_tag('link').with('rel' => 'stylesheet', 'href' => '
|
77
|
+
pbody(body).should have_html_tag('link').with('rel' => 'stylesheet', 'href' => 'https://gist.github.com/stylesheets/gist/embed.css')
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -119,7 +119,7 @@ describe "Rack::Gist" do
|
|
119
119
|
status, headers, body = a.call(mock_env)
|
120
120
|
status.should == 200
|
121
121
|
headers['Content-Type'].should == 'text/html'
|
122
|
-
headers['Content-Length'].should == '
|
122
|
+
headers['Content-Length'].should == '1136'
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
data/spec/spec_helper.rb
CHANGED
@@ -22,8 +22,8 @@ require 'fakeweb'
|
|
22
22
|
|
23
23
|
# Disallow web access
|
24
24
|
FakeWeb.allow_net_connect = false
|
25
|
-
FakeWeb.register_uri(:get, '
|
26
|
-
FakeWeb.register_uri(:get, '
|
25
|
+
FakeWeb.register_uri(:get, 'https://gist.github.com/348301.js', :body => File.read(File.join(File.dirname(__FILE__), 'full-gist.js')), :content_type => 'text/javascript; charset=utf-8')
|
26
|
+
FakeWeb.register_uri(:get, 'https://gist.github.com/348301.js?file=example.pig', :body => File.read(File.join(File.dirname(__FILE__), 'partial-gist.js')), :content_type => 'text/javascript; charset=utf-8')
|
27
27
|
|
28
28
|
Spec::Matchers.define :have_html_tag do |tag|
|
29
29
|
chain :count do |count|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-gist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 6
|
10
|
+
version: 1.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Huckstep
|