tension 0.9.8 → 0.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tension/environment.rb +3 -3
- data/lib/tension/utils.rb +10 -2
- data/lib/tension/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6039624381a0d73836dfa4caced220027b665dc2
|
4
|
+
data.tar.gz: f0b3aa15739e27340cf7e60fcb361332807d5d1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1297e086e71c4e771ea6f01bfef803bfbd9e0173678dc1c949223c2930a2c62ab0d028ee65188e479d02c0fee43b7ba23b82ee407c0e422f391b2f8e9b447588
|
7
|
+
data.tar.gz: 2cdca84e54a796751a41f74ab2dc14ca8f14bcec8d1337c1a5264cc52dd65787b1f9ea225fb99e746fd827de6730c9010c884029ee1234ed3fef81edc9ab328e
|
data/lib/tension/environment.rb
CHANGED
@@ -34,8 +34,8 @@ module Tension
|
|
34
34
|
# precompilation.
|
35
35
|
#
|
36
36
|
def precompilation_needed?(path)
|
37
|
-
if
|
38
|
-
|
37
|
+
if cxt = find(path)
|
38
|
+
Tension::Utils.shared_asset?(path) || cxt.has_action?( Tension::Utils.action_name(path) )
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -43,7 +43,7 @@ module Tension
|
|
43
43
|
private
|
44
44
|
|
45
45
|
def fetch(path)
|
46
|
-
contexts[path] || store(path)
|
46
|
+
contexts[path] || store(path) unless path.nil?
|
47
47
|
end
|
48
48
|
|
49
49
|
def store(path)
|
data/lib/tension/utils.rb
CHANGED
@@ -3,6 +3,7 @@ module Tension
|
|
3
3
|
class << self
|
4
4
|
|
5
5
|
SHARED_SUFFIX = "_common".freeze
|
6
|
+
SHARED_REGEX = /#{SHARED_SUFFIX}\..*\z/.freeze
|
6
7
|
EXTENSION_REGEX = /(#{SHARED_SUFFIX})?\..*\z/.freeze
|
7
8
|
|
8
9
|
# Matches strings like "blog/comments".
|
@@ -29,6 +30,13 @@ module Tension
|
|
29
30
|
strip_file_extension( path.split("/").last ) if asset_path?(path)
|
30
31
|
end
|
31
32
|
|
33
|
+
# Determines whether an asset path is shared amongst all actions
|
34
|
+
# for its controller.
|
35
|
+
#
|
36
|
+
def shared_asset?(path)
|
37
|
+
!!path.match(SHARED_SUFFIX)
|
38
|
+
end
|
39
|
+
|
32
40
|
# Attempts to load an Asset from the Sprockets index. Uses the given
|
33
41
|
# Hash argument to build an asset path.
|
34
42
|
# ARGS: options: a Hash containing e.g.
|
@@ -76,8 +84,8 @@ module Tension
|
|
76
84
|
def controller_for_asset_path(path)
|
77
85
|
parts = path.split("/")
|
78
86
|
|
79
|
-
if parts.last
|
80
|
-
strip_file_extension( parts.
|
87
|
+
if shared_asset?(parts.last)
|
88
|
+
parts.push(strip_file_extension( parts.pop ))
|
81
89
|
else
|
82
90
|
parts.pop
|
83
91
|
end
|
data/lib/tension/version.rb
CHANGED