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 curRev = `git rev-parse --verify HEAD`.chomp()
71 expRev = IO.read('doc/html-revision').chomp()
73 raise ("The HTML rev: #{expRev},\n" +
74 "current rev: #{curRev}!\n")
76 if !system "git diff-index --quiet HEAD"
77 system "git status --untracked-files=no"
78 raise "You have uncommitted changes!"
80 Dir.chdir 'doc/gh-pages' do
81 sh "git commit -a -m 'Automatic documentation update.\n\n" +
82 "From #{curRev.chomp()}'"
89 desc "Compile yasnippet.el into yasnippet.elc"
91 rule '.elc' => '.el' do |t|
92 sh "#{$EMACS} --batch -L . --eval \"(byte-compile-file \\\"#{t.source}\\\")\""
94 task :compile => FileList["yasnippet.el"].ext('elc')
98 desc "use yasmate to convert textmate bundles"
99 task :convert_bundles do
101 sh "rake convert_bundles"