Work on member web static file generator.
This commit is contained in:
parent
b3bb37cbce
commit
52a2108b4f
5 changed files with 42 additions and 3 deletions
|
@ -53,7 +53,6 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
(newline)
|
||||
|
||||
;; Command-line options and configurable parameters
|
||||
(define *members-directory* (make-parameter "members"))
|
||||
(define *apikeys-file* (make-parameter "apikey.ntlm"))
|
||||
(define -needs-bank- (make-parameter #f))
|
||||
(define -member-id- (make-parameter #f))
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
*current-month*
|
||||
*member-file-context*
|
||||
*member-suspend-max-months*
|
||||
*members-directory*
|
||||
)
|
||||
|
||||
(import scheme
|
||||
|
@ -52,4 +53,7 @@
|
|||
;; How long the member can be suspended without any action required?
|
||||
(define *member-suspend-max-months* (make-parameter 24))
|
||||
|
||||
;; Needed by multiple modules actually
|
||||
(define *members-directory* (make-parameter "members"))
|
||||
|
||||
)
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
(
|
||||
make-member-record
|
||||
|
||||
member-file-name
|
||||
member-file-path
|
||||
member-record-input-file
|
||||
|
||||
|
@ -128,7 +129,11 @@
|
|||
(cadr args))
|
||||
pairs)))))))
|
||||
|
||||
;; Convenience accessor
|
||||
;; File name without directory
|
||||
(define (member-file-name mr)
|
||||
(dict-ref mr 'file-name))
|
||||
|
||||
;; Convenience accessor for file name with directory
|
||||
(define (member-file-path mr)
|
||||
(dict-ref mr 'file-path))
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
filter
|
||||
string-repeat
|
||||
string-first+rest
|
||||
get-process-output-lines
|
||||
utils-tests!
|
||||
)
|
||||
|
||||
|
@ -38,6 +39,8 @@
|
|||
(chicken base)
|
||||
(chicken string)
|
||||
(chicken irregex)
|
||||
(chicken io)
|
||||
(chicken process)
|
||||
testing)
|
||||
|
||||
;; Returns a list with elements matching pred? predicate.
|
||||
|
@ -72,6 +75,14 @@
|
|||
(cons key-str val))
|
||||
(cons str ""))))
|
||||
|
||||
;; Very simple shell command wrapper that returns lines produced by
|
||||
;; given command. Dangerous - performs no argument escaping!
|
||||
(define (get-process-output-lines cmd)
|
||||
(let-values (((stdout stdin pid stderr) (process* cmd)))
|
||||
(close-output-port stdin)
|
||||
(let ((result (read-lines stdout)))
|
||||
(let-values (((a b c) (process-wait pid)))
|
||||
result))))
|
||||
|
||||
;; Performs utils module self-tests.
|
||||
(define (utils-tests!)
|
||||
|
|
|
@ -29,12 +29,16 @@
|
|||
web-static
|
||||
(
|
||||
gen-web-static-member
|
||||
gen-web-static
|
||||
)
|
||||
|
||||
(import scheme
|
||||
(chicken base)
|
||||
(chicken format)
|
||||
member-record)
|
||||
(chicken string)
|
||||
member-record
|
||||
utils
|
||||
configuration)
|
||||
|
||||
;; Generate all the files in current directory, should be wrapped in
|
||||
;; something like with-current-directory.
|
||||
|
@ -53,6 +57,22 @@
|
|||
(when (not (null? lines))
|
||||
(print (car lines))
|
||||
(loop (cdr lines))))))
|
||||
(with-output-to-file (sprintf "~A.log" nick)
|
||||
(lambda ()
|
||||
(let loop ((lines
|
||||
(get-process-output-lines
|
||||
(sprintf "git -C \"~A\" log \"~A\""
|
||||
(string-translate* (*members-directory*)
|
||||
'(("\"" "\\\"")))
|
||||
(member-file-name mr)
|
||||
))))
|
||||
(when (not (null? lines))
|
||||
(print (car lines))
|
||||
(loop (cdr lines))))))
|
||||
))
|
||||
|
||||
;; Generates all member files in given directory
|
||||
(define (gen-web-static mb dir)
|
||||
#f)
|
||||
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue