#!/bin/bash -l
echo DEBUG: pre-commit $* 1>&2
#. /etc/profile
-# NB 11.12.17 [ -x www/dbq/update.sh ] && echo www/dbq/update.sh && www/dbq/update.sh
[ -d www/dbq/ ] && cd www/dbq/ && minify_dir | while read -r f; do
- echo "$f"
+ echo "Minify $f"
git add "$f"
done
--- /dev/null
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"
+" ~/.vimrc
+" ln -s /opt/nb/etc/vimrc ~/.vimrc
+"
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+let $VIMHOME = fnamemodify(resolve(fnamemodify(expand('<sfile>'),':p')),':h').'/vim'
+if empty(glob($VIMHOME)) && filereadable(expand('~/.vim'))
+ let $VIMHOME = resolve(expand('~/.vim'))
+endif
+
+" NB 08.03.17: infinite loop when link on /etc/vim/vimrc.local
+" NB 08.03.17 if filereadable("/etc/vim/vimrc")
+" NB 08.03.17 source /etc/vim/vimrc
+" NB 08.03.17 endif
+
+if &runtimepath !~ $VIMHOME
+ let &runtimepath = &runtimepath . ',' . $VIMHOME
+endif
+
+for file in split(globpath($VIMHOME . '/source/', '*.vim'), '\n')
+ execute 'source' fnameescape(file)
+endfor
}
public static function yaml_decode($str) {
+ self::yaml_init();
return yaml_parse($str);
}
return [array_values($title),$nav];
}
+ public function method_post_accept() {
+ if ( !empty($_SERVER['REQUEST_METHOD']) and $_SERVER['REQUEST_METHOD'] == 'POST' ) {
+ foreach (['json','yaml'] as $type) {
+ if (empty($_POST[$type]) or !strpos(self::client_content_type(),'/'.$type)) continue;
+
+ $post = $_POST;
+ unset($post[$type]);
+
+ $fct = $type . '_decode';
+ $_POST = array_merge((array)$this->$fct($_POST[$type]),$post);
+
+ break;
+ }
+ #bye($_POST);
+ }
+ }
+
public function parse_uri() {
+ $this->method_post_accept();
#
# Parse path, respect params order
#
if ( $format == 'json' and isset($_POST['json']) ) {
#bye($_POST['json']);
#$this->pset($this->json_decode($_POST['json']));
- $_POST = $this->json_decode($_POST['json']);
+ $_POST = $_POST + $this->json_decode($_POST['json']);
#bye($this->p());
}