Skip to content

Instantly share code, notes, and snippets.

@smallstyle

smallstyle/Rakefile

Created Nov 6, 2011
Embed
What would you like to do?
# -*- 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