]> code.delx.au - gnu-emacs-elpa/blobdiff - Rakefile
Don't indent empty lines in snippet expansion
[gnu-emacs-elpa] / Rakefile
index fe25bcccd76e15fa130b914b7309815f73a33e72..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,19 +16,8 @@ FileUtils.mkdir_p('pkg')
 
 desc "run tests in batch mode"
 task :tests do
-  sh "#{$EMACS} -Q -L . -l yasnippet-tests.el -nw --batch -e yas-batch-run-tests"
-end
-
-desc "convert some textmate bundles to yasnippets"
-task :convert_bundles do
-  Dir.glob "extras/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 = "./extras/imported/#{mode_prefix}-mode"
-    FileUtils.mkdir_p output
-    sh "./extras/textmate_import.rb -d #{bundle_dir} -o #{output} -q"
-  end
+  sh "#{$EMACS} -Q -L . -l yasnippet-tests.el" +
+    " --batch -f ert-run-tests-batch-and-exit"
 end
 
 desc "create a release package"
@@ -52,11 +44,15 @@ task :release => [:package, 'doc:archive'] do
   raise "Not implemented for github yet!"
 end
 
-rule '.html' => '.rst' do |t|
-  sh "doc/compile-doc.py #{t.source} > #{t.name}"
-end
 desc "Generate document"
-task :doc => FileList['doc/*.rst'].ext('html')
+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
 
 namespace :doc do
   task :archive do
@@ -77,8 +73,22 @@ namespace :doc do
       Dir.glob("doc/images/*").each do |file|
         FileUtils.cp file, 'doc/gh-pages/images'
       end
+      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.'"
+        sh "git commit -a -m 'Automatic documentation update.\n\n" +
+          "From #{curRev.chomp()}'"
         sh "git push"
       end
     end
@@ -88,8 +98,15 @@ 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')
 
 task :default => :doc
+
+desc "use yasmate to convert textmate bundles"
+task :convert_bundles do
+      cd "yasmate"
+      sh "rake convert_bundles"
+    end