Created
May 18, 2014 01:10
-
-
Save ren/6af84e4302f0fb558f33 to your computer and use it in GitHub Desktop.
iOS .imageset generator
This file contains 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 | |
contents_json = Dir["**/Contents.json"] | |
contents_json.each do |file| | |
newline = "\"filename\" : \"#{(file.split('/')[1]).gsub('.imageset', '.jpg')}\"" | |
new_contents = "{ | |
\"images\" : [ | |
{ | |
\"idiom\" : \"universal\", | |
\"scale\" : \"1x\" | |
}, | |
{ | |
\"idiom\" : \"universal\", | |
\"scale\" : \"2x\", | |
#{newline} | |
} | |
], | |
\"info\" : { | |
\"version\" : 1, | |
\"author\" : \"xcode\" | |
} | |
}" | |
f = File.new(file, "w") | |
f.write new_contents | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment