Commits

Anonymous committed 02eac72

Permissions for the generated files in site/ are customisable in config.stone

Comments (0)

Files changed (4)

data/config.stone

 Pages = [ ("index.md", "Home") ]
 
 
+(* Advanced configuration variables        ------ *)
+(* You may not need to change them for the moment *)
+
+(* Permissions of the files & directories generated in site/ *)
+DirPerm  = 0o755
+FilePerm = 0o644
 
 type config = {
   site_title : string;
-  bar_pages : page list
+  bar_pages : page list;
+  dir_perm : int;
+  file_perm : int
 }
 
 let parse_conf filename =
     (tuple2_wrappers string_wrappers string_wrappers)
     ~group
     ["Pages"] [] "List of the pages" in
-  
+  let dir_perm = new int_cp ~group ["DirPerm"] Params.dir_perm
+    "Permission for the created directories" in
+  let file_perm = new int_cp ~group ["FilePerm"] Params.file_perm
+    "Permission for the created files" in
+
   group#read filename;
   { site_title = title#get;
     bar_pages = List.map (fun (f, t) -> { file = f; title = t }) pages#get;
+    dir_perm = dir_perm#get;
+    file_perm = file_perm#get
   }
     out_file := !out_file ^ dot ^ suffix;
     out_str := content);
       
-  dump_string file_perm !out_file !out_str
+  dump_string conf.file_perm !out_file !out_str
       all_pages;
 
     (* Copy the stylesheet into site/static/ *)
-    (try Unix.mkdir (folder ^ site ^ static) dir_perm
+    (try Unix.mkdir (folder ^ site ^ static) conf.Conf.dir_perm
      with Unix.Unix_error _ -> ());
-    copy_file (folder ^ data ^ css) (folder ^ site ^ static ^ css)
+    copy_file conf.Conf.file_perm (folder ^ data ^ css)
+      (folder ^ site ^ static ^ css)
   )
 
 let _ =