source: project/nest-tool/trunk/nest-tool.scm @ 4589

Last change on this file since 4589 was 4589, checked in by Mario Domenech Goulart, 13 years ago

Adding nest-tool

File size: 1.5 KB
Line 
1(use http-client srfi-1)
2(declare (uses utils regex))
3
4(define nest-tool:repository (make-parameter "http://www.call-with-current-continuation.org/eggs/repository"))
5
6(define (nest-tool:raw)
7  (with-input-from-string
8      (if (file-exists? (nest-tool:repository))
9          (read-all (nest-tool:repository))
10          (http:GET (nest-tool:repository)))
11    read))
12
13(define (nest-tool:egg-name egg)
14  (car egg))
15
16(define (nest-tool:egg-date egg)
17  (cadar (cadr egg)))
18
19(define (nest-tool:egg-file egg)
20  (caddr egg))
21
22(define (nest-tool:egg-dependencies egg)
23  (drop egg 3))
24
25(define (nest-tool:names #!optional raw)
26  (map nest-tool:egg-name (or raw (nest-tool:raw))))
27
28(define (nest-tool:dates #!optional raw)
29  (map (lambda (egg)
30         (cons (nest-tool:egg-name egg) (nest-tool:egg-date egg)))
31       (or raw (nest-tool:raw))))
32
33(define (nest-tool:files #!optional raw)
34  (map (lambda (egg)
35         (cons (nest-tool:egg-name egg) (nest-tool:egg-file egg)))
36       (or raw (nest-tool:raw))))
37
38(define (nest-tool:dependencies #!optional raw)
39  (map (lambda (egg)
40         (cons (nest-tool:egg-name egg) (nest-tool:egg-dependencies egg)))
41       (or raw (nest-tool:raw))))
42
43(define (nest-tool:search-names pattern #!optional raw)
44  (filter (lambda (egg)
45            (string-match pattern (symbol->string (car egg))))
46          (nest-tool:raw)))
47
48(define (nest-tool:search-dependencies pattern #!optional raw)
49  (filter (lambda (egg)
50            (not (null? (grep pattern (map symbol->string (nest-tool:egg-dependencies egg))))))
51          (nest-tool:raw)))
Note: See TracBrowser for help on using the repository browser.