| 15 | | Dir.glob("#{base_dir}/#{prefix}*.js").collect do |src_path| |
|---|
| 16 | | dest_path = src_path.sub(pattern, replace) |
|---|
| 17 | | data = compress_js(src_path) |
|---|
| 18 | | write_js(dest_path, data) |
|---|
| | 22 | Dir.glob("#{base_dir}/#{options[:prefix]}*.js").collect do |src_path| |
|---|
| | 23 | dest_path = src_path.sub(options[:pattern], options[:replace]) |
|---|
| | 24 | if options[:tmp_file] |
|---|
| | 25 | temp = Tempfile::new('tmp.js', base_dir) |
|---|
| | 26 | open(src_path) do |f| |
|---|
| | 27 | f.each do |line| |
|---|
| | 28 | temp.puts(line.sub(%r|//.*$|, '')) |
|---|
| | 29 | end |
|---|
| | 30 | end |
|---|
| | 31 | temp.close |
|---|
| | 32 | data = compress_js(temp.path) |
|---|
| | 33 | temp.close(true) |
|---|
| | 34 | else |
|---|
| | 35 | data = compress_js(src_path) |
|---|
| | 36 | write_js(dest_path, data) |
|---|
| | 37 | end |
|---|