From 7ef1a2e2bb33a9c05694ea69c02179d9abbc213f Mon Sep 17 00:00:00 2001 From: Frank Fischer Date: Wed, 8 Apr 2015 11:45:59 +0200 Subject: add `evilupdate.el` script --- Makefile | 20 +----- evil-command-window.el | 2 +- evil-commands.el | 2 +- evil-common.el | 2 +- evil-core.el | 2 +- evil-digraphs.el | 2 +- evil-ex.el | 2 +- evil-integration.el | 2 +- evil-macros.el | 2 +- evil-maps.el | 2 +- evil-pkg.el | 2 +- evil-repeat.el | 2 +- evil-search.el | 2 +- evil-states.el | 2 +- evil-tests.el | 2 +- evil-types.el | 2 +- evil-vars.el | 4 +- evil.el | 2 +- scripts/evilupdate | 162 +++++++++++++++++++++++++++++++++++++++++++++++++ 19 files changed, 181 insertions(+), 37 deletions(-) create mode 100755 scripts/evilupdate diff --git a/Makefile b/Makefile index 96fdde7..9a74fa2 100644 --- a/Makefile +++ b/Makefile @@ -112,24 +112,6 @@ elpa: # Change the version using make VERSION=x.y.z version: - $(EMACS) --batch --eval '(setq vc-handled-backends nil)' ${FILES} evil-tests.el -Q \ ---eval "\ -(progn \ - (find-file \"evil-vars.el\") \ - (when (re-search-forward \"^(defconst evil-version \\\"\\\\([-_.[:word:]]*\\\\)\\\"\" nil t) \ - (replace-match \"${VERSION}\" t t nil 1)) \ - (find-file \"evil-pkg.el\") \ - (goto-line 3) \ - (when (and (string-match-p \"[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+\" \"${VERSION}\") \ - (re-search-forward \"\\\"\\\\([-_.[:word:]]*\\\\)\\\"\" nil t)) \ - (replace-match \"${VERSION}\" t t nil 1)) \ - (dolist (buffer (reverse (buffer-list))) \ - (when (buffer-file-name buffer) \ - (set-buffer buffer) \ - (goto-char (point-min)) \ - (when (re-search-forward \"^;;[[:space:]]*Version:[[:space:]]*\\\\([-_.[:word:]]*\\\\)\" nil t) \ - (replace-match \"${VERSION}\" t t nil 1)) \ - (when (buffer-modified-p) (save-buffer 0))))) \ -" + @$(EMACS) --script scripts/evilupdate "${VERSION}" diff --git a/evil-command-window.el b/evil-command-window.el index 41848d3..55f4d46 100644 --- a/evil-command-window.el +++ b/evil-command-window.el @@ -2,7 +2,7 @@ ;; Author: Emanuel Evans ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-commands.el b/evil-commands.el index 46001c9..709cdf4 100644 --- a/evil-commands.el +++ b/evil-commands.el @@ -2,7 +2,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-common.el b/evil-common.el index ca54097..baca4cc 100644 --- a/evil-common.el +++ b/evil-common.el @@ -2,7 +2,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-core.el b/evil-core.el index 5772b5b..36da880 100644 --- a/evil-core.el +++ b/evil-core.el @@ -2,7 +2,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-digraphs.el b/evil-digraphs.el index 9b2e3a2..743d322 100644 --- a/evil-digraphs.el +++ b/evil-digraphs.el @@ -3,7 +3,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-ex.el b/evil-ex.el index 948a3a6..173d536 100644 --- a/evil-ex.el +++ b/evil-ex.el @@ -3,7 +3,7 @@ ;; Author: Frank Fischer ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-integration.el b/evil-integration.el index 463c006..73f629c 100644 --- a/evil-integration.el +++ b/evil-integration.el @@ -3,7 +3,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-macros.el b/evil-macros.el index 16d2429..99f91c1 100644 --- a/evil-macros.el +++ b/evil-macros.el @@ -3,7 +3,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-maps.el b/evil-maps.el index 6c8e8f9..9f63308 100644 --- a/evil-maps.el +++ b/evil-maps.el @@ -3,7 +3,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-pkg.el b/evil-pkg.el index f904563..782f3e1 100644 --- a/evil-pkg.el +++ b/evil-pkg.el @@ -1,6 +1,6 @@ (define-package "evil" - "1.0.9" + "1.1.1" "Extensible Vi layer for Emacs." '((undo-tree "0.6.3") (goto-chg "1.6"))) diff --git a/evil-repeat.el b/evil-repeat.el index 33abf77..b68c0cb 100644 --- a/evil-repeat.el +++ b/evil-repeat.el @@ -3,7 +3,7 @@ ;; Author: Frank Fischer ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-search.el b/evil-search.el index 9814f24..e820860 100644 --- a/evil-search.el +++ b/evil-search.el @@ -3,7 +3,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-states.el b/evil-states.el index 835ae09..3594f68 100644 --- a/evil-states.el +++ b/evil-states.el @@ -3,7 +3,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-tests.el b/evil-tests.el index 977c2de..da9f36e 100644 --- a/evil-tests.el +++ b/evil-tests.el @@ -3,7 +3,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-types.el b/evil-types.el index 23a0dd9..a7e3840 100644 --- a/evil-types.el +++ b/evil-types.el @@ -3,7 +3,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. diff --git a/evil-vars.el b/evil-vars.el index bd49a55..62e400e 100644 --- a/evil-vars.el +++ b/evil-vars.el @@ -3,7 +3,7 @@ ;; Author: Vegard Øye ;; Maintainer: Vegard Øye -;; Version: 1.0.9 +;; Version: 1.1.1 ;; ;; This file is NOT part of GNU Emacs. @@ -1689,7 +1689,7 @@ Otherwise the previous command is assumed as substitute.") (goto-char (point-min)) (buffer-substring (point-min) (line-end-position))) ;; no repo, use plain version - (t "1.0-dev"))))) + (t "1.1.1"))))) "The current version of Evil") (defun evil-version () diff --git a/evil.el b/evil.el index ddacbe7..40f4733 100644 --- a/evil.el +++ b/evil.el @@ -42,7 +42,7 @@ ;; To get in touch, please use the bug tracker or the ;; mailing list (see below). ;; Created: 2011-03-01 -;; Version: 1.0.9 +;; Version: 1.1.1 ;; Keywords: emulation, vim ;; URL: http://gitorious.org/evil ;; Repository: git://gitorious.org/evil/evil.git diff --git a/scripts/evilupdate b/scripts/evilupdate new file mode 100755 index 0000000..8efe4a2 --- /dev/null +++ b/scripts/evilupdate @@ -0,0 +1,162 @@ +#!/usr/bin/emacs --script +;;; evilupate.el -- Publishing script for Evil + +;;; Header: + +;; This file is not part of Emacs + +;; Author: Frank Fischer +;; Maintainer: Frank Fischer +;; Version: 1.0 +;; Package-Requires: ((emacs "24.3") (s "1.9.0") (f "0.17.2") yaoddmuse) + +;; The contents of this file are subject to the GPL License, Version 3.0. + +;; Copyright (C) 2015, Frank Fischer + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; This is a small script to update Evil's version at certain places: +;; +;; - topic of the IRC channel #evil-mode in irc.freenode.net +;; - EmacsWiki page +;; - header of all source files +;; - the ELPA package file +;; +;; The script should be invoked with the new version string +;; +;; evil-update.el 1.2.3 +;; + +;;; Code: + +(package-initialize) + +(require 'f) +(require 'erc) +(require 'yaoddmuse) +(eval-when-compile (require 'cl)) + +(defconst evilupdate-irc-nick "#lyrobot") +(defconst evilupdate-irc-channel "#evil-mode") +(defconst evilupdate-irc-topic + "Evil = Extensible vi layer for Emacs | Current version: VERSION | http://gitorious.org/evil | If you don't get an answer here, please use the mailing-list implementations-list@lists.ourproject.org") +(defconst evilupdate-wiki-page "Evil") +(defvar evilupdate-version "1.0.0") +(defvar evilupdate-done nil) + +(defun evilupdate-wait () + "Wait until `evilupdate-done' is set to t." + (while (not evilupdate-done) + (sleep-for 1)) + (setq evilupdate-done nil)) + +(defun evilupdate-done () + "Set `evilupdate-done' to t to stop the corresponding `evilupdate-wait'." + (setq evilupdate-done t)) + +(defun evilupdate-update-irc () + "Update the topic of the IRC channel." + (erc-tls :server "irc.freenode.net" :port "6697" :nick "lyrobot") + (add-hook 'erc-join-hook + (lambda () + (let (case-fold-search) + (erc-set-topic (replace-regexp-in-string "VERSION" + evilupdate-version + evilupdate-irc-topic + nil t))) + (erc-quit-server "") + (evilupdate-done))) + (erc-join-channel evilupdate-irc-channel) + (evilupdate-wait)) + +(defun evilupdate-wiki-trace (page-buffer-name) + "Callback for updating the EmacsWiki page in buffer PAGE-BUFFER-NAME." + (with-current-buffer page-buffer-name + (goto-char (point-min)) + (when (re-search-forward "Current stable version: \\*\\*\\([^*]*\\)\\*\\*") + (goto-char (match-beginning 1)) + (delete-region (match-beginning 1) (match-end 1)) + (insert evilupdate-version) + (yaoddmuse-post-current-buffer nil) + (evilupdate-done)))) + +(defun evilupdate-update-emacswiki () + "Update the version information on the EmacsWiki page." + (setq yaoddmuse-wikis + '(("EmacsWiki" "http://www.emacswiki.org/emacs" utf-8 "uihnscuskc=1;"))) + (advice-add 'yaoddmuse-display-page :after 'evilupdate-wiki-trace) + (yaoddmuse-edit "EmacsWiki" evilupdate-wiki-page t) + (evilupdate-wait)) + +(defun evilupdate-update-regexp (file regexp) + "Update version tag in FILE. +The version tag is defined by the REGEXP, in particular by the first +match group." + (find-file file) + (goto-char (point-min)) + (when (re-search-forward regexp nil t) + (goto-char (match-beginning 1)) + (delete-region (match-beginning 1) (match-end 1)) + (insert evilupdate-version) + (save-buffer))) + +(defun evilupdate-update-files () + "Replace version comments in all source files." + (dolist (file (f-glob "*.el")) + (evilupdate-update-regexp file ";;\\s-*Version:\\s-*\\([^\n]+\\)"))) + +(defun evilupdate-update-pkg () + "Replace version in package file." + (evilupdate-update-regexp "evil-pkg.el" "\"evil\"[ \t\n\r]*\"\\([^\"]+\\)\"")) + +(defun evilupdate-update-var () + "Replace version in `evil-version' variable." + (evilupdate-update-regexp + "evil-vars.el" + "t \"\\([^\"]*\\)\"[) \n\r\t]*\"The current version of Evil")) + +(defun evilupdate-update-news () + "Send an posting to the mailing list." + (shell-command (concat "thunderbird -compose \"newsgroups=gmane.emacs.vim-emulation,preselectid=id2,subject='[ANN] Evil version " evilupdate-version " released',body='" + "Evil version " evilupdate-version " has been released. + +The stable version can be installed from MELPA stable [1]. +The latest development version is available from MELPA [2]. + +The Evil developers. + +[1] http://stable.melpa.org +[2] http://melpa.org +'\""))) + +(defun evilupdate-update (version) + "Update Evil to VERSION." + (setq evilupdate-cnt 0) + (setq evilupdate-version version) + (evilupdate-update-emacswiki) + (evilupdate-update-irc) + (evilupdate-update-files) + (evilupdate-update-pkg) + (evilupdate-update-var) + (evilupdate-update-news)) + +(when (/= (length argv) 1) + (user-error "Usage: evilupdate.el VERSION")) + +(evilupdate-update (car argv)) + +;;; evilupdate.el ends here -- cgit v1.0