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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f304e28e2abf69bd7708d9189f11603e7b20530c
4
- data.tar.gz: 3fffa7df5af40f0cc4dcf44bc69fdf362925cdeb
3
+ metadata.gz: 4e502f5888642e5644cae4fdc1e6ab252363ab99
4
+ data.tar.gz: a90cbc5451fad72ac6ce9c1f7d15adcde09dd5aa
5
5
  SHA512:
6
- metadata.gz: 88b042b861d15e2ac870f043c2eac05470f5aa6e69ecbddba3335fd0db31bc2913a4449b09f9487ce520da128b328bacf753644a2105fbb90189bbae3b98e2f0
7
- data.tar.gz: 7d8ef5a7b7c2fc98004a71718dee31a93c4883fa158787b1205b0c4ff804c1209b98fc8346509629613a19f8cadf10a658d3e0255b511bc802d52a7aa03a713a
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
- file = manifest[filename]
13
-
14
- "#{settings.assets_host}/#{settings.assets_path}/#{file}"
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
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module AssetHelpers
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  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.1
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-03-31 00:00:00.000000000 Z
11
+ date: 2014-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra