Created
November 6, 2011 16:15
-
-
Save smallstyle/1343103 to your computer and use it in GitHub Desktop.
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
# -*- coding: utf-8 -*- | |
require 'pathname' | |
task "default" => ["show", "unlink", "symlink"] | |
HOME = Pathname.new("~") | |
dotfiles = FileList["dot.*"].map{|f| Pathname.new( f ) } | |
desc "処理対象のファイルを表示" | |
task "show" do | |
dotfiles.each do |file| | |
puts file.expand_path | |
end | |
end | |
desc "symlinkを消す" | |
task "unlink" => "show" do | |
dotfiles.each do |file| | |
begin | |
HOME.expand_path.join( file.basename.sub( /dot/, '' ) ).unlink | |
rescue | |
end | |
end | |
end | |
desc "symlinkを作る" | |
task "symlink" => "unlink" do | |
dotfiles.each do |file| | |
HOME.expand_path.join( file.basename.sub( /dot/, '' ) ).make_symlink( file.expand_path ) | |
end | |
end | |
desc "初期化する" | |
task "init" => "symlink" do | |
system( "git submodule init" ) | |
system( "git submodule update" ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment