From 5b6d0e638a182d085cd5b5fd8e8da14c649c25f9 Mon Sep 17 00:00:00 2001 From: SANO Masatoshi Date: Tue, 17 May 2016 06:18:55 +0900 Subject: [PATCH] implement 'ros swank list' --- lisp/locations.lisp | 2 ++ lisp/swank.ros | 58 +++++++++++++++++++++++++++------------------ 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/lisp/locations.lisp b/lisp/locations.lisp index dde0e31..bc36a9b 100644 --- a/lisp/locations.lisp +++ b/lisp/locations.lisp @@ -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) diff --git a/lisp/swank.ros b/lisp/swank.ros index d90e341..efb2f3a 100644 --- a/lisp/swank.ros +++ b/lisp/swank.ros @@ -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: