rails-cdn-helper 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/README.md +48 -0
- data/Rakefile +6 -0
- data/VERSION +1 -0
- data/app/helpers/cdn_helper.rb +10 -0
- data/lib/rails-cdn-helper.rb +2 -0
- data/lib/rails-cdn-helper/rails.rb +11 -0
- data/rails-cdn-helper.gemspec +20 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 784f10f6a822ab8425807ba14a8707b3d9dad73c
|
4
|
+
data.tar.gz: e49e4653220c7f1fb4d0f86da0f09f31c25d4be0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 731d87c9cbb04af85ddcca58032261a889de49d5f598c699e0b5b11bcbd77926f55d295185070c6095f11478f3c1623dff041f9920f418bfc22e697524dd2d2d
|
7
|
+
data.tar.gz: 0e400695d0051e8ac95af382ea966e3c823e2c0660ff03f096ba083c2c24422b52311a13e756793296d22ef7d8fa9b7756f629aed1f63347b805f6dc2d624ae9
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Rails CDN Helper
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
The gem is a CDN helper for Rails. The default CDN service is `https://cdnjs.com/`.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
1. Put this into your Gemfile
|
10
|
+
|
11
|
+
``` ruby
|
12
|
+
gem 'rails-cdn-helper'
|
13
|
+
```
|
14
|
+
|
15
|
+
and run ``bundle install``.
|
16
|
+
|
17
|
+
2. Start your rails application.
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
In the layout head add this code
|
22
|
+
|
23
|
+
``` erb
|
24
|
+
<%= cdn_css 'font-awesome/4.7.0/css/font-awesome.min.css' %>
|
25
|
+
```
|
26
|
+
|
27
|
+
and output as below:
|
28
|
+
|
29
|
+
``` html
|
30
|
+
<link rel="stylesheet" media="screen" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
31
|
+
```
|
32
|
+
|
33
|
+
## Overwrite CDN uri
|
34
|
+
|
35
|
+
1. Create `config/cdn.yml`
|
36
|
+
|
37
|
+
2. Add content as below:
|
38
|
+
|
39
|
+
``` yml
|
40
|
+
development:
|
41
|
+
uri: https://CDN_DOMAIN_NAME/
|
42
|
+
test:
|
43
|
+
uri: https://CDN_DOMAIN_NAME/
|
44
|
+
production:
|
45
|
+
uri: https://CDN_DOMAIN_NAME/
|
46
|
+
```
|
47
|
+
|
48
|
+
3. Restart your rails application.
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module RailsCdnHelper
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
|
4
|
+
config.before_configuration do |app|
|
5
|
+
app.configure do
|
6
|
+
cdn_uri = config_for(:cdn).deep_symbolize_keys[:uri] rescue nil
|
7
|
+
config.cdn_uri = cdn_uri || 'https://cdnjs.cloudflare.com/ajax/libs/'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.platform = Gem::Platform::RUBY
|
5
|
+
s.name = 'rails-cdn-helper'
|
6
|
+
s.version = version
|
7
|
+
s.summary = 'CDN helper for Rails'
|
8
|
+
s.description = 'It is a CDN helper for Rails.'
|
9
|
+
s.licenses = ['Nonstandard']
|
10
|
+
s.authors = ['ChouAndy']
|
11
|
+
s.email = ['chouandy625@gmail.com']
|
12
|
+
s.homepage = 'https://github.com/chouandy/rails-cdn-helper'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.require_paths = ['lib']
|
16
|
+
|
17
|
+
s.required_ruby_version = '>= 1.9.3'
|
18
|
+
|
19
|
+
s.add_dependency 'rails', '>= 4.2'
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-cdn-helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ChouAndy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-07-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.2'
|
27
|
+
description: It is a CDN helper for Rails.
|
28
|
+
email:
|
29
|
+
- chouandy625@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- ".rspec"
|
36
|
+
- Gemfile
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- VERSION
|
40
|
+
- app/helpers/cdn_helper.rb
|
41
|
+
- lib/rails-cdn-helper.rb
|
42
|
+
- lib/rails-cdn-helper/rails.rb
|
43
|
+
- rails-cdn-helper.gemspec
|
44
|
+
homepage: https://github.com/chouandy/rails-cdn-helper
|
45
|
+
licenses:
|
46
|
+
- Nonstandard
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.9.3
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.6.8
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: CDN helper for Rails
|
68
|
+
test_files: []
|