improve version numbering

pull/110/head
Matthew Butterick 9 years ago
parent bbf7c699c9
commit b60ddedc43

@ -61,11 +61,11 @@ publish [dir] [dest] copy project in dir to dest without source files
(warning: overwrites existing dest dir)
setup preload cache
reset reset cache
version print the version (~a)" (setup:current-server-port) setup:default-version)))
version print the version" (setup:current-server-port))))
(define (handle-version)
(displayln setup:default-version))
(displayln ((dynamic-require 'pollen/private/version 'pollen:version))))
(define (handle-reset directory-maybe)

@ -7,7 +7,8 @@
"debug.rkt"
"../setup.rkt"
"../file.rkt"
"../cache.rkt")
"../cache.rkt"
"version.rkt")
(provide start-server)
@ -19,7 +20,7 @@
[((string-arg) ... "out" (string-arg)) route-out]
[else route-default]))
(message (format "Welcome to Pollen ~a" setup:default-version) (format "(Racket ~a)" (version)))
(message (format "Welcome to Pollen ~a" (pollen:version)) (format "(Racket ~a)" (version)))
(message (format "Project root is ~a" (setup:current-project-root)))
(define server-name (format "http://localhost:~a" (setup:current-server-port)))

@ -1,3 +1,18 @@
#lang racket/base
(provide default-version)
(define default-version "1.0")
(require racket/file racket/format racket/runtime-path)
(provide pollen:version)
(define-runtime-path ts-file "ts.rktd")
(define ts (file->value ts-file))
(define (convert str)
(apply string-append
(for/list ([c (in-string str)])
(define c-int (char->integer c))
(~a (integer->char (+ c-int (if (<= (char->integer #\0) c-int (char->integer #\9))
(- (char->integer #\a) (char->integer #\0))
10)))))))
(define (pollen:version)
(define major-version 1)
(define minor-version (convert (~r ts #:base 26)))
(format "~a.~a" major-version minor-version))

@ -1,8 +1,8 @@
#lang racket/base
(require (for-syntax racket/base racket/syntax) "private/version.rkt")
(require (for-syntax racket/base racket/syntax))
(require racket/runtime-path)
(provide (prefix-out setup: (combine-out (all-defined-out) (all-from-out "private/version.rkt"))))
(provide (prefix-out setup: (combine-out (all-defined-out))))
(define current-project-root (make-parameter (current-directory)))

Loading…
Cancel
Save