Source

utils / mklnk

Full commit
#!/usr/bin/env ruby
#
# name:      mklnk, make symlink for executable file
# author:    Xu Xiaodong <xxdlhy@gmail.com>
# license:   GPL
# created:   2011 Apr 27
# modified:  2011 Oct 30
#

require 'find'
require 'fileutils'

home = Dir.home
path = home + '/code'

Find.find(path) do |f|
  if File.file?(f) and File.executable?(f)
    desc = home + '/bin/' + File.basename(f)
    puts "symlinking #{f} to #{desc}"
    FileUtils.symlink(f, desc, force: true)
  end
  Find.prune if f =~ /\.vim/
end

# vim: ai:et:ts=2:sw=2:sts=2:tw=78:ft=ruby