cache-with-yuicompressor 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cache-with-yuicompressor}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Amol Kelkar"]
@@ -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("temp_" + joined_asset_path, "w")
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
- #puts "JAR Path : #{jarpath}"
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Amol Kelkar