turbo-sprockets-rails3 0.1.2 → 0.1.3
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.
data/README.md
CHANGED
@@ -33,12 +33,11 @@ Go on, run `rake assets:precompile` again, and it should be a whole lot faster t
|
|
33
33
|
|
34
34
|
Enjoy your lightning fast deploys!
|
35
35
|
|
36
|
-
|
36
|
+
## Deployments
|
37
37
|
|
38
|
-
|
39
|
-
-->
|
38
|
+
### Capistrano
|
40
39
|
|
41
|
-
|
40
|
+
`turbo-sprockets-rails3` should work out of the box with Capistrano.
|
42
41
|
|
43
42
|
### Heroku
|
44
43
|
|
@@ -46,11 +45,6 @@ You won't be able to do an 'incremental update' on heroku, since your `public/as
|
|
46
45
|
folder will be empty at the start of each push. However, this gem can still cut your
|
47
46
|
precompile time in half, since it only compiles assets once to generate both digest and non-digest assets.
|
48
47
|
|
49
|
-
<!--### Capistrano
|
50
|
-
|
51
|
-
If you are deploying with Capistrano, it's not a good idea to symlink `public/assets` to a shared assets folder, because the asset cleanup task would delete the current assets before the deploy has finished. Keeping a separate copy of `public/assets` for each release also means that you can safely roll back to a previous release.
|
52
|
-
The best approach would be to add a deploy step that copies the `public/assets` folder from your previous release into the current release, before running `assets:precompile`.-->
|
53
|
-
|
54
48
|
## Debugging
|
55
49
|
|
56
50
|
If you would like to view debugging information in your terminal during the `assets:precompile` task, add the following lines to the bottom of `config/environments/production.rb`:
|
@@ -78,11 +78,6 @@ namespace :assets do
|
|
78
78
|
)
|
79
79
|
compiler.compile
|
80
80
|
end
|
81
|
-
|
82
|
-
if config.assets.clean_after_precompile
|
83
|
-
cleaner = Sprockets::StaticCleaner.new(env, target, config.assets.digest_files)
|
84
|
-
cleaner.remove_old_assets!
|
85
|
-
end
|
86
81
|
end
|
87
82
|
|
88
83
|
task :all => ["assets:cache:clean"] do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-sprockets-rails3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -64,7 +64,6 @@ files:
|
|
64
64
|
- lib/turbo-sprockets/sprockets_overrides/processed_asset.rb
|
65
65
|
- lib/sprockets/static_non_digest_generator.rb
|
66
66
|
- lib/sprockets/asset_with_dependencies.rb
|
67
|
-
- lib/sprockets/static_cleaner.rb
|
68
67
|
- lib/sprockets/unprocessed_asset.rb
|
69
68
|
- MIT-LICENSE
|
70
69
|
- Rakefile
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module Sprockets
|
4
|
-
class StaticCleaner
|
5
|
-
attr_accessor :env, :target
|
6
|
-
|
7
|
-
def initialize(env, target, digest_files)
|
8
|
-
@env = env
|
9
|
-
@target = File.join(target, '') # Make sure target ends with trailing /
|
10
|
-
@digest_files = digest_files
|
11
|
-
end
|
12
|
-
|
13
|
-
# Remove all files from `config.assets.prefix` that are not found in manifest.yml
|
14
|
-
def remove_old_assets!
|
15
|
-
known_files = @digest_files.flatten
|
16
|
-
known_files += known_files.map {|f| "#{f}.gz" } # Recognize gzipped files
|
17
|
-
known_files << 'manifest.yml'
|
18
|
-
|
19
|
-
assets_prefix = ::Rails.application.config.assets.prefix
|
20
|
-
|
21
|
-
Dir[File.join(target, "**/*")].each do |path|
|
22
|
-
unless File.directory?(path)
|
23
|
-
logical_path = path.sub(target, '')
|
24
|
-
unless logical_path.in? known_files
|
25
|
-
FileUtils.rm path
|
26
|
-
env.logger.debug "Deleted old asset at public#{assets_prefix}/#{logical_path}"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
# Remove empty directories (reversed to delete top-level empty dirs first)
|
32
|
-
Dir[File.join(target, "**/*")].reverse.each do |path|
|
33
|
-
if File.exists?(path) && File.directory?(path) && (Dir.entries(path) - %w(. ..)).empty?
|
34
|
-
FileUtils.rmdir path
|
35
|
-
logical_path = path.sub(target, '')
|
36
|
-
env.logger.debug "Deleted empty directory at public#{assets_prefix}/#{logical_path}"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|