turbo-sprockets-rails3 0.1.7 → 0.1.8
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
@@ -31,8 +31,9 @@ Just drop the gem in your `Gemfile`:
|
|
31
31
|
gem 'turbo-sprockets-rails3'
|
32
32
|
```
|
33
33
|
|
34
|
-
|
34
|
+
Warning: Don't add this gem to the `:assets` group. It must be available in the production environment, since it overrides path helpers and alters the manifest format. This is a common cause of `**** isn't precompiled` errors in production.
|
35
35
|
|
36
|
+
Run `bundle` to install the gem, and you're done!
|
36
37
|
|
37
38
|
Test it out by running `rake assets:precompile`. When it's finished, your `public/assets/manifest.yml` file should include a `:source_digests` hash for your assets.
|
38
39
|
|
@@ -58,12 +58,11 @@ if defined?(Sprockets::StaticCompiler)
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
# Encode all
|
61
|
+
# Encode all filenames & digests as UTF-8 for Ruby 1.9,
|
62
|
+
# otherwise YAML dumps other string encodings as !binary
|
62
63
|
if RUBY_VERSION.to_f >= 1.9
|
63
|
-
|
64
|
-
@
|
65
|
-
@digest_files.each { |k, v| utf8_digests[k.encode("UTF-8")] = v.encode("UTF-8") }
|
66
|
-
@source_digests, @digest_files = utf8_sources, utf8_digests
|
64
|
+
@source_digests = encode_hash_as_utf8 @source_digests
|
65
|
+
@digest_files = encode_hash_as_utf8 @digest_files
|
67
66
|
end
|
68
67
|
|
69
68
|
if @manifest
|
@@ -78,6 +77,12 @@ if defined?(Sprockets::StaticCompiler)
|
|
78
77
|
elapsed_time = ((Time.now.to_f - start_time) * 1000).to_i
|
79
78
|
env.logger.debug "Processed #{'non-' unless @digest}digest assets in #{elapsed_time}ms"
|
80
79
|
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
def encode_hash_as_utf8(hash)
|
84
|
+
Hash[*hash.map {|k,v| [k.encode("UTF-8"), v.encode("UTF-8")] }.flatten]
|
85
|
+
end
|
81
86
|
end
|
82
87
|
end
|
83
|
-
end
|
88
|
+
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
|
3
|
-
# Clear all assets tasks from sprockets railtie
|
3
|
+
# Clear all assets tasks from sprockets railtie,
|
4
|
+
# but preserve any extra actions added via 'enhance'
|
5
|
+
task_enhancements = {}
|
4
6
|
Rake::Task.tasks.each do |task|
|
5
7
|
if task.name.match '^assets:'
|
6
|
-
task.
|
8
|
+
task_enhancements[task.name] = task.actions[1..-1] if task.actions.size > 1
|
9
|
+
task.clear
|
7
10
|
end
|
8
11
|
end
|
9
12
|
|
@@ -80,7 +83,14 @@ namespace :assets do
|
|
80
83
|
|
81
84
|
task :all => ["assets:cache:clean"] do
|
82
85
|
internal_precompile
|
83
|
-
|
86
|
+
if ::Rails.application.config.assets.digest
|
87
|
+
internal_precompile(false)
|
88
|
+
|
89
|
+
# Other gems may add hooks to run after the 'assets:precompile:nondigest' task.
|
90
|
+
# Since we aren't running separate rake tasks anymore,
|
91
|
+
# we need to manually invoke those extra actions now.
|
92
|
+
Rake::Task["assets:precompile:nondigest"].actions[1..-1].each &:call
|
93
|
+
end
|
84
94
|
end
|
85
95
|
|
86
96
|
task :primary => ["assets:cache:clean"] do
|
@@ -120,3 +130,11 @@ namespace :assets do
|
|
120
130
|
end
|
121
131
|
end
|
122
132
|
end
|
133
|
+
|
134
|
+
|
135
|
+
# Append previous task enhancements to new Rake tasks.
|
136
|
+
task_enhancements.each do |task_name, actions|
|
137
|
+
actions.each do |proc|
|
138
|
+
Rake::Task[task_name].enhance &proc
|
139
|
+
end
|
140
|
+
end
|
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.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sprockets
|