#lang scheme/base
(require scheme/path
compiler/cm
planet/util
(planet schematics/schemeunit:3/text-ui)
"base.ss")
(define (test module-path binding)
(let ([n-failures (run-tests (dynamic-require module-path binding))])
(if (zero? n-failures)
#t
(raise-exn:fail:sake (format "~a test(s) failed" n-failures)))))
(define (compile module-path)
(parameterize ([current-namespace (make-base-namespace)]
[current-load/use-compiled (make-compilation-manager-load/use-compiled-handler)]
[manager-compile-notify-handler (lambda (s) (printf "Compiling ~a\n" s))])
(managed-compile-zo module-path))
#t)
(define (planet-archive path)
(make-planet-archive (simplify-path path)))
(define (planet-install owner filestr major minor)
(unless (file-exists? filestr)
(raise-exn:fail:sake (format "File does not exist: ~a" filestr)))
(let* ([file (normalize-path filestr)]
[name (let-values ([(base name dir?) (split-path file)]) (path->string name))]
[fullspec (get-package-spec owner name major minor)])
(install-pkg fullspec file major minor)))
(define (planet-remove owner package major minor)
(remove-pkg owner package major minor))
(provide test
compile
planet-archive
planet-remove
planet-install)