turbo-sprockets-rails3 0.3.9 → 0.3.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 +8 -8
- data/README.md +3 -0
- data/lib/turbo-sprockets/tasks/assets.rake +15 -9
- data/lib/turbo-sprockets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTc3YmY4YjI3NjViN2M5NzEzY2E1OTk3MDU1ODY4NDFlNzdmNmEzOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Y2ZhOGNkMDAxZTViMTY2NTM3N2FiZjgyODBjMGRkYWM5MmMxNDljYQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGE3MjdjMmQ2NTg3YTVkNzBmOGMzNDFlOTcyZTY4ZTVhODE4YjBkNjI5MDdh
|
10
|
+
MTVmZDc3OTBmMmI2NDY5YzVjNTM1NTAyYzBiYWVmMzIxNTc5ZDBlYTQzYmJm
|
11
|
+
MjU5ZGRjNTQyYmNmMDU4NzY1NmRjNTVkZThlYzk4M2RkMGY4MTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWE2ZDEwMTcyYTI4Y2NhNjE3MmJiMTBlZDY2MDBmZTFlOWJkYjk0ZDI4YWUz
|
14
|
+
YzM1M2U0YmViOTNiMDlmOTAxODVkODFkYzUyYmQxOTlhYzhjOWQzMmEzY2E3
|
15
|
+
NTczNDQ1YjRmYTI2ZGE0ODAyODk5MTNhMGU1MTU5MGQ2OTE1YmM=
|
data/README.md
CHANGED
@@ -35,6 +35,9 @@ Enjoy your lightning fast deploys!
|
|
35
35
|
|
36
36
|
`turbo-sprockets-rails3` provides a Rake task called `assets:clean_expired`. You can run this task after `assets:precompile` to remove outdated assets.
|
37
37
|
|
38
|
+
If you use this rake task, you must set `config.assets.handle_expiration` to true in `config/environments/production.rb`. This makes sure that asset modification times
|
39
|
+
are updated properly before `assets:precompile`, so that the `clean_expired` task knows which assets are safe to remove.
|
40
|
+
|
38
41
|
An asset will be deleted if it is no longer referenced by `manifest.yml`, and hasn't been actively deployed for more than a day (default).
|
39
42
|
|
40
43
|
You can configure the expiry time by setting `config.assets.expire_after` in `config/environments/production.rb`.
|
@@ -67,19 +67,25 @@ namespace :assets do
|
|
67
67
|
config.assets.digest = digest unless digest.nil?
|
68
68
|
config.assets.digests ||= {}
|
69
69
|
config.assets.source_digests ||= {}
|
70
|
+
config.assets.handle_expiration = false if config.assets.handle_expiration.nil?
|
70
71
|
|
71
72
|
env = Rails.application.assets
|
72
73
|
target = File.join(::Rails.public_path, config.assets.prefix)
|
73
74
|
|
74
|
-
#
|
75
|
-
#
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
75
|
+
# This takes a long time to run if you aren't cleaning expired assets.
|
76
|
+
# You must call the assets:clean_expired rake task regularly if this is
|
77
|
+
# enabled
|
78
|
+
if config.assets.handle_expiration
|
79
|
+
# Before first compile, set the mtime of all current assets to current time.
|
80
|
+
# This time reflects the last time the assets were being used.
|
81
|
+
if digest.nil?
|
82
|
+
::Rails.logger.debug "Updating mtimes for current assets..."
|
83
|
+
paths = known_assets.map { |asset| File.join(target, asset) }
|
84
|
+
paths.each_slice(100) do |slice|
|
85
|
+
# File.utime raises 'Operation not permitted' unless user is owner of file.
|
86
|
+
# Non-owners have permission to update mtime to the current time using 'touch'.
|
87
|
+
`touch -c #{slice.shelljoin}`
|
88
|
+
end
|
83
89
|
end
|
84
90
|
end
|
85
91
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-sprockets-rails3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Broadbent
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|