forked from joaotavora/yasmate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
24 lines (23 loc) · 1.09 KB
/
Rakefile
File metadata and controls
24 lines (23 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
desc "convert some textmate bundles to yasnippets"
task :convert_bundles do
Dir.glob "bundles/*-tmbundle" do |bundle_dir|
puts "Converting from #{bundle_dir}"
mode_prefix = File.basename(bundle_dir).match(/[^-]*/)[0]
raise "Couldn't guess mode name for #{bundle_dir}" unless mode_prefix
output = "snippets/#{mode_prefix}-mode"
FileUtils.mkdir_p output
sh "./yasmate.rb -d #{bundle_dir} -o #{output} -q"
end
end
task :clean do
# this should spare empty dirs
Dir.glob("snippets/*/*/").each do |dir|
FileUtils.rm_rf dir unless File.exists?("#{dir}/.yas-skip")
end
# this should delete all files starting with ".yas", sparing
# just ".yas-setup.el" and ".yas-extra-substitutions.el"
# autogenerated ones
Dir.glob("snippets/*/.yas*").each do |file|
File.delete(file) unless [".yas-setup.el", ".yasmate-extra-substitutions.el"].include?(File.basename(file))
end
end