]> code.delx.au - gnu-emacs-elpa/blobdiff - Rakefile
Don't indent empty lines in snippet expansion
[gnu-emacs-elpa] / Rakefile
index 278120dc89230cef09219490220fc56dfd5706ec..f88237bd762c58433d2719c2668f41086cd8e220 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -2,7 +2,10 @@
 
 require 'fileutils'
 
-$EMACS=ENV["EMACS"] || "emacs"
+$EMACS = ENV["EMACS"]
+if not $EMACS or $EMACS == 't'
+  $EMACS = "emacs"
+end
 
 def find_version
   File.read("yasnippet.el", :encoding => "UTF-8") =~ /;; Package-version: *([0-9.]+?) *$/
@@ -13,9 +16,8 @@ FileUtils.mkdir_p('pkg')
 
 desc "run tests in batch mode"
 task :tests do
-  batch_run_line = "(yas-batch-run-tests t)"
-  sh "#{$EMACS} -Q -L . -l yasnippet-tests.el -nw" +
-    " --batch --eval '#{batch_run_line}'"
+  sh "#{$EMACS} -Q -L . -l yasnippet-tests.el" +
+    " --batch -f ert-run-tests-batch-and-exit"
 end
 
 desc "create a release package"
@@ -43,8 +45,12 @@ task :release => [:package, 'doc:archive'] do
 end
 
 desc "Generate document"
-task :doc do
-  sh "#{$EMACS} -Q -L . --batch -l doc/yas-doc-helper.el" +
+task :doc, [:htmlize] do |t, args|
+  load_path = '-L .'
+  if args[:htmlize]
+    load_path += " -L #{args[:htmlize]}"
+  end
+  sh "#{$EMACS} -Q #{load_path} --batch -l doc/yas-doc-helper.el" +
     " -f yas--generate-html-batch"
 end
 
@@ -67,10 +73,22 @@ namespace :doc do
       Dir.glob("doc/images/*").each do |file|
         FileUtils.cp file, 'doc/gh-pages/images'
       end
-      rev = `git rev-parse --verify HEAD`
+      Dir.glob("doc/stylesheets/*.css").each do |file|
+        FileUtils.cp file, 'doc/gh-pages/stylesheets'
+      end
+      curRev = `git rev-parse --verify HEAD`.chomp()
+      expRev = IO.read('doc/html-revision').chomp()
+      if curRev != expRev
+        raise ("The HTML rev: #{expRev},\n" +
+               "current  rev: #{curRev}!\n")
+      end
+      if !system "git diff-index --quiet HEAD"
+        system "git status --untracked-files=no"
+        raise "You have uncommitted changes!"
+      end
       Dir.chdir 'doc/gh-pages' do
         sh "git commit -a -m 'Automatic documentation update.\n\n" +
-          "From #{rev.chomp()}'"
+          "From #{curRev.chomp()}'"
         sh "git push"
       end
     end
@@ -80,7 +98,8 @@ end
 desc "Compile yasnippet.el into yasnippet.elc"
 
 rule '.elc' => '.el' do |t|
-  sh "#{$EMACS} --batch -L . --eval \"(byte-compile-file \\\"#{t.source}\\\")\""
+  sh "#{$EMACS} --batch -L . --eval \"(setq byte-compile-error-on-warn t)\"" +
+     " -f batch-byte-compile #{t.source}"
 end
 task :compile => FileList["yasnippet.el"].ext('elc')