ettu 0.1.0 → 3.0.0
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/README.md +5 -35
- data/ROADMAP.md +5 -1
- data/ettu.gemspec +2 -1
- data/lib/ettu/configuration.rb +9 -8
- data/lib/ettu/railtie.rb +0 -11
- data/lib/ettu/version.rb +1 -1
- data/lib/ettu.rb +2 -6
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28eeeb019730fdbde0370f53b31ee30dade06adb
|
4
|
+
data.tar.gz: 7b925784197f8e7d9c8009b57563e0d85ce1f49a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c41c23a43c47b53764dbfb531248c6cce4c026461e4277de4c4905ad0928be4de9ac291db68999054c0aa9c3260140a6f86909fc01959f7251db36f092cb29d
|
7
|
+
data.tar.gz: 40f849ff897c470f6af3f8ccef53795cb0263a5c9f7710e2c1f9a03ad28bfaafee3ede974bde2cb5d3db2e7af4339f38d6e7a9a982305d8cd35c6e68f4e60cf0
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Ettu
|
2
2
|
====
|
3
3
|
|
4
|
-
Using Rails `stale?` or `fresh_when`? Are your users seeing old view
|
4
|
+
Using Rails 3's `stale?` or `fresh_when`? Are your users seeing old view
|
5
5
|
code even after new deploys? The Rails way `fresh_when(@product)`
|
6
6
|
doesn't account for changes in your view code, you have to do it
|
7
7
|
yourself.
|
@@ -19,21 +19,10 @@ changes to your view code.
|
|
19
19
|
Installation
|
20
20
|
------------
|
21
21
|
|
22
|
-
### Rails 4
|
23
|
-
|
24
|
-
Add Ettu to your Gemfile:
|
25
|
-
|
26
|
-
gem 'ettu'
|
27
|
-
|
28
|
-
And `$ bundle install`
|
29
|
-
|
30
|
-
### Rails 3
|
31
|
-
|
32
22
|
Add Ettu and [cache_digests](https://github.com/rails/cache_digests) to
|
33
23
|
your Gemfile:
|
34
24
|
|
35
|
-
gem 'ettu'
|
36
|
-
gem 'cache_digests'
|
25
|
+
gem 'ettu', '~> 3.0'
|
37
26
|
|
38
27
|
And `$ bundle install`
|
39
28
|
|
@@ -118,32 +107,13 @@ won't cause problems if it's not installed.
|
|
118
107
|
RAILS_ENV=development Issues
|
119
108
|
----------------------------
|
120
109
|
|
121
|
-
|
122
|
-
|
123
|
-
Until [rails/rails#10791](https://github.com/rails/rails/pull/10791)
|
124
|
-
gets merged in, Ettu will not be able to detect changes in templates
|
125
|
-
while in the **development** environment. This is not an issue that
|
126
|
-
affects staging or production, because the template cache will be
|
127
|
-
recreated after each deploy.
|
128
|
-
|
129
|
-
In the mean time, you can enable a monkey-patch with:
|
130
|
-
|
131
|
-
```ruby
|
132
|
-
# config/environments/development.rb
|
133
|
-
My::Application.configure do
|
134
|
-
config.ettu.rails_4_development_hack = true
|
135
|
-
end
|
136
|
-
```
|
137
|
-
|
138
|
-
### Rails 3
|
139
|
-
|
140
|
-
The cache_digests gem has already patched issue #10791. All you need to
|
141
|
-
do is disable `cache_template_loading`.
|
110
|
+
In order for Ettu to detect changes to templates in the **development**
|
111
|
+
environment, you must disable `cache_template_loading`.
|
142
112
|
|
143
113
|
```ruby
|
144
114
|
# config/environments/development.rb
|
145
115
|
My::Application.configure do
|
146
|
-
config.action_view.cache_template_loading
|
116
|
+
config.action_view.cache_template_loading = false
|
147
117
|
end
|
148
118
|
```
|
149
119
|
|
data/ROADMAP.md
CHANGED
@@ -2,4 +2,8 @@ Ettu Roadmap
|
|
2
2
|
============
|
3
3
|
|
4
4
|
1. [x] Decouple Ettu and Configuration
|
5
|
-
2. [ ]
|
5
|
+
2. [ ] Remove Rails Version checking
|
6
|
+
- Separate gem into branches
|
7
|
+
- v3 branch will track Rails 3
|
8
|
+
- v4 branch will track Rails 4
|
9
|
+
3. [ ] Default assets to those set in Rails.application.config.assets.precompile
|
data/ettu.gemspec
CHANGED
@@ -19,7 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.required_ruby_version = '>= 1.9'
|
21
21
|
|
22
|
-
spec.add_dependency 'rails', '
|
22
|
+
spec.add_dependency 'rails', '~> 3.0'
|
23
|
+
spec.add_dependency 'cache_digests'
|
23
24
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
25
|
spec.add_development_dependency 'rake'
|
25
26
|
spec.add_development_dependency 'rspec'
|
data/lib/ettu/configuration.rb
CHANGED
@@ -26,11 +26,11 @@ class Ettu
|
|
26
26
|
# Don't attempt to reset the template_digestor
|
27
27
|
# if one has already been found
|
28
28
|
unless self.template_digestor
|
29
|
-
self.template_digestor =
|
29
|
+
self.template_digestor = LateLoadTemplateDigestor.new(self)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
class
|
33
|
+
class LateLoadTemplateDigestor
|
34
34
|
def initialize(config)
|
35
35
|
@config = config
|
36
36
|
end
|
@@ -43,13 +43,14 @@ class Ettu
|
|
43
43
|
private
|
44
44
|
|
45
45
|
def attempt_late_template_digestor_set
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
elsif defined? CacheDigests::TemplateDigestor
|
50
|
-
# Attempt to use CacheDigests::TemplateDigestor on Rails 3
|
51
|
-
@config.template_digestor = CacheDigests::TemplateDigestor
|
46
|
+
unless defined? CacheDigests::TemplateDigestor
|
47
|
+
# Attempt to load cache_digets
|
48
|
+
require 'cache_digests'
|
52
49
|
end
|
50
|
+
# Attempt to use CacheDigests::TemplateDigestor on Rails 3
|
51
|
+
@config.template_digestor = CacheDigests::TemplateDigestor
|
52
|
+
rescue LoadError
|
53
|
+
raise "Ettu requires the cache_digests gem in Rails v#{Rails::VERSION::STRING}"
|
53
54
|
end
|
54
55
|
end
|
55
56
|
end
|
data/lib/ettu/railtie.rb
CHANGED
@@ -9,17 +9,6 @@ class Ettu
|
|
9
9
|
ActiveSupport.on_load :action_controller do
|
10
10
|
ActionController::Base.send :include, FreshWhen
|
11
11
|
end
|
12
|
-
|
13
|
-
if app.config.ettu.rails_4_development_hack
|
14
|
-
class BlackHole < Hash
|
15
|
-
def []=(k, v); end
|
16
|
-
end
|
17
|
-
module ::ActionView
|
18
|
-
class Digestor
|
19
|
-
@@cache = BlackHole.new
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
12
|
end
|
24
13
|
|
25
14
|
end
|
data/lib/ettu/version.rb
CHANGED
data/lib/ettu.rb
CHANGED
@@ -89,16 +89,12 @@ class Ettu
|
|
89
89
|
# Jeremy Kemper
|
90
90
|
# https://gist.github.com/jeremy/4211803
|
91
91
|
def asset_digest(asset)
|
92
|
-
rails_version = Rails::VERSION::MAJOR
|
93
92
|
return nil unless asset.present?
|
94
93
|
# Check already computed assets (production)
|
95
|
-
|
96
|
-
if rails_version == 4 && digest = ActionView::Base.assets_manifest.assets[asset]
|
97
|
-
digest
|
98
|
-
elsif rails_version == 3 && manifest = Rails.application.config.assets.digests
|
94
|
+
if manifest = Rails.application.config.assets.digests
|
99
95
|
manifest[asset]
|
100
96
|
else
|
101
|
-
# Compute it in
|
97
|
+
# Compute it in
|
102
98
|
Rails.application.assets[asset].digest
|
103
99
|
end
|
104
100
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ettu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Ridgewell
|
@@ -14,16 +14,30 @@ dependencies:
|
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: cache_digests
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|