jquery-rails-google-cdn 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/jquery-rails-google-cdn.rb +29 -0
  3. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bdae152578eadc1a402bac7455f3d81a4fa15ba7
4
+ data.tar.gz: adcc466594ce94723b42abdac84653fcf3b079a7
5
+ SHA512:
6
+ metadata.gz: 364d7a6629881fee74a85f026a477fecd2c83ed4855d78dcfb03ff937380e4ae0ca19b76a97b94b1f1fb98a5e4e7362adf3e8015a7423bcfcb114e2be79009b0
7
+ data.tar.gz: 8edf1d222f9639808f019d1e52d7068f02365bd61780e3a48e7c99cb97da2fa995509474a6e1f3dd39ed6e048ec60146c99ea2ef42cc06fc3fbec8e57ee28d78
@@ -0,0 +1,29 @@
1
+ module Jquery::Rails::Google::Cdn
2
+ module ActionViewExtensions
3
+
4
+ OFFLINE = (Rails.env.development? or Rails.env.test?)
5
+ URL = {
6
+ :google_jquery => "//ajax.googleapis.com/ajax/libs/jquery/#{JQUERY_VERSION}/jquery.min.js"
7
+ }
8
+
9
+ def jquery_url(name)
10
+ URL[name]
11
+ end
12
+
13
+ def jquery_include_tag(name, options = {})
14
+ return javascript_include_tag(:jquery, options) if OFFLINE and !options.delete(:force)
15
+
16
+ [ javascript_include_tag(jquery_url(name), options),
17
+ javascript_tag("window.jQuery || document.write(unescape('#{javascript_include_tag(:jquery, options).gsub('<','%3C')}'))")
18
+ ].join("\n").html_safe
19
+ end
20
+ end
21
+
22
+ class Railtie < Rails::Railtie
23
+ initializer 'jquery-rails-google-cdn.action_view' do |app|
24
+ ActiveSupport.on_load(:action_view) do
25
+ include Jquery::Rails::Google::Cdn::ActionViewExtensions
26
+ end
27
+ end
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jquery-rails-google-cdn
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Chris Hough
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Use the Google CDN to serve jquery and fall back to the local version
14
+ if the CDN is unreachable.
15
+ email:
16
+ - founders@noconformity.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/jquery-rails-google-cdn.rb
22
+ homepage: https://github.com/chrishough/jquery-rails-google-cdn
23
+ licenses:
24
+ - GPL
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.0.0
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: A s to serve jQuery from the Google CDN with fall back protection.
46
+ test_files: []