rack-jquery 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +8 -0
- data/lib/rack/jquery.rb +3 -11
- data/lib/rack/jquery/version.rb +1 -1
- data/rack-jquery.gemspec +1 -0
- metadata +18 -2
data/CHANGES.md
CHANGED
data/lib/rack/jquery.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
require "rack/jquery/version"
|
2
|
+
require "rack/jquery/helpers"
|
2
3
|
|
3
4
|
module Rack
|
4
5
|
|
5
6
|
# jQuery CDN script tags and fallback in one neat package.
|
6
7
|
class JQuery
|
8
|
+
include Helpers
|
7
9
|
|
8
10
|
JQUERY_FILE_NAME = "jquery-#{JQUERY_VERSION}.min.js"
|
9
11
|
|
@@ -25,10 +27,6 @@ module Rack
|
|
25
27
|
</script>
|
26
28
|
STR
|
27
29
|
|
28
|
-
|
29
|
-
# Ten years in seconds.
|
30
|
-
TEN_YEARS = 60 * 60 * 24 * 365 * 10
|
31
|
-
|
32
30
|
# @param [Symbol] organisation Choose which CDN to use, either :google, :microsoft or :media_temple
|
33
31
|
# @return [String] The HTML script tags to get the CDN.
|
34
32
|
def self.cdn( organisation=:google )
|
@@ -70,13 +68,7 @@ STR
|
|
70
68
|
if request.path_info == @http_path_to_jquery
|
71
69
|
response = Rack::Response.new
|
72
70
|
# for caching
|
73
|
-
response.headers.merge!(
|
74
|
-
"Last-Modified" => JQUERY_VERSION_DATE,
|
75
|
-
"Expires" => Rack::Utils.rfc2109(Time.now + TEN_YEARS),
|
76
|
-
"Cache-Control" => "max-age=#{TEN_YEARS},public",
|
77
|
-
"Etag" => "#{JQUERY_FILE_NAME}",
|
78
|
-
'Content-Type' =>'application/javascript; charset=utf-8'
|
79
|
-
})
|
71
|
+
response.headers.merge! caching_headers( JQUERY_FILE_NAME, JQUERY_VERSION_DATE)
|
80
72
|
|
81
73
|
# There's no need to test if the IF_MODIFIED_SINCE against the release date because the header will only be passed if the file was previously accessed by the requester, and the file is never updated. If it is updated then it is accessed by a different path.
|
82
74
|
if request.env['HTTP_IF_MODIFIED_SINCE']
|
data/lib/rack/jquery/version.rb
CHANGED
data/rack-jquery.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-jquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rack-jquery-helpers
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
62
78
|
description: jQuery CDN script tags and fallback in one neat package. Current version
|
63
79
|
is for jQuery v#{Rack::JQuery::JQUERY_VERSION}
|
64
80
|
email:
|