Skip to content

Commit

Permalink
Refactored error message slightly and fixed regex
Browse files Browse the repository at this point in the history
  • Loading branch information
k-mouline committed Oct 25, 2024
1 parent 9dca439 commit 8616a5a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
23 changes: 14 additions & 9 deletions forge/send-to-kodkod.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,20 @@
(when (and no-version-printed-yet (@>= (get-verbosity) VERBOSITY_LOW))
(set! no-version-printed-yet #f)
(printf "Forge version: ~a~n" forge-version)
(let ([curr-forge-version (curr-forge-version)])
(cond [(not (void? curr-forge-version))
(if (equal? forge-version curr-forge-version)
(printf "Forge is up-to-date.~n")
(printf "Forge is out-of-date. You are on version ~a, but the latest version is ~a.~n"
forge-version curr-forge-version))]))
(let ([git-info (forge-git-info)])
(when (pair? git-info)
(apply printf " branch: ~a~n commit: ~a~n timestamp: ~a~n" git-info)))
(let* ([git-info (forge-git-info)]
[git-valid (pair? git-info)])
(when git-valid
(apply printf " branch: ~a~n commit: ~a~n timestamp: ~a~n" git-info)
; Check local forge version vs. latest version on main branch
(let ([curr-forge-version (curr-forge-version)])
(cond [(and (not (void? curr-forge-version)) (and git-valid (equal? (car git-info) "main")))
(if (equal? forge-version curr-forge-version)
(printf "Forge is up-to-date.~n")
(printf "Forge is out-of-date. You are on version ~a, but main is on version ~a.~n"
forge-version curr-forge-version))]
[(or (not git-valid) (not (equal? (car git-info) "main")))
(printf "Skipping version check vs. main branch.~n")]))))

(printf "To report issues with Forge, please visit ~a~n"
"https://report.forge-fm.org"))

Expand Down
4 changes: 2 additions & 2 deletions forge/shared.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

(require racket/runtime-path racket/file)
(require (only-in racket/draw color%)
(only-in racket make-object match)
(only-in racket make-object)
(only-in racket/system system*)
(only-in racket/string string-trim)
(only-in racket/port call-with-output-string)
Expand Down Expand Up @@ -70,7 +70,7 @@
[json-data (string->jsexpr (bytes->string/utf-8 body))]
[content (hash-ref json-data 'content)]
[decoded-content (bytes->string/utf-8 (base64-decode (string->bytes/utf-8 content)))]
[version (regexp-match #px"\\(define version \"([0-9]+\\.[0-9]+)\"\\)" decoded-content)])
[version (regexp-match #px"\\(define version \"([0-9]+[.0-9]+)\"\\)" decoded-content)])
(car (cdr version)))
void)))

Expand Down

0 comments on commit 8616a5a

Please sign in to comment.