Skip to content

Instantly share code, notes, and snippets.

@lukemelia
Created November 10, 2011 15:24
Show Gist options
  • Save lukemelia/1355108 to your computer and use it in GitHub Desktop.
Save lukemelia/1355108 to your computer and use it in GitHub Desktop.
symlinks_to_materialize.each do |symlink|
source = print_and_execute("readlink #{symlink}").chomp
source = File.expand_path(symlink + "/../" + source)
source_type = `file #{source} `.chomp.split(':')[1].strip().to_sym
print_and_execute("rm #{symlink}")
case source_type
when :directory
print_and_execute("cp -R #{source} #{symlink}")
when :file
print_and_execute("cp #{source} #{symlink}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment