implement 'ros swank list'

This commit is contained in:
SANO Masatoshi 2016-05-17 06:18:55 +09:00
parent bcb11cbc1c
commit 5b6d0e638a
2 changed files with 37 additions and 23 deletions

View file

@ -35,10 +35,12 @@
(defuri asdf-git-version-uri "https://github.com/fare/asdf/releases.atom")
(defuri ecl-git-version-uri "https://github.com/roswell/mirror-ecl/releases.atom")
(defuri sbcl-git-version-uri "https://github.com/sbcl/sbcl/releases.atom")
(defuri swank-git-version-uri"https://github.com/slime/slime/releases.atom")
(defuri asdf-uri "https://github.com/fare/asdf/archive/")
(defuri ecl-uri "https://github.com/roswell/mirror-ecl/archive/")
(defuri sbcl-uri "https://github.com/sbcl/sbcl/archive/")
(defuri swank-uri "https://github.com/slime/slime/")
(defuri sbcl-bin-version-uri)
(defuri sbcl-bin-uri)

View file

@ -1,13 +1,16 @@
#!/bin/sh
#|-*- mode:lisp -*-|#
#|[WIP] manage swank version for roswell
#|[WIP] Manage swank version for roswell
exec ros -Q -m roswell -L sbcl-bin -- $0 "$@"
|#
(progn
(ros:include "util")
(ros:include "util-install")
(ros:include "util-swank"))
(ros:include "util-swank")
(ros:quicklisp :environment nil)
(unless (find-package :plump)
(ql:quickload '(:plump) :silent t)))
(defpackage :ros.script.swank.3671440529
(:use :cl :ros.locations :ros.util :ros.swank.util))
@ -19,17 +22,14 @@ exec ros -Q -m roswell -L sbcl-bin -- $0 "$@"
("install" . swank-install)
("list" . swank-list)))
(defun swank-get-version ()
(ros.install::github-version
(swank-git-version-uri) "swank" (lambda (href) (subseq href (+ 2 (position #\/ href :from-end t))))))
(defun usage ()
(let ((s *error-output*))
(format s "Usage: ~A swank install/use/list/delete version ~%" (ros:opt "wargv0"))))
(defun main (method command &optional sub &rest argv)
(declare (ignorable argv method command))
(let ((func (cdr (assoc sub *sub* :test #'equal))))
(when func
(ros:quit (apply func argv))))
(usage))
(defun swank-from-git (name)
(let* ((str (slime-uri))
(end (position #\/ str :from-end t))
@ -61,10 +61,10 @@ exec ros -Q -m roswell -L sbcl-bin -- $0 "$@"
release-file)
(with-open-file (in release-file)
(loop for line = (read-line in nil nil)
while line
for list = (ql-util:split-spaces line)
when (equal (first list) "slime")
do (download (second list) archive-file)))
while line
for list = (ql-util:split-spaces line)
when (equal (first list) "slime")
do (download (second list) archive-file)))
(uiop/filesystem:delete-directory-tree (ensure-directories-exist extract-path) :validate t)
(expand archive-file (ensure-directories-exist extract-path))
(prog1
@ -89,15 +89,27 @@ exec ros -Q -m roswell -L sbcl-bin -- $0 "$@"
"two type of name would be accepted 'date format' or 'version'"
(declare (ignorable argv))
(unless (loop for x across name
always (or (digit-char-p x)
(eql x #\.)))
always (or (digit-char-p x)
(eql x #\.)))
(name-error name))
(case (count #\. name)
(1 (swank-from-git name))
(2 (or
(ignore-errors (swank-from-git name)) ;; 2.10.1 couldn't be install without this line.
(swank-from-ql name)))
(t (name-error name)))
(swank-write-version name)
(swank-write-helper))
(case (count #\. name)
(1 (swank-from-git name))
(2 (or
(ignore-errors (swank-from-git name)) ;; 2.10.1 couldn't be install without this line.
(swank-from-ql name)))
(t (name-error name)))
(swank-write-version name)
(swank-write-helper))
(defun swank-list (&rest r)
(declare (ignorable r))
(dolist (i (swank-get-version))
(format t "~A~%" i)))
(defun main (method command &optional sub &rest argv)
(declare (ignorable argv method command))
(let ((func (cdr (assoc sub *sub* :test #'equal))))
(when func
(ros:quit (apply func argv))))
(usage))
;;; vim: set ft=lisp lisp: