Skip to content

Instantly share code, notes, and snippets.

@tkfm-yamaguchi
Created July 28, 2014 01:37
Show Gist options
  • Save tkfm-yamaguchi/c3c7f97f2cf087d2c712 to your computer and use it in GitHub Desktop.
Save tkfm-yamaguchi/c3c7f97f2cf087d2c712 to your computer and use it in GitHub Desktop.
usage of String#ext ( injected by rake )
# coding: utf-8
require "pathname"
require "rake"
module DIR
ROOT = Pathname(__dir__)
ORG = ROOT.join("org")
OUT = ROOT.join("out")
end
task :default do
Pathname.glob(DIR::ORG.join("*.png")).each do |path|
size = path.basename.to_s.ext("")
out_path = DIR::OUT.join(size, "vim.png")
mkdir_p out_path.dirname
cp path, out_path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment