Created
October 26, 2011 13:34
-
-
Save hsbt/1316353 to your computer and use it in GitHub Desktop.
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
# -*- coding: utf-8 -*- | |
require 'pathname' | |
task "default" => ["show", "unlink", "symlink"] | |
HOME = Pathname.new("~") | |
dotfiles =[] | |
%w(public private).each do |path| | |
dotfiles += Pathname.glob("#{path}/dot.[a-zA-Z0-9]*") | |
end | |
desc "処理対象のファイルを表示" | |
task "show" do | |
dotfiles.each do |file| | |
puts file.expand_path | |
end | |
end | |
desc "symlinkを消す" | |
task "unlink" do | |
dotfiles.each do |file| | |
begin | |
HOME.expand_path.join(file.basename.sub(/dot/, '')).unlink | |
rescue | |
end | |
end | |
end | |
desc "symlinkを作る" | |
task "symlink" do | |
dotfiles.each do |file| | |
HOME.expand_path.join(file.basename.sub(/dot/, '')).make_symlink(file.expand_path) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment