cache-with-yuicompressor 0.1.1 → 0.1.2
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/VERSION +1 -1
- data/cache-with-yuicompressor.gemspec +1 -1
- data/lib/cache-with-yuicompressor.rb +7 -3
- metadata +2 -2
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.2
|
|
@@ -8,17 +8,21 @@ module ActionView
|
|
|
8
8
|
|
|
9
9
|
begin
|
|
10
10
|
# remove console.log calls
|
|
11
|
+
temp_file_path = joined_asset_path + ".tmp"
|
|
11
12
|
f = File.open(joined_asset_path)
|
|
12
|
-
fo = File.new(
|
|
13
|
+
fo = File.new(temp_file_path, "w")
|
|
13
14
|
f.each {|line|
|
|
14
15
|
fo.puts line.gsub(/console.(log|debug|info|warn|error|assert|dir|dirxml|trace|group|groupEnd|time|timeEnd|profile|profileEnd|count)\((.*)\);?/,"");
|
|
15
16
|
}
|
|
16
17
|
fo.close
|
|
17
18
|
f.close
|
|
18
19
|
|
|
20
|
+
# copy the file to the joined_asset_path
|
|
21
|
+
system("cp #{temp_file_path} #{joined_asset_path}")
|
|
22
|
+
|
|
23
|
+
# ask yui compressor to compress the file
|
|
19
24
|
jarpath = File.dirname(__FILE__) + "/yuicompressor-2.4.2.jar";
|
|
20
|
-
|
|
21
|
-
cmd = "java -jar #{jarpath} temp_#{joined_asset_path} -o #{joined_asset_path}"
|
|
25
|
+
cmd = "java -jar #{jarpath} #{joined_asset_path} -o #{joined_asset_path}"
|
|
22
26
|
ret = system(cmd)
|
|
23
27
|
rescue
|
|
24
28
|
end
|