From 50ba4f3821c97a9f471494bc9d10b30f559b31c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Tue, 5 Sep 2023 01:28:07 +0100 Subject: [PATCH] Replace Rakefile with Makefile * Makefile: New file * Rakefile: Delete --- Makefile | 46 ++++++++++++++++++ README.mdown | 4 -- Rakefile | 130 --------------------------------------------------- 3 files changed, 46 insertions(+), 134 deletions(-) create mode 100644 Makefile delete mode 100644 Rakefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6af7f80 --- /dev/null +++ b/Makefile @@ -0,0 +1,46 @@ +### Makefile for Yasnippet (stolen from Eglot) +# Variables +# +EMACS?=emacs +SELECTOR?=t +ERROR_ON_WARN=nil + +LOAD_PATH=-L . + +ELFILES := yasnippet.el yasnippet-tests.el +ELCFILES := $(ELFILES:.el=.elc) + +BYTECOMP_ERROR_ON_WARN := \ + --eval '(setq byte-compile-error-on-warn $(ERROR_ON_WARN))' + +all: compile + +%.elc: %.el + $(EMACS) -Q $(BYTECOMP_ERROR_ON_WARN) $(LOAD_PATH) \ + --batch -f batch-byte-compile $< + +compile: $(ELCFILES) + +# Automated tests +# +yasnippet-check: compile + $(EMACS) -Q --batch \ + $(LOAD_PATH) \ + -l yasnippet \ + -l yasnippet-tests \ + --eval '(setq ert-batch-backtrace-right-margin 200)' \ + --eval '(ert-run-tests-batch-and-exit (quote $(SELECTOR)))' + +interactive: compile + $(EMACS) -Q \ + $(LOAD_PATH) \ + -l yasnippet \ + -l yasnippet-tests \ + +check: yasnippet-check + +# Cleanup +# +clean: + find . -iname '*.elc' -exec rm {} \; +.PHONY: all compile clean check diff --git a/README.mdown b/README.mdown index b30d520..ab91565 100644 --- a/README.mdown +++ b/README.mdown @@ -71,10 +71,6 @@ get some! To use these snippets you have to run the tool first, so [see its doc][yasmate]), and then point the `yas-snippet-dirs` variable to the `.../yasmate/snippets` subdir. - - If you have a working ruby environment, you can probably get lucky - directly with `rake convert-bundles`. - 3. [textmate-to-yas.el] This is another textmate bundle converting tool using Elisp diff --git a/Rakefile b/Rakefile deleted file mode 100644 index c63d269..0000000 --- a/Rakefile +++ /dev/null @@ -1,130 +0,0 @@ -# -*- Ruby -*- - -require 'fileutils' - -$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.]+?) *$/ - $version = $1 -end -find_version -FileUtils.mkdir_p('pkg') - -desc "run tests in batch mode" -task :tests do - sh "#{$EMACS} -Q -L . -l yasnippet-tests.el" + - " --batch -f ert-run-tests-batch-and-exit" -end - -desc "run test in interactive mode" -task :itests do - sh "#{$EMACS} -Q -L . -l yasnippet-tests.el" + - " --eval \"(call-interactively 'ert)\"" -end - -desc "create a release package" -task :package do - release_dir = "pkg/yasnippet-#{$version}" - FileUtils.mkdir_p(release_dir) - files = ['snippets', 'yasnippet.el'] - FileUtils.cp_r files, release_dir - File.open(File.join(release_dir,'yasnippet-pkg.el'), 'w') do |file| - file.puts < [:package, 'doc:archive'] do - raise "Not implemented for github yet!" -end - -# rake doc[../htmlize] -# -# To do this interactively, load doc/yas-doc-helper, open one of the -# org files, and do `C-c C-e P'. -desc "Generate document" -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 - release_dir = "pkg/yasnippet-#{$version}" - FileUtils.mkdir_p(release_dir) - sh "tar cjf pkg/yasnippet-doc-#{$version}.tar.bz2 " + - "--exclude=doc/.svn --exclude=doc/images/.svn doc/*.html doc/images" - end - - task :upload do - if File.exists? 'doc/gh-pages' - Dir.chdir 'doc/gh-pages' do - sh "git checkout gh-pages" - end - Dir.glob("doc/*.{html,css}").each do |file| - FileUtils.cp file, 'doc/gh-pages' - end - 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 describe`.chomp() - expRev = IO.read('doc/html-revision').chomp() - if curRev != expRev - raise ("The HTML rev: #{expRev},\n" + - "current rev: #{curRev}!\n") - end - Dir.chdir 'doc/gh-pages' do - sh "git commit -a -m 'Automatic documentation update.\n\n" + - "From #{curRev.chomp()}'" - sh "git push" - end - end - end -end - -desc "Compile yasnippet.el into yasnippet.elc" - -rule '.elc' => '.el' do |t| - cmdline = $EMACS + ' --batch -L .' - if ENV['warnings'] - cmdline += " --eval \"(setq byte-compile-warnings #{ENV['warnings']})\"" - end - if ENV['Werror'] - cmdline += " --eval \"(setq byte-compile-error-on-warn #{ENV['Werror']})\"" - end - if ENV['Wlexical'] - cmdline += " --eval \"(setq byte-compile-force-lexical-warnings #{ENV['Wlexical']})\"" - end - cmdline +=" -f batch-byte-compile #{t.source}" - - sh cmdline -end -task :compile => FileList["yasnippet.el"].ext('elc') -task :compile_all => FileList["*.el"].ext('elc') - -task :default => :doc - -desc "use yasmate to convert textmate bundles" -task :convert_bundles do - cd "yasmate" - sh "rake convert_bundles" - end