From 5835f09a267858b0306268d33dd37e83374b97a3 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Mon, 3 Mar 2014 11:57:30 -0800 Subject: [PATCH] consolidate functions --- lang/inner-lang-helper.rkt | 18 +----------------- project-requires.rkt | 6 +----- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/lang/inner-lang-helper.rkt b/lang/inner-lang-helper.rkt index 78c78c9..725816f 100644 --- a/lang/inner-lang-helper.rkt +++ b/lang/inner-lang-helper.rkt @@ -1,26 +1,10 @@ #lang racket/base -(require (for-syntax racket/base)) +(require (for-syntax racket/base "../project-requires.rkt")) (provide (all-defined-out)) ;; A place to stash functions that don't change between compiles of Pollen files. -;; duplicate of contents of project-require.rkt. -;; Goes faster if it's not in a separate module. -;; todo: use include? But this one has to be available as syntax -;; todo: get rid of magic value -(define-for-syntax (project-require-file? path) - (define path-string (path->string path)) - (equal? (substring path-string (- (string-length path-string) 3) (string-length path-string)) "rkt")) - -;; list of all eligible requires in project require directory -(define-for-syntax (get-project-require-files) - (define extras-directory (build-path (current-directory) "pollen-require")) - (and (directory-exists? extras-directory) - ;; #:build? option returns complete paths (instead of just file names) - (let ([files (filter project-require-file? (directory-list extras-directory #:build? #t))]) - (and (not (equal? '() files)) files)))) - (define-for-syntax (put-file-in-require-form file) `(file ,(path->string file))) diff --git a/project-requires.rkt b/project-requires.rkt index ab68113..c416417 100644 --- a/project-requires.rkt +++ b/project-requires.rkt @@ -13,8 +13,4 @@ (and (directory-exists? extras-directory) ;; #:build? option returns complete paths (instead of just file names) (let ([files (filter project-require-file? (directory-list extras-directory #:build? #t))]) - (and (not (equal? null files)) files)))) - -(module+ main -(parameterize ([world:current-project-root (string->path "/Users/mb/git/bpt/")]) - (get-project-require-files))) \ No newline at end of file + (and (not (equal? null files)) files)))) \ No newline at end of file