sinatra-assets_linker 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sinatra/assets_linker.rb +14 -11
- data/lib/sinatra-assets_linker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47b4c96824eb32e59653dcaf81badc57fa20321b
|
4
|
+
data.tar.gz: a8bea6b8f297b6118a5dd5ff6197f0e7d464ef68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c4c0f9e558e28aae71de62b3822e11e6b29a17828fa78979952ffa3a8131233f0f232ddb2da271652d70b98fc14f2bfb1a6036e793fe34430375ae49990a644
|
7
|
+
data.tar.gz: 3dd66effb9cf75a5477113a21a6cba16d1978452d41954863e0e25a769ec975fdf20e449efe95c42c93bf4c6bf1bc1d17f06082c3c7e461c84df85d144a9efb2
|
data/CHANGELOG.md
CHANGED
@@ -21,21 +21,21 @@ require "sinatra/base"
|
|
21
21
|
|
22
22
|
module Sinatra
|
23
23
|
module AssetsLinker
|
24
|
-
def css_uri(file_name, add_script_name = true)
|
24
|
+
def css_uri(file_name, absolute = true, add_script_name = true)
|
25
25
|
css_dir = get_settings(:project_css_dir)
|
26
|
-
generate_uri(css_dir, file_name, add_script_name)
|
26
|
+
generate_uri(css_dir, file_name, absolute, add_script_name)
|
27
27
|
end
|
28
28
|
|
29
|
-
def js_uri(file_name, add_script_name = true)
|
29
|
+
def js_uri(file_name, absolute = true, add_script_name = true)
|
30
30
|
javascript_dir = get_settings(:project_javascripts_dir)
|
31
31
|
js_dir = get_settings(:project_js_compressed_dir)
|
32
32
|
choosen_dir = get_settings(:project_assets_verbose) ? javascript_dir : js_dir
|
33
|
-
generate_uri(choosen_dir, file_name, add_script_name)
|
33
|
+
generate_uri(choosen_dir, file_name, absolute, add_script_name)
|
34
34
|
end
|
35
35
|
|
36
|
-
def img_uri(file_name, add_script_name = true)
|
36
|
+
def img_uri(file_name, absolute = true, add_script_name = true)
|
37
37
|
img_dir = get_settings(:project_images_dir)
|
38
|
-
generate_uri(img_dir, file_name, add_script_name)
|
38
|
+
generate_uri(img_dir, file_name, absolute, add_script_name)
|
39
39
|
end
|
40
40
|
|
41
41
|
private
|
@@ -44,12 +44,15 @@ module Sinatra
|
|
44
44
|
settings.assets_linker_config.fetch(key.to_s)
|
45
45
|
end
|
46
46
|
|
47
|
-
def generate_uri(assets_dir, file_name, add_script_name)
|
48
|
-
absolute_path = false
|
49
|
-
relative_url = uri(File.join(assets_dir, file_name), absolute_path, add_script_name)
|
47
|
+
def generate_uri(assets_dir, file_name, absolute, add_script_name)
|
50
48
|
cdn_url = get_settings(:project_cdn_url)
|
51
|
-
|
52
|
-
|
49
|
+
relative_url = File.join(assets_dir, file_name)
|
50
|
+
if cdn_url.nil? || cdn_url == ""
|
51
|
+
uri(relative_url, absolute, add_script_name)
|
52
|
+
else
|
53
|
+
uri(relative_url, false, add_script_name)
|
54
|
+
File.join(cdn_url, relative_url)
|
55
|
+
end
|
53
56
|
end
|
54
57
|
end
|
55
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-assets_linker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Szymon Kopciewski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|