ettu 4.1.0 → 4.1.1
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/ettu/configuration.rb +10 -25
- data/lib/ettu/railtie.rb +18 -5
- data/lib/ettu/version.rb +1 -1
- data/spec/ettu_spec.rb +1 -1
- data/spec/fixtures.rb +0 -7
- data/spec/spec_helper.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9125f73c8efc86a66a108eab2c521353cd8a383
|
4
|
+
data.tar.gz: c178d1a1b0a5615725890740c0cdb1d275689c89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2033518610ee665f280c9b0a76fc8c8c88ee8376e108e60f132992d71389463391cbce274ad74fe7d3c40595bd801360cdef039b8b24e79f221e783919e5e11b
|
7
|
+
data.tar.gz: b9c8c9cb1a316977fd186302bc05cae497298f7b96e1986011f41da48a2ecd5b6d9cb09d03bb690f21aab2383f0fd7d83dde0d60e4642350de4cad287b132ceb
|
data/lib/ettu/configuration.rb
CHANGED
@@ -13,7 +13,7 @@ class Ettu
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def set_defaults
|
16
|
-
self.assets = LateLoadAssets.new
|
16
|
+
self.assets = LateLoadAssets.new(self, :assets)
|
17
17
|
|
18
18
|
# Don't actually set view by default.
|
19
19
|
# This'll allow #fetch to return the real default
|
@@ -21,40 +21,25 @@ class Ettu
|
|
21
21
|
# self.view = "#{controller_name}/#{action_name}"
|
22
22
|
delete :view if key? :view
|
23
23
|
|
24
|
-
self.template_digestor =
|
24
|
+
self.template_digestor = ActionView::Digestor
|
25
25
|
end
|
26
26
|
|
27
27
|
class LateLoadAssets
|
28
|
-
def initialize
|
29
|
-
@array = []
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_a
|
33
|
-
::ActionView::Base.assets_manifest.assets.keys + [*@array]
|
34
|
-
end
|
35
|
-
|
36
|
-
def method_missing(method, *args, &block)
|
37
|
-
@array.send method, *args, &block
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class LateLoadTemplateDigestor
|
42
|
-
def initialize(config)
|
28
|
+
def initialize(config, name)
|
43
29
|
@config = config
|
30
|
+
@name = name
|
44
31
|
end
|
45
32
|
|
46
|
-
def
|
47
|
-
|
48
|
-
|
33
|
+
def method_missing(method, *args, &block)
|
34
|
+
assets = Array.new(defaults)
|
35
|
+
@config[@name] = array
|
36
|
+
assets.send method, *args, &block
|
49
37
|
end
|
50
38
|
|
51
39
|
private
|
52
40
|
|
53
|
-
def
|
54
|
-
|
55
|
-
if defined? ActionView::Digestor
|
56
|
-
@config.template_digestor = ActionView::Digestor
|
57
|
-
end
|
41
|
+
def defaults
|
42
|
+
::ActionView::Base.assets_manifest.assets.keys
|
58
43
|
end
|
59
44
|
end
|
60
45
|
end
|
data/lib/ettu/railtie.rb
CHANGED
@@ -1,24 +1,37 @@
|
|
1
1
|
class Ettu
|
2
2
|
class Railtie < Rails::Railtie
|
3
3
|
config.ettu = ActiveSupport::OrderedOptions.new
|
4
|
-
|
5
4
|
initializer 'load' do |app|
|
6
5
|
|
7
6
|
unless app.config.ettu.disabled
|
8
7
|
require 'ettu'
|
9
|
-
ActiveSupport.on_load :action_controller do
|
10
|
-
ActionController::Base.send :include, FreshWhen
|
11
|
-
end
|
12
|
-
|
13
8
|
if app.config.ettu.development_hack
|
9
|
+
|
14
10
|
class BlackHole < Hash
|
15
11
|
def []=(k, v); end
|
16
12
|
end
|
13
|
+
module EtagBuster
|
14
|
+
extend ActiveSupport::Concern
|
15
|
+
included do
|
16
|
+
def fresh_when(*args); end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
17
20
|
module ::ActionView
|
18
21
|
class Digestor
|
19
22
|
@@cache = BlackHole.new
|
20
23
|
end
|
21
24
|
end
|
25
|
+
ActiveSupport.on_load :action_controller do
|
26
|
+
ActionController::Base.send :include, EtagBuster
|
27
|
+
end
|
28
|
+
|
29
|
+
else
|
30
|
+
|
31
|
+
ActiveSupport.on_load :action_controller do
|
32
|
+
ActionController::Base.send :include, FreshWhen
|
33
|
+
end
|
34
|
+
|
22
35
|
end
|
23
36
|
end
|
24
37
|
|
data/lib/ettu/version.rb
CHANGED
data/spec/ettu_spec.rb
CHANGED
@@ -47,7 +47,7 @@ describe Ettu do
|
|
47
47
|
|
48
48
|
context 'can append additional assets' do
|
49
49
|
let(:configuration) { Ettu::Configuration.new }
|
50
|
-
let(:random_string) {
|
50
|
+
let(:random_string) { SecureRandom.hex }
|
51
51
|
|
52
52
|
it 'with +=' do
|
53
53
|
configuration.assets += [random_string]
|
data/spec/fixtures.rb
CHANGED
@@ -61,10 +61,3 @@ ActionView::Base.assets_manifest.assets = Rails.application.assets.keys.reduce({
|
|
61
61
|
hash[asset] = asset.to_s + '.manifest'
|
62
62
|
hash
|
63
63
|
end
|
64
|
-
|
65
|
-
class RandomString
|
66
|
-
@@letters = ('a'..'z').to_a
|
67
|
-
def self.rand(length = 50)
|
68
|
-
(0...length).map{ @@letters.sample }.join
|
69
|
-
end
|
70
|
-
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ettu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Ridgewell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|