rack-gist 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.5
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'] = body.map { |part| Rack::Utils.bytesize(part) }.inject(0) { |sum, size| sum + size }.to_s
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='http://gist.github.com/stylesheets/gist/embed.css' />\n"
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
- $('.rack-gist').each(function() {
118
- var div = this;
119
- var url = '/gist.github.com/' + $(this).attr('gist-id');
120
- var file = false;
121
- if (file = $(this).attr('rack-gist-file')) {
122
- url += '/' + file;
123
- }
124
- $.ajax({
125
- url: url + '.js',
126
- dataType: 'script',
127
- cache: true
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rack-gist}
8
- s.version = "1.1.5"
8
+ s.version = "1.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Daniel Huckstep"]
@@ -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' => 'http://gist.github.com/stylesheets/gist/embed.css')
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 == '1165'
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, 'http://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, 'http://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')
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: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 5
10
- version: 1.1.5
9
+ - 6
10
+ version: 1.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Huckstep