sinatra-asset_helpers 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sinatra/asset_helpers.rb +6 -4
- data/lib/sinatra/asset_helpers/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: 4e502f5888642e5644cae4fdc1e6ab252363ab99
|
4
|
+
data.tar.gz: a90cbc5451fad72ac6ce9c1f7d15adcde09dd5aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c47c189cd7c7a2bf6970379a4200565ae0e5b903007bb00486f9da16714eea55fb33413f5fd45106a74948c453248779b95bdd1eb32b9cba9d848effea6a517f
|
7
|
+
data.tar.gz: 84abe8789c4d0a75299c68f8d78e402b3e207e4926179103218be093304abd9572a6d5a26f548d4ab531faec2774ae243e2376a4812eda93e6f0023f94a38dbe
|
@@ -8,10 +8,12 @@ module Sinatra
|
|
8
8
|
return filename if filename =~ /^http|https|\//
|
9
9
|
halt 500, "Invalid path (#{settings.manifest_path}) to manifest.json" unless File.exists? settings.manifest_path
|
10
10
|
|
11
|
+
filepath = filename.split('/')
|
12
|
+
filename = filepath.pop
|
11
13
|
manifest = Oj.load(File.open(settings.manifest_path, 'r'))
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
asset_url = [(settings.assets_host || ''), settings.assets_path, filepath, manifest[filename]].flatten.join('/')
|
15
|
+
puts asset_url
|
16
|
+
asset_url
|
15
17
|
end
|
16
18
|
|
17
19
|
def stylesheet_tag(filename, media = 'screen')
|
@@ -29,8 +31,8 @@ module Sinatra
|
|
29
31
|
|
30
32
|
def self.registered(app)
|
31
33
|
app.helpers AssetHelpers::Helpers
|
32
|
-
app.set :assets_path, 'assets'
|
33
34
|
app.set :assets_host, ENV['ASSETS_HOST']
|
35
|
+
app.set :assets_path, 'assets'
|
34
36
|
app.set :manifest_path, File.join(app.settings.root, 'public/assets/manifest.json')
|
35
37
|
end
|
36
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-asset_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- StyleSeek Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|