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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68e7f5a193a1fcb2121ca09bc5cc503a4b7ac0df
4
- data.tar.gz: fa86d5cb4a923074eddafde6391723311eba6b90
3
+ metadata.gz: 47b4c96824eb32e59653dcaf81badc57fa20321b
4
+ data.tar.gz: a8bea6b8f297b6118a5dd5ff6197f0e7d464ef68
5
5
  SHA512:
6
- metadata.gz: 69089ac7a508f5872de83feb987544645fbc3a9c121efaa27b718613671b8ef56ede977059e0152c4bbe55968b662649609da2fc0cdc8b8dd90f099bcfe5122f
7
- data.tar.gz: e7d94a630c774cbcfbfc38925dfb0e21843abff11ca94f7eeac61228a9ca519c256ed33b6bd4a61251ee587d5e8212f18d65df5293f1b870b8744aff06f9aab6
6
+ metadata.gz: 9c4c0f9e558e28aae71de62b3822e11e6b29a17828fa78979952ffa3a8131233f0f232ddb2da271652d70b98fc14f2bfb1a6036e793fe34430375ae49990a644
7
+ data.tar.gz: 3dd66effb9cf75a5477113a21a6cba16d1978452d41954863e0e25a769ec975fdf20e449efe95c42c93bf4c6bf1bc1d17f06082c3c7e461c84df85d144a9efb2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ === 3.0.1 (2016.10.24)
2
+
3
+ * helper functions now have `absolute` attribute to be compatible with `Sinatra::uri` function
4
+
1
5
  === 3.0.0 (2016.10.06)
2
6
 
3
7
  * use minitest instead of rspec
@@ -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
- return File.join(cdn_url, relative_url) unless cdn_url.nil?
52
- relative_url
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
@@ -18,5 +18,5 @@
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
20
  module SinatraAssetsLinker
21
- VERSION = "3.0.0".freeze
21
+ VERSION = "3.0.1".freeze
22
22
  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.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-06 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra