Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Stick this in your homedir repo. Run rake. Watch in amazement as it symlinks everything.
require 'find'
BLACKLIST = %w[
.git
.gitignore
Rakefile
]
task :default do
Find.find('.') do |path|
next if path == '.'
Find.prune if BLACKLIST.include? path.sub(%r{^\./}, '')
if File.directory? path
dir = File.expand_path("~/#{path}")
system "mkdir -p #{dir}"
next
elsif File.file? path
source = File.expand_path("../#{path}", __FILE__)
target = File.expand_path("~/#{path}")
system "ln -sf '#{source}' '#{target}'"
else
puts "Don't know how to deal with '#{path}', it's not a dir or file."
end
end
end
@fooblahblah

This comment has been minimized.

Copy link

fooblahblah commented Jan 2, 2013

Does this do the same-ish thing?

$ find . -type d -exec echo "mkdir -p /tmp/{}" ; -or -type f -exec echo "ln -sf /tmp/{}" ; -or -type l -exec echo "ln -sf /tmp/{}" ; -or -exec echo "**** {} not sure" ;

@briandoll

This comment has been minimized.

Copy link

briandoll commented Jan 2, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.