Created
February 6, 2013 02:59
-
-
Save andrewplummer/4719852 to your computer and use it in GitHub Desktop.
Dump an icomoon zip file into a given directory and rearrange the files a bit.
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
| #!/usr/bin/env ruby | |
| abort "Need path to .zip!" if ARGV[0].nil? | |
| abort "Need path to font directory!" if ARGV[1].nil? | |
| full_path = ARGV[0] | |
| target_path = ARGV[1] | |
| filename = full_path.split('/').last.split('.').first | |
| filename_no_num = filename.gsub(/\d+$/, '') | |
| tmp_dir = File.directory?('tmp') ? 'tmp/' : '/tmp/' | |
| tmp_full_path = tmp_dir + filename | |
| `unzip #{full_path} -d #{tmp_dir}` | |
| `mkdir -p #{target_path}` | |
| `mkdir -p #{target_path}/list` | |
| `sed -i 's/fonts\\/#{filename_no_num}/..\\/#{filename_no_num}/g' #{tmp_full_path}/style.css` | |
| `mv #{tmp_full_path}/fonts/* #{target_path}` | |
| `mv #{tmp_full_path}/index.html #{target_path}/list` | |
| `mv #{tmp_full_path}/style.css #{target_path}/list` | |
| `rm -rf #{tmp_full_path}` | |
| puts "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment