5 $EMACS=ENV["EMACS"] || "emacs"
8 File.read("yasnippet.el", :encoding => "UTF-8") =~ /;; Package-version: *([0-9.]+?) *$/
12 FileUtils.mkdir_p('pkg')
14 desc "run tests in batch mode"
16 batch_run_line = "(yas-batch-run-tests t)"
17 sh "#{$EMACS} -Q -L . -l yasnippet-tests.el -nw" +
18 " --batch --eval '#{batch_run_line}'"
21 desc "create a release package"
23 release_dir = "pkg/yasnippet-#{$version}"
24 FileUtils.mkdir_p(release_dir)
25 files = ['snippets', 'yasnippet.el']
26 FileUtils.cp_r files, release_dir
27 File.open(File.join(release_dir,'yasnippet-pkg.el'), 'w') do |file|
29 (define-package "yasnippet"
31 "A template system for Emacs")
34 sh "git clean -f snippets"
36 sh "tar cf yasnippet-#{$version}.tar yasnippet-#{$version}"
40 desc "create a release package and upload it to google code"
41 task :release => [:package, 'doc:archive'] do
42 raise "Not implemented for github yet!"
45 desc "Generate document"
47 sh "#{$EMACS} -Q -L . --batch -l doc/yas-doc-helper.el" +
48 " -f yas--generate-html-batch"
53 release_dir = "pkg/yasnippet-#{$version}"
54 FileUtils.mkdir_p(release_dir)
55 sh "tar cjf pkg/yasnippet-doc-#{$version}.tar.bz2 " +
56 "--exclude=doc/.svn --exclude=doc/images/.svn doc/*.html doc/images"
60 if File.exists? 'doc/gh-pages'
61 Dir.chdir 'doc/gh-pages' do
62 sh "git checkout gh-pages"
64 Dir.glob("doc/*.{html,css}").each do |file|
65 FileUtils.cp file, 'doc/gh-pages'
67 Dir.glob("doc/images/*").each do |file|
68 FileUtils.cp file, 'doc/gh-pages/images'
70 rev = `git rev-parse --verify HEAD`
71 Dir.chdir 'doc/gh-pages' do
72 sh "git commit -a -m 'Automatic documentation update.\n\n" +
73 "From #{rev.chomp()}'"
80 desc "Compile yasnippet.el into yasnippet.elc"
82 rule '.elc' => '.el' do |t|
83 sh "#{$EMACS} --batch -L . --eval \"(byte-compile-file \\\"#{t.source}\\\")\""
85 task :compile => FileList["yasnippet.el"].ext('elc')
89 desc "use yasmate to convert textmate bundles"
90 task :convert_bundles do
92 sh "rake convert_bundles"