tension 0.10.0 → 0.10.1

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: b8550a2d08689d7631777f9df17d8b943d40ad1f
4
- data.tar.gz: bc26def24af87a4eb52366de7ad1cae8148e1f0c
3
+ metadata.gz: 3d39a310e3e3e2490fdb04a3c433b2507202974c
4
+ data.tar.gz: 0cc81a8bb2f40411c2551505111d7758b4481081
5
5
  SHA512:
6
- metadata.gz: 7dab945b47b1e7e3baeb3a6095c1f7ab950a86308fb4329481bf8745d5a07823544a967606423d66713d561bade8977bd3399a3db967752f177cddc2c601e9d7
7
- data.tar.gz: ba6b2135adbb65584a0012a56438f54f4c106111da2616522f59525dbc5963bc861b3317b5e610520ac0eece25a3ed50de08ca0695e09bb2539697ab6627e90d
6
+ metadata.gz: f9e0850239953bd7dd608457d7b8c6e4675a1e73658687fde6af9a6145f542f401178a9d3466fa7d1ce96a7149211cf2bbddb76e4d24a2d44d2be12b1d8d7827
7
+ data.tar.gz: a362adf9f0915e6874c0a86041a554412600dbba0454ffe33f285e87c7a7fece7af64deeb457b5a9fb7bf8578072343efe6e1f93ff3d215a32b90af3f32d0cd2
@@ -3,7 +3,11 @@ module Tension
3
3
  attr_reader :controller_name, :action
4
4
 
5
5
  def initialize(controller_path)
6
- @controller_name = "#{ controller_path }_controller".classify
6
+ @controller_name = controller_path.camelize
7
+
8
+ unless @controller_name.safe_constantize
9
+ @controller_name << "Controller"
10
+ end
7
11
  end
8
12
 
9
13
  def controller
@@ -7,12 +7,6 @@ module Tension
7
7
 
8
8
  attr_reader :assets, :controllers
9
9
 
10
- def initialize(assets_path)
11
- if assets_cached?
12
- cache_assets_from_manifest!(Sprockets::Manifest.new(assets_path))
13
- end
14
- end
15
-
16
10
  # Loads a Context for the specified controller path.
17
11
  #
18
12
  def find_context(key)
@@ -41,20 +35,11 @@ module Tension
41
35
  @controllers ||= Hash.new
42
36
  end
43
37
 
44
- # Determines whether or not a given path refers to an asset that requires
45
- # precompilation.
46
- #
47
- def precompilation_needed?(path)
48
- if cxt = find_context(path)
49
- Tension::Utils.shared_asset?(path) || cxt.has_action?( Tension::Utils.action_name(path) )
50
- end
51
- end
52
-
53
38
 
54
39
  private
55
40
 
56
41
  def fetch(path)
57
- contexts[path] || store(path) unless path.nil?
42
+ (contexts[path] || store(path)) if path.present?
58
43
  end
59
44
 
60
45
  def store(path)
@@ -67,20 +52,6 @@ module Tension
67
52
  end
68
53
  end
69
54
 
70
- def assets_cached?
71
- ! Rails.env.development? && ! Rails.application.config.assets.compile
72
- end
73
-
74
- def cache_assets_from_manifest!(manifest)
75
- @assets = Hash.new
76
- manifest.files.each do |full_path, info|
77
- next unless full_path.match(/\.css|\.js\z/)
78
-
79
- info = info.merge(full_path: full_path).with_indifferent_access
80
- @assets[ info[:logical_path] ] = Asset.new(info)
81
- end
82
- end
83
-
84
55
  # Routing defaults (including controller path and action name) for all
85
56
  # configured GET routes.
86
57
  #
@@ -8,12 +8,7 @@ module Tension
8
8
  initializer "tension.add_assets_to_precompile_list" do |app|
9
9
  ActionView::Base.send(:include, Tension::Helper)
10
10
  ActionController::Base.send(:include, Tension::Controller)
11
-
12
- Tension.environment = Tension::Environment.new('public/assets')
13
-
14
- Rails.application.config.assets.precompile << lambda do |path, filename|
15
- Tension.environment.precompilation_needed?(path)
16
- end
11
+ Tension.environment = Tension::Environment.new
17
12
  end
18
13
 
19
14
  end
data/lib/tension/utils.rb CHANGED
@@ -52,6 +52,10 @@ module Tension
52
52
  Tension.environment.find_asset( "application.#{type}" )
53
53
  end
54
54
 
55
+ def strip_file_extension(path)
56
+ path.gsub(EXTENSION_REGEX, "")
57
+ end
58
+
55
59
  private
56
60
 
57
61
  # Builds a String path for an asset based on the given hash params.
@@ -84,10 +88,6 @@ module Tension
84
88
  return parts.any? ? parts.join("/") : nil
85
89
  end
86
90
 
87
- def strip_file_extension(path)
88
- path.gsub(EXTENSION_REGEX, "")
89
- end
90
-
91
91
  # Returns whether or not the given path represents an asset file
92
92
  # for which Tension is useful: JavaScript or CSS.
93
93
  # ARGS: path: a String path like "admin/blog_common.css"
@@ -1,3 +1,3 @@
1
1
  module Tension
2
- VERSION = "0.10.0".freeze
2
+ VERSION = "0.10.1".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.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piers Mainwaring