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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc906aa325cb6c6e63d2fbcdb44a1e2be3a18e0a
4
- data.tar.gz: fa098e09cf55ac5c4152583859cf1d38343d96ad
3
+ metadata.gz: 6039624381a0d73836dfa4caced220027b665dc2
4
+ data.tar.gz: f0b3aa15739e27340cf7e60fcb361332807d5d1c
5
5
  SHA512:
6
- metadata.gz: 049abb4b1527302a0aa56c4e3b6fe83835485e31335f3ea1bbc093a4cfb1f2d1a4bcce739d5f133832477ce3f74d281f8b3cd82911a6c4b87319a402b70a0f3c
7
- data.tar.gz: e122f1f04e4f63ab065537f4f5df25c4004203d242eaba6d7b26b767c887fa2177b12b0dc4ff1dbc1154e69538bf55abe7b1c3f91043afad28e3ca1064c1e20b
6
+ metadata.gz: 1297e086e71c4e771ea6f01bfef803bfbd9e0173678dc1c949223c2930a2c62ab0d028ee65188e479d02c0fee43b7ba23b82ee407c0e422f391b2f8e9b447588
7
+ data.tar.gz: 2cdca84e54a796751a41f74ab2dc14ca8f14bcec8d1337c1a5264cc52dd65787b1f9ea225fb99e746fd827de6730c9010c884029ee1234ed3fef81edc9ab328e
@@ -34,8 +34,8 @@ module Tension
34
34
  # precompilation.
35
35
  #
36
36
  def precompilation_needed?(path)
37
- if context = find(path)
38
- context.has_action?( Tension::Utils.action_name(path) )
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.match(SHARED_SUFFIX)
80
- strip_file_extension( parts.last )
87
+ if shared_asset?(parts.last)
88
+ parts.push(strip_file_extension( parts.pop ))
81
89
  else
82
90
  parts.pop
83
91
  end
@@ -1,3 +1,3 @@
1
1
  module Tension
2
- VERSION = "0.9.8".freeze
2
+ VERSION = "0.9.10".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piers Mainwaring