Open charlesneimog opened 2 years ago
This work without curl
.
NOTE: The file om-sharp-version
is with 1.7 so it will tell that have update in 1.6.
;; ========================================================================
(defun check-update()
(with-open-stream
(http (comm:open-tcp-stream
"raw.githubusercontent.com" 443
:ssl-ctx t
:element-type '(unsigned-byte 8)))
(write-sequence (format
http "GET charlesneimog/OM-CKN/master/resources/om-sharp-version.lisp HTTP/1.1~%Host: raw.githubusercontent.com~%~%"
(code-char 13) (code-char 10)
(code-char 13) (code-char 10)) http)
(force-output http)
(ignore-errors (loop :for line := (read-line http nil)
:while line
:do (setf *om-sharp-last-update* line)))
(close http)))
;; ========================================================================
(setf *actual-version-of-om-sharp* 0)
(setf *process-of-update* (mp:process-run-function "Check Update for OM-Sharp" () (lambda () (check-update))))
(sleep 2)
(mp:process-terminate *process-of-update*)
(eval (read-from-string *om-sharp-last-update* "OM-Sharp Last Version"))
(if (> *actual-version-of-om-sharp* (read-from-string (format nil "~d.~d" CL-USER::*version-major* CL-USER::*version-minor*)))
(let* (
(update? (om::om-y-or-n-dialog (format nil "OM-SHARP has been UPDATED to version ~d. Want to update now?" *actual-version-of-om-sharp*))))
(if update?
(let* ()
(hqn-web:browse "https://github.com/cac-t-u-s/om-sharp/releases/latest")))))
Hi Jean,
I'd like to suggest one more thing!
Could be possible to add a way to check the actual version of om-sharp. I am seeing a lot of people using old versions (??). I think that is because they do not use Github a lot.
Search on the internet I saw two ways to do that, the first one is using
curl
and uploading a file text in Github repo. The code would be something like this:One second way will be use this code more beautiful and elegant without curl, just LispWorks functions!
But I am not sure how to close the stream (you probably must know!). You will see that the last print of
LINE::: something
is the(defparameter *actual-version-of-om-sharp* 1.7)
from github than I have no moreprints
but the evaluation do not stop :). This is from reddit from the user tdrhq.All can be used inside OM without any adaption of an external library that already is on OM-Sharp.
I think that this could help people to always have the last version of OM-Sharp which normally have fewer bugs, etc...
It will be great to use this with libraries too!!!
The file that I am using in https://github.com/charlesneimog/OM-CKN/blob/master/resources/om-sharp-version.lisp.