This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compress(file) | |
raise unless system("rm -rf tmp/") | |
raise unless system("unzip -q -o -d tmp/ '#{file}'") | |
raise unless system("imageOptim --directory tmp/ ") | |
raise unless system("pushd tmp/ && zip -q -9 -rX '#{file}' 'mimetype' '*' && popd") | |
end | |
def filesize(file) | |
'%.2f' % (File.size(file).to_f / 2**20) | |
end |