Skip to content

Instantly share code, notes, and snippets.

@shuntaroy
Last active Aug 29, 2015
Embed
What would you like to do?
Make symlinks of .tex and .pdf in local folder into ~/Dropbox/LaTeX with the same directory tree as the local folder.
# Rakefile of TeXdocuments symlink
require "rake/clean"
CURRENT = Dir.pwd + '/'
DROPBOX = Dir.home + '/Dropbox/LaTeX/'
TARGETS = FileList['**/*.pdf', '**/*.tex']
GENERATE_DIRS = TARGETS.map { |p| DROPBOX + File.dirname(p)}.uniq.sort
GENERATED = FileList[DROPBOX + '**/*.pdf', DROPBOX + '**/*.tex']
CLEAN.include(GENERATED)
CLOBBER.include("main")
task :default => :main
# directory
GENERATE_DIRS.each do |dirpath|
directory dirpath
end
desc "Make symlink to Dropbox"
file :main => GENERATE_DIRS do
TARGETS.each do |fpath|
ln_s CURRENT+fpath, DROPBOX+fpath, force: true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment