Skip to content

Instantly share code, notes, and snippets.

@smallstyle
Created November 6, 2011 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smallstyle/1343103 to your computer and use it in GitHub Desktop.
Save smallstyle/1343103 to your computer and use it in GitHub Desktop.
# -*- 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