forked from scrooloose/snipmate-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
29 lines (25 loc) · 1003 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#require 'fileutils'
#include FileUtils
namespace :snippets_dir do
task :find do
vim_dir = File.join(ENV['VIMFILES'] || ENV['HOME'] || ENV['USERPROFILE'], RUBY_PLATFORM =~ /mswin|msys|mingw32/ ? "vimfiles" : ".vim")
possible_dirs = [
File.join(vim_dir, 'snippets'),
File.join(vim_dir, 'bundle', 'snipmate', 'snippets'),
File.join(vim_dir, 'bundle', 'snipmate.vim', 'snippets')
]
@snippets_dir = possible_dirs.find{ |dir| File.directory? dir }
end
desc "Purge the contents of the vim snippets directory"
task :purge => ["snippets_dir:find"] do
rm_rf @snippets_dir, :verbose => true if File.directory? @snippets_dir
mkdir @snippets_dir, :verbose => true
end
end
desc "Copy the snippets directories into ~/.vim/snippets"
task :deploy_local => ["snippets_dir:purge"] do
Dir.foreach(".") do |f|
cp_r f, @snippets_dir, :verbose => true if File.directory?(f) && f =~ /^[^\.]/
end
cp "support_functions.vim", @snippets_dir, :verbose => true
end