Megatest

Check-in [77ce036725]
Login
Overview
Comment:Added template config file for spublish
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: 77ce0367259101e383eea91f3aa051dd5586f7a1
User & Date: matt on 2015-12-03 23:02:37
Other Links: branch diff | manifest | tags
Context
2015-12-04
09:58
spublish working now check-in: 7b526e9030 user: mrwellan tags: v1.60
2015-12-03
23:02
Added template config file for spublish check-in: 77ce036725 user: matt tags: v1.60
22:46
Initial version of spublish check-in: 5f3d099673 user: matt tags: v1.60
Changes

Added datashare-testing/.spublish.config version [bffda7cb5a].







1
2
3
4
5
6
+
+
+
+
+
+
[settings]
target-dir   #{scheme (create-directory "/tmp/#{getenv USER}/target" #t)}
allowed-users matt

[database]
location /tmp/#{getenv USER}

Modified spublish.scm from [e440041fb0] to [4b8a90376f].

105
106
107
108
109
110
111




112
113
114
115
116
117
118
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122







+
+
+
+







;;  (lambda (db)
;;   (set-busy-handler! db (busy-timeout 10000)) ; 10 second timeout
;;   ...))

;; Create the sqlite db
(define (spublish:db-do configdat proc) 
  (let ((path (configf:lookup configdat "database" "location")))
    (if (not path)
	(begin
	  (print "[database]\nlocation /some/path\n\n Is missing from the config file!")
	  (exit 1)))
    (if (and path
	     (directory? path)
	     (file-read-access? path))
	(let* ((dbpath    (conc path "/spublish.db"))
	       (writeable (file-write-access? dbpath))
	       (dbexists  (file-exists? dbpath)))
	  (handle-exceptions
445
446
447
448
449
450
451

452










453
454
455
456
457
458
459
449
450
451
452
453
454
455
456

457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473







+
-
+
+
+
+
+
+
+
+
+
+







	;; (ini:read-ini fname)
	(read-config fname #f #t)
	(make-hash-table))))

(define (spublish:process-action configdat action . args)
  (let* ((target-dir    (configf:lookup configdat "settings" "target-dir"))
	 (user          (current-user-name))
	 (allowed-users (string-split
	 (allowed-users (configf:lookup configdat "settings" "allowed-users")))
			 (or (configf:lookup configdat "settings" "allowed-users")
			     ""))))
    (if (not target-dir)
	(begin
	  (print "[settings]\ntarget-dir /some/path\n\n Is MISSING from the config file!")
	  (exit)))
    (if (null? allowed-users)
	(begin
	  (print "[setings]\nallowed-users user1 user2 ...\n\n Is MISSING from the config file!")
	  (exit)))
    (if (not (member user allowed-users))
	(begin
	  (print "User \"" (current-user-name) "\" does not have access. Exiting")
	  (exit 1)))
    (case (string->symbol action)
      ((cp)
       (if (< (length args) 1)