actionview-rev_manifest 0.0.1 → 0.1.0

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: 9a2b7b51a9c31a0ac93dffa41db69ffc29359fb1
4
- data.tar.gz: 1931b942f48c052748ab453b583683e1dc1cd46f
3
+ metadata.gz: 19fc5493ff6fca5a2b782d925ebd71af778045b9
4
+ data.tar.gz: 14fc56cfa00c6eff27cb99b46674d9785e5fddd6
5
5
  SHA512:
6
- metadata.gz: 9573f6d8547b4ca257b44398145c363cbd6ba1a14c2946e71d03a3d444f086391a47e8cb88868055b2d4c392771f3635afe1a22028f2ac59be0c77b1a3a6f15b
7
- data.tar.gz: 8b3bc339c9a229ce673f1e059c3ea8df28cdb7fc6bc7b59888db36384a16ac05ac1e54573a72b09ee89fbef5282f599736fd0bfdd775a266ffddd9b38dca34ae
6
+ metadata.gz: 986af713c99e3bba885012c2afa9783b2c376fa6fe9ec87e2a7eaacf5a6292e5f3a2d2b2d8993c0864d32334cd599c448d7842f18d935a07157dc2224890c9e5
7
+ data.tar.gz: 6cdb8657f864d1bd1bd86b5e1307236acad597af6596accf0075e765fc8fc3f58289923ba07c6f89aa0bade329e2f5fa33f924933a05e2de90cc0a3e149c27ca
@@ -20,24 +20,38 @@ module RevManifest
20
20
  video: "assets/videos/"
21
21
  }
22
22
 
23
+ DEFAULT_ASSET_ROOT = "/"
24
+
23
25
  DEFAULT_MANIFEST_PATH = "public/assets/rev-manifest.json"
24
26
 
25
27
  class << self
26
- attr_writer :enabled, :asset_prefixes, :asset_public_directories, :manifest_path
28
+ attr_writer :enabled, :asset_prefixes, :asset_public_directories, :asset_root, :manifest_path
27
29
 
28
30
  # @return [true, false]
29
31
  def enabled?
30
32
  !!@enabled
31
33
  end
32
34
 
35
+ # @return [Hash]
36
+ def asset_public_directories
37
+ @asset_public_directories || DEFAULT_ASSET_PUBLIC_DIRECTORIES
38
+ end
39
+
40
+ # @return [String]
41
+ def resolve(source, options)
42
+ asset_root + manifest[asset_prefixes[options[:type]] + source]
43
+ end
44
+
45
+ private
46
+
33
47
  # @return [Hash]
34
48
  def asset_prefixes
35
49
  @asset_prefixes || DEFAULT_ASSET_PREFIXES
36
50
  end
37
51
 
38
- # @return [Hash]
39
- def asset_public_directories
40
- @asset_public_directories || DEFAULT_ASSET_PUBLIC_DIRECTORIES
52
+ # @return [String]
53
+ def asset_root
54
+ @asset_root || DEFAULT_ASSET_ROOT
41
55
  end
42
56
 
43
57
  # @return [String]
@@ -3,7 +3,7 @@ module ActionView
3
3
  # @note Override {ActionView::Helpers::AssetUrlHelper#compute_asset_path}.
4
4
  def compute_asset_path(source, options = {})
5
5
  if RevManifest.enabled?
6
- RevManifest.manifest[RevManifest.asset_prefixes[options[:type]] + source]
6
+ Revmanifest.resolve(source, options)
7
7
  else
8
8
  dir = RevManifest.asset_public_directories[options[:type]] || ""
9
9
  File.join(dir, source)
@@ -1,3 +1,3 @@
1
1
  module RevManifest
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview-rev_manifest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuku Takahashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-10 00:00:00.000000000 Z
11
+ date: 2015-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview