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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # CH CH CH CHANGES #
2
2
 
3
+ ## v1.0.3 ##
4
+
5
+ Friday the 8th of March 2013
6
+
7
+ * Using shared rack-jquery-helpers library to cut down on duplication.
8
+
9
+ ----
10
+
3
11
  ## v1.0.2 ##
4
12
 
5
13
  Tuesday the 5th of March 2013
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']
@@ -1,6 +1,6 @@
1
1
  module Rack
2
2
  class JQuery
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  JQUERY_VERSION = "1.9.1"
5
5
 
6
6
  # This is the release date of the jQuery file, it makes an easy "Last-Modified" date for setting the headers around caching.
data/rack-jquery.gemspec CHANGED
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.2"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_dependency("rack")
24
+ spec.add_dependency("rack-jquery-helpers")
24
25
  end
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.2
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-05 00:00:00.000000000 Z
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: