rake-sprockets 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rake/sprockets.rb +17 -4
- data/lib/rake/sprockets/version.rb +1 -1
- data/lib/tasks/sprockets.rake +9 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1709224381a55728faeea0190849e626ba80bd6
|
4
|
+
data.tar.gz: 0eef947b307984dc682bc895b74a0c20c6c698a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 323bfd8408a2be0f40ca4184b3a87c725bb8a96bf472f79bbf137ef9726e43044c5fee0d91457c6c743baf760496f219fc8f5c7c2f1d4b22c59b70179bae753a
|
7
|
+
data.tar.gz: 2e501433e6a1ace0ea2fb16987040fc3a0a1b2b8cf2cdd34132165056f4735d055c70e120051732be445c4111cdb1b1fb8409c9fcce3b5f11025e89947210ac3
|
data/lib/rake/sprockets.rb
CHANGED
@@ -47,6 +47,20 @@ module Rake
|
|
47
47
|
@sprockets ||= create_sprockets_env
|
48
48
|
end
|
49
49
|
|
50
|
+
def filename(file)
|
51
|
+
asset = sprockets[file]
|
52
|
+
|
53
|
+
if env.production?
|
54
|
+
asset.digest_path
|
55
|
+
else
|
56
|
+
asset.logical_path
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def url(file)
|
61
|
+
"/assets/#{filename(file)}"
|
62
|
+
end
|
63
|
+
|
50
64
|
def create_sprockets_env
|
51
65
|
::Sprockets::Environment.new(root) do |s_env|
|
52
66
|
s_env.logger = logger
|
@@ -65,14 +79,13 @@ module Rake
|
|
65
79
|
def compile
|
66
80
|
public_assets.mkpath
|
67
81
|
precompile.each do |file|
|
68
|
-
|
69
|
-
|
70
|
-
assets.write_to filename
|
82
|
+
public_filename = public_assets.join filename(file)
|
83
|
+
sprockets[file].write_to public_filename
|
71
84
|
end
|
72
85
|
end
|
73
86
|
|
74
87
|
def clean
|
75
|
-
public_assets.rmtree
|
88
|
+
public_assets.rmtree if public_assets.exist?
|
76
89
|
end
|
77
90
|
end
|
78
91
|
end
|
data/lib/tasks/sprockets.rake
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
task :compile => :build
|
1
|
+
namespace :assets do
|
2
|
+
desc "Build all assets into public"
|
3
|
+
task :compile do
|
4
|
+
Rake::Sprockets.compile
|
5
|
+
end
|
7
6
|
|
8
|
-
desc "Remove all asset files in public"
|
9
|
-
task :clean do
|
10
|
-
|
7
|
+
desc "Remove all asset files in public"
|
8
|
+
task :clean do
|
9
|
+
Rake::Sprockets.clean
|
10
|
+
end
|
11
11
|
end
|