diff --git a/TODO.md b/TODO.md index f779beaf7a4d7c413f879bdc0a916fc6852bb442..8d6431c6123ed53f225796512872e123387cfeb4 100644 --- a/TODO.md +++ b/TODO.md @@ -13,9 +13,9 @@ * realise round list view for projects * remove `*jabs-verbose*`, `*jabs-quiet*` and `*jabs-debug*` variables as deprecated * make automatic detection, which project should be launched -* check for multiple directories to load libs/plugins/skelethons/bouts/rounds/hits etc -* make possibility to add absolute pathnames to skelethon definition -* make skelethon definition in project regular (now: `:skelethon (:default)` ) +* check for multiple directories to load libs/plugins/skeletons/bouts/rounds/hits etc +* make possibility to add absolute pathnames to skeleton definition +* make skeleton definition in project regular (now: `:skeleton (:default)` ) * add CLI option additional-plugins ## Plugins: diff --git a/doc b/doc index ee469f99aa726cf8f930ae1db3fda6ba4767dd2b..7b7af0ce2628813d7914396ce30fdd761f6cc7ac 160000 --- a/doc +++ b/doc @@ -1 +1 @@ -Subproject commit ee469f99aa726cf8f930ae1db3fda6ba4767dd2b +Subproject commit 7b7af0ce2628813d7914396ce30fdd761f6cc7ac diff --git a/etc/jabs.conf b/etc/jabs.conf index 0f562eb808ded2851a8b1838aaa8411bd9b04bee..40cf3cda3b4eeb2018d089567bbf552df1950342 100644 --- a/etc/jabs.conf +++ b/etc/jabs.conf @@ -1,6 +1,6 @@ -;; skelethons -;; (*jabs-skelethons-directory* (make-pathname :directory '(:relative "skelethons"))) +;; skeletons +;; (*jabs-skeletons-directory* (make-pathname :directory '(:relative "skeletons"))) ;; bouts ;; (*jabs-bouts-directory* (make-pathname :directory '(:relative "bouts"))) ;; hits @@ -21,12 +21,12 @@ ;; (*jabs-verbose* nil) ;; (*jabs-debug* nil) -;; (*jabs-default-skelethon-name* :default) +;; (*jabs-default-skeleton-name* :default) ;; (*jabs-default-bout* :default) ;; (*jabs-debug* t) -;; ;; (*jabs-skelethons-directory* "the/directory") -;; ;; *jabs-forced-skelethon* +;; ;; (*jabs-skeletons-directory* "the/directory") +;; ;; *jabs-forced-skeleton* ;; (*jabs-bouts-directory* "the/directory") ;; (*jabs-default-bout* :default) ;; ;; *jabs-current-compiler* @@ -60,11 +60,11 @@ ;; (*register-plugin-hook* nil) ;; (*register-repository-hook* nil) ;; ?? ;; (*register-project-hook* nil) -;; (*register-skelethon-hook* nil) +;; (*register-skeleton-hook* nil) ;; (*run-project-hook* nil) ;; (*run-hit-hook* nil) ;; (*run-bout-hook* nil) -;; (*initialize-skelethon-hook* nil) +;; (*initialize-skeleton-hook* nil) ;; (*init-hook* nil) ;; run directly after initialization ;; (*initialize-plugin-hook* nil) diff --git a/share/bouts/default.bt b/share/bouts/default.bt index 416daaf374e053eac69d6f5a3d1c990adb1bbf17..50404f996b59352da1fd987c841f42d92db2f757 100644 --- a/share/bouts/default.bt +++ b/share/bouts/default.bt @@ -11,7 +11,7 @@ :deploy ) ;; :validate -;; :initialize - initialize skelethon, make source preprocessing etc +;; :initialize - initialize skeleton, make source preprocessing etc ;; :generate-sources ;; :process-sources ;; :generate-resources diff --git a/share/hits/clean.hit b/share/hits/clean.hit index 8cf38ee67072c469a613ee5e3c00511b6e2c67a4..6b5d95bfd85e72355ef40efd728fb99d2e39a86c 100644 --- a/share/hits/clean.hit +++ b/share/hits/clean.hit @@ -2,7 +2,7 @@ (clean :depends-on () (let ((target-dir (or - (try (get-skelethon-target (find-skelethon (project-slot-value *jabs-current-project* 'skelethon)))) - (try (get-skelethon-target (find-skelethon (car (project-slot-value *jabs-current-project* 'skelethon)))))))) + (try (get-skeleton-target (find-skeleton (project-slot-value *jabs-current-project* 'skeleton)))) + (try (get-skeleton-target (find-skeleton (car (project-slot-value *jabs-current-project* 'skeleton)))))))) (when target-dir (os-rm target-dir :recursive t)))) diff --git a/share/hits/deploy-local.hit b/share/hits/deploy-local.hit index d771771f71c420d0bef39360814a5a6ed47358b1..95c3c5d5d8ee7e7a1ef099c66e6ad0c05dbae6ec 100644 --- a/share/hits/deploy-local.hit +++ b/share/hits/deploy-local.hit @@ -1,25 +1,25 @@ ;; -*- mode: lisp -*- (deploy-local :depends-on () - (let* ((current-skelethon (or (try (find-skelethon (car (project-slot-value *jabs-current-project* 'skelethon)))) - (try (find-skelethon (project-slot-value *jabs-current-project* 'skelethon))))) - (target-dir (when current-skelethon (pathname-as-directory (parse-namestring (get-skelethon-target current-skelethon))))) + (let* ((current-skeleton (or (try (find-skeleton (car (project-slot-value *jabs-current-project* 'skeleton)))) + (try (find-skeleton (project-slot-value *jabs-current-project* 'skeleton))))) + (target-dir (when current-skeleton (pathname-as-directory (parse-namestring (get-skeleton-target current-skeleton))))) ;; - (src-dir (try (get-skelethon-src current-skelethon))) - (bin-dir (try (get-skelethon-bin current-skelethon))) - (doc-dir (try (get-skelethon-doc current-skelethon))) - (share-dir (try (get-skelethon-share current-skelethon))) - (test-dir (try (get-skelethon-test current-skelethon))) - (contrib-dir (try (get-skelethon-contrib current-skelethon))) - (conf-dir (try (get-skelethon-conf current-skelethon))) - (script-dir (try (get-skelethon-script current-skelethon))) - (readme-file (try (get-skelethon-readme-file current-skelethon))) - (license-file (try (get-skelethon-license-file current-skelethon))) - (install-file (try (get-skelethon-install-file current-skelethon))) + (src-dir (try (get-skeleton-src current-skeleton))) + (bin-dir (try (get-skeleton-bin current-skeleton))) + (doc-dir (try (get-skeleton-doc current-skeleton))) + (share-dir (try (get-skeleton-share current-skeleton))) + (test-dir (try (get-skeleton-test current-skeleton))) + (contrib-dir (try (get-skeleton-contrib current-skeleton))) + (conf-dir (try (get-skeleton-conf current-skeleton))) + (script-dir (try (get-skeleton-script current-skeleton))) + (readme-file (try (get-skeleton-readme-file current-skeleton))) + (license-file (try (get-skeleton-license-file current-skeleton))) + (install-file (try (get-skeleton-install-file current-skeleton))) ;; ) (when (not target-dir) - (jlog:crit "Target directory for skelethon ``~a'', project ``~a'' is not set. Can not deploy locally" - (get-skelethon-name current-skelethon) + (jlog:crit "Target directory for skeleton ``~a'', project ``~a'' is not set. Can not deploy locally" + (get-skeleton-name current-skeleton) (get-project-name *jabs-current-project*))) ;; (dolist (dir (list src-dir bin-dir doc-dir test-dir contrib-dir script-dir share-dir conf-dir)) diff --git a/share/hits/initialize.hit b/share/hits/initialize.hit index 653470c0b1822078cebd2bcc82677292150926aa..b7db20145a932d255a07d5d192dfd501589b07f6 100644 --- a/share/hits/initialize.hit +++ b/share/hits/initialize.hit @@ -1,3 +1,3 @@ ;; -*- mode: lisp -*- (initialize :depends-on () - (process-project-skelethon *jabs-current-project*)) + (process-project-skeleton *jabs-current-project*)) diff --git a/share/hits/load-skelethon.hit b/share/hits/load-skelethon.hit deleted file mode 100644 index dfa6fa7f980ac1d5a2d78a9befdead125cb98ecd..0000000000000000000000000000000000000000 --- a/share/hits/load-skelethon.hit +++ /dev/null @@ -1,3 +0,0 @@ -;; -*- mode: lisp -*- -(load-skelethon :depends-on () - (load-project-skelethon *jabs-current-project*)) diff --git a/share/hits/load-skeleton.hit b/share/hits/load-skeleton.hit new file mode 100644 index 0000000000000000000000000000000000000000..f4ebbf5e3b8494b54cabcb163ce829421ed74feb --- /dev/null +++ b/share/hits/load-skeleton.hit @@ -0,0 +1,3 @@ +;; -*- mode: lisp -*- +(load-skeleton :depends-on () + (load-project-skeleton *jabs-current-project*)) diff --git a/share/hits/process-skelethon.hit b/share/hits/process-skelethon.hit deleted file mode 100644 index db79438980696f2cc83aac005275e82b12d65c96..0000000000000000000000000000000000000000 --- a/share/hits/process-skelethon.hit +++ /dev/null @@ -1,3 +0,0 @@ -;; -*- mode: lisp -*- -(process-skelethon :depends-on () - (process-project-skelethon *jabs-current-project*)) diff --git a/share/hits/process-skeleton.hit b/share/hits/process-skeleton.hit new file mode 100644 index 0000000000000000000000000000000000000000..c4be437f2ac20e10f99e1c02e2bf10d21ecf58ff --- /dev/null +++ b/share/hits/process-skeleton.hit @@ -0,0 +1,3 @@ +;; -*- mode: lisp -*- +(process-skeleton :depends-on () + (process-project-skeleton *jabs-current-project*)) diff --git a/share/hits/test.hit b/share/hits/test.hit index 71050796859db3f9c7834b8ceb1217a14eb7287b..7acb05de46ae2a5fb68f17a09301c1e7ea302044 100644 --- a/share/hits/test.hit +++ b/share/hits/test.hit @@ -4,7 +4,7 @@ ;; (jlog:err "NOT IMPLEMENTED")) ;; (jlog:info "Perform load testing...") ;; (let ((pname (get-project-name *jabs-current-project*)) - ;; (testdir (merge-n-directories (os-pwd) (get-project-pathname *jabs-current-project*) (car (skelethon@core@plugin@jabs::get-skelethon-test *jabs-current-skelethon*))))) + ;; (testdir (merge-n-directories (os-pwd) (get-project-pathname *jabs-current-project*) (car (skeleton@core@plugin@jabs::get-skeleton-test *jabs-current-skeleton*))))) ;; (asdf:operate 'asdf:load-op pname) ;; (if (find-package pname) ;; (jlog:info "DONE") diff --git a/share/plugins/generic/make-binary/README.md b/share/plugins/generic/make-binary/README.md index b7a6a52797d7ad7b16ea87076f8c3cb2051786f8..b2355d03dab21222d5be4dd6f93248a05d3a7a92 100644 --- a/share/plugins/generic/make-binary/README.md +++ b/share/plugins/generic/make-binary/README.md @@ -1,6 +1,6 @@ # make-binary@generic -Makes binary executable from current lisp program in skelethon binary directory +Makes binary executable from current lisp program in skeleton binary directory ## Usage diff --git a/share/plugins/generic/make-binary/build.jab b/share/plugins/generic/make-binary/build.jab index 5962ee643cfb2f8a220f653f08a3f10bc86b1d73..397c929f89ae80a263359b3985b9536b048926b8 100644 --- a/share/plugins/generic/make-binary/build.jab +++ b/share/plugins/generic/make-binary/build.jab @@ -10,6 +10,6 @@ :license "MIT" :description "JABS plugin to make binary executable from project" :serial t - :skelethon (:default) + :skeleton (:default) :depends-on (:trivial-dump-core) :components ((:file "make-binary"))) diff --git a/share/plugins/generic/make-binary/src/make-binary.lisp b/share/plugins/generic/make-binary/src/make-binary.lisp index 7ceb58091aa9d9d5ba704afb9328c4dd902f772a..6b1deb61175357ef8b51edd78606a2b569277352 100644 --- a/share/plugins/generic/make-binary/src/make-binary.lisp +++ b/share/plugins/generic/make-binary/src/make-binary.lisp @@ -26,9 +26,9 @@ (folder (or (pathname-as-directory (parse-namestring - (get-skelethon-bin - (find-skelethon - (car (jabs:project-slot-value *jabs-current-project* 'jabs::skelethon)))))) + (get-skeleton-bin + (find-skeleton + (car (jabs:project-slot-value *jabs-current-project* 'jabs::skeleton)))))) ""))) ;; (when (not function) diff --git a/share/plugins/generic/tmpl/build.jab b/share/plugins/generic/tmpl/build.jab index fbb46070180020889fc2400f5383e988b2881822..58192df200749501fd6e80b6c7b43bc3c357dbc1 100644 --- a/share/plugins/generic/tmpl/build.jab +++ b/share/plugins/generic/tmpl/build.jab @@ -9,7 +9,7 @@ :license "Public Domain" :description "Here is my project" ;; :serial t - :skelethon (:flat) ;; (nil) ;; will be w/o '(' ')' in v.0.2+ + :skeleton (:flat) ;; (nil) ;; will be w/o '(' ')' in v.0.2+ ;; :bout :default ;;; Additional sources ;; :sources ((make-pathname :directory '(:relative "another-lib"))) diff --git a/share/plugins/generic/tmpl/plugin.lisp b/share/plugins/generic/tmpl/plugin.lisp index e765338ec4cc0418cc14eddb5b285bd9608dd1a8..ce595d2963f3caa407452e7367828f1ce14b09b4 100644 --- a/share/plugins/generic/tmpl/plugin.lisp +++ b/share/plugins/generic/tmpl/plugin.lisp @@ -16,7 +16,7 @@ (maintainer "John Doe ") (license "Public Domain") (description "Personal use plugin") - (skelethon "(:default)") + (skeleton "(:default)") (bout "default") (plugins "(:quicklisp@repository)") (components (format nil "~15t(:file \"fixture\")~%"))) @@ -32,23 +32,23 @@ :license \"~a\" :description \"~a\" :serial t - :skelethon ~a + :skeleton ~a ;; :bout :~a ;; :plugins ~a ;;;; Additional sources ;; :sources ((make-pathname :directory '(:relative \"another-lib\"))) ;;;; Dependencies ;; :depends-on (:alexandria :cl-ppcre) - ;; :pathname \"some/relative/path\" ;; relative name to your plugin root directory (where skelethon located) + ;; :pathname \"some/relative/path\" ;; relative name to your plugin root directory (where skeleton located) ;;;; Add files, mobules etc :components ( ~a)) -" name name name type version author maintainer license description skelethon bout plugins components)) +" name name name type version author maintainer license description skeleton bout plugins components)) (defhit tmpl-mkplugin () () (let* ((plugin-name (get-project-name *jabs-current-project*)) (plugin-description (get-project-description *jabs-current-project*)) - (plugin-skelethon-name (car (slot-value *jabs-current-project* 'jabs::skelethon))) + (plugin-skeleton-name (car (slot-value *jabs-current-project* 'jabs::skeleton))) (plugin-components (slot-value *jabs-current-project* 'jabs::components)) (plugin-component-names) (plugin-template)) @@ -72,7 +72,7 @@ :license (ignore-errors (slot-value *jabs-current-project* 'jabs::license)) :description plugin-description :plugins (ignore-errors (slot-value *jabs-current-project* 'jabs::plugins)) - :skelethon (concatenate 'string "(:" (string-downcase (princ-to-string plugin-skelethon-name)) ")") + :skeleton (concatenate 'string "(:" (string-downcase (princ-to-string plugin-skeleton-name)) ")") :components plugin-component-names )) ;; @@ -93,7 +93,7 @@ (terminate 0)) (progn (jlog:note "Plugin not exists. Going on") - (load-skelethon (list *tmpl-skelethon-name*)) + (load-skeleton (list *tmpl-skeleton-name*)) ;; (let* ((plugin-name (tools@jabs:tosymbol (car (reverse (pathname-directory (os-pwd)))))) (plugin-type (tools@jabs:tosymbol *tmpl-plugin-type*)) @@ -104,12 +104,12 @@ (plugin-description "Personal use plugin") (plugin-serial t) (plugin-plugins '(:quicklisp@repository)) - (plugin-skelethon (find-skelethon *tmpl-skelethon-name*)) + (plugin-skeleton (find-skeleton *tmpl-skeleton-name*)) (plugin-bout :default) (plugin-src-dir - (if (listp (get-skelethon-src plugin-skelethon)) - (merge-pathnames (make-pathname :directory (list :relative (car (get-skelethon-src plugin-skelethon)))) (os-pwd)) - (merge-pathnames (make-pathname :directory (list :relative (get-skelethon-src plugin-skelethon))) (os-pwd)))) + (if (listp (get-skeleton-src plugin-skeleton)) + (merge-pathnames (make-pathname :directory (list :relative (car (get-skeleton-src plugin-skeleton)))) (os-pwd)) + (merge-pathnames (make-pathname :directory (list :relative (get-skeleton-src plugin-skeleton))) (os-pwd)))) (plugin-components (list-directory (merge-pathnames plugin-src-dir (os-pwd)))) @@ -128,7 +128,7 @@ :license ,plugin-license :description ,plugin-description :serial t - :skelethon (,(get-skelethon-name plugin-skelethon)) + :skeleton (,(get-skeleton-name plugin-skeleton)) :components ,(reverse plugin-component-names))) ;; (run-project (find-plugin (tools@jabs:tosymbol plugin-name))) ))))) diff --git a/share/plugins/generic/tmpl/project.lisp b/share/plugins/generic/tmpl/project.lisp index 0fb35fe33821a5aa27363e0801b52101a97de3e3..2a375add95621d6039ff91e7e7763da11c2fad89 100644 --- a/share/plugins/generic/tmpl/project.lisp +++ b/share/plugins/generic/tmpl/project.lisp @@ -5,7 +5,7 @@ (in-package #:tmpl@generic@plugin@jabs) -(defvar *tmpl-skelethon-name* :default) +(defvar *tmpl-skeleton-name* :default) (defvar *tmpl-author* :default) (defvar *tmpl-version* "0.0.1") @@ -20,7 +20,7 @@ (maintainer "John Doe ") (license "Public Domain") (description "Personal use project") - (skelethon "(:default)") + (skeleton "(:default)") (bout ":default") (plugins "(:quicklisp@repository)") (components (format nil "~15t(:file \"fixture\")~%"))) @@ -38,7 +38,7 @@ :license \"~a\" :description \"~a\" :serial t - :skelethon ~a + :skeleton ~a :bout ~a ;; :plugins ~a ;;;; Additional sources @@ -46,16 +46,16 @@ ;; :repositories (:quicklisp) ;; define some repositories here ;;;; Dependencies ;; :depends-on (:alexandria :cl-ppcre) - ;; :pathname \"some/relative/path\" ;; relative name to your project root directory (where skelethon located) + ;; :pathname \"some/relative/path\" ;; relative name to your project root directory (where skeleton located) ;;;; Add files, mobules etc :components ( ~a)) -" name name name name author version maintainer license description skelethon bout plugins components)) +" name name name name author version maintainer license description skeleton bout plugins components)) (defhit tmpl-mkproject () () (let* ((project-name (get-project-name *jabs-current-project*)) (project-description (get-project-description *jabs-current-project*)) - (project-skelethon-name (car (slot-value *jabs-current-project* 'jabs::skelethon))) + (project-skeleton-name (car (slot-value *jabs-current-project* 'jabs::skeleton))) (project-components (slot-value *jabs-current-project* 'jabs::components)) (project-component-names) (project-template)) @@ -78,7 +78,7 @@ :license (ignore-errors (slot-value *jabs-current-project* 'jabs::license)) :description project-description :plugins (ignore-errors (slot-value *jabs-current-project* 'jabs::plugins)) - :skelethon (concatenate 'string "(:" (string-downcase (princ-to-string project-skelethon-name)) ")") + :skeleton (concatenate 'string "(:" (string-downcase (princ-to-string project-skeleton-name)) ")") :components project-component-names )) ;; @@ -98,7 +98,7 @@ (jlog:note "Project already exists. Nothing to create") (terminate 0)) (progn - (load-skelethon (list *tmpl-skelethon-name*)) + (load-skeleton (list *tmpl-skeleton-name*)) ;; (let* ((project-name (car (reverse (pathname-directory (os-pwd))))) (project-author "John Doe ") @@ -108,12 +108,12 @@ (project-description "Personal use project") (project-serial t) (project-plugins '(:quicklisp@repository)) - (project-skelethon (find-skelethon *tmpl-skelethon-name*)) + (project-skeleton (find-skeleton *tmpl-skeleton-name*)) (project-bout :default) (project-src-dir - (if (listp (get-skelethon-src project-skelethon)) - (merge-pathnames (make-pathname :directory (list :relative (car (get-skelethon-src project-skelethon)))) (os-pwd)) - (merge-pathnames (make-pathname :directory (list :relative (get-skelethon-src project-skelethon))) (os-pwd)))) + (if (listp (get-skeleton-src project-skeleton)) + (merge-pathnames (make-pathname :directory (list :relative (car (get-skeleton-src project-skeleton)))) (os-pwd)) + (merge-pathnames (make-pathname :directory (list :relative (get-skeleton-src project-skeleton))) (os-pwd)))) (project-components (list-directory (merge-pathnames project-src-dir (os-pwd)))) @@ -134,20 +134,20 @@ :license ,project-license :description ,project-description :serial t - :skelethon (,(get-skelethon-name project-skelethon)) + :skeleton (,(get-skeleton-name project-skeleton)) :components ,(reverse project-component-names))) ;; (run-project (find-project (tools@jabs:tostr project-name))) ))))) (bind-jabs-cli-parameter - "tmpl-skelethon" + "tmpl-skeleton" #'(lambda (&rest x) - (setf *tmpl-skelethon-name* (tokeyword (car x))))) + (setf *tmpl-skeleton-name* (tokeyword (car x))))) (bind-jabs-cli-parameter "tmpl-version" #'(lambda (&rest x) (setf *tmpl-version* (car x)))) -(process-jabs-cli-parameter "tmpl-skelethon") +(process-jabs-cli-parameter "tmpl-skeleton") (process-jabs-cli-parameter "tmpl-version") diff --git a/share/plugins/generic/tmpl/runner.lisp b/share/plugins/generic/tmpl/runner.lisp index a17f8848c2702244724a4d661e6f428be2153414..b3d9082e56d2481e7ec071a1a964a476c357768e 100644 --- a/share/plugins/generic/tmpl/runner.lisp +++ b/share/plugins/generic/tmpl/runner.lisp @@ -10,7 +10,7 @@ (if (file-exists-p (merge-pathnames (make-pathname :name "build" :type "jab") (os-pwd))) (jlog:crit "Buildfile already exists. Nothing to create") (progn - (load-skelethon (list *tmpl-skelethon-name*)) + (load-skeleton (list *tmpl-skeleton-name*)) ;; (let ((project-name (car (reverse (pathname-directory (os-pwd)))))) (setf *jabs-project-to-run* (tokeyword project-name)) diff --git a/share/plugins/repository/quicklisp/build.jab b/share/plugins/repository/quicklisp/build.jab index 9a3930b9bdb5cd4c3997418e6e3c82103b458b52..f991fa09c0f5733fa1353a147159793362a2bddc 100644 --- a/share/plugins/repository/quicklisp/build.jab +++ b/share/plugins/repository/quicklisp/build.jab @@ -11,7 +11,7 @@ :license "Public Domain" :description "Here is my project" ;; :serial t - :skelethon (:flat) ;; (nil) ;; will be w/o '(' ')' in v.0.2+ + :skeleton (:flat) ;; (nil) ;; will be w/o '(' ')' in v.0.2+ :bout :default ;;; Additional sources ;; :sources ((make-pathname :directory '(:relative "another-lib"))) diff --git a/share/plugins/repository/quicklisp/quicklisp-repository.lisp b/share/plugins/repository/quicklisp/quicklisp-repository.lisp index 588dd7fe5cd2ae35c4dffef367052cbfd07bf248..e26b9e041bbfee3722a8b9e749940deeea75d734 100644 --- a/share/plugins/repository/quicklisp/quicklisp-repository.lisp +++ b/share/plugins/repository/quicklisp/quicklisp-repository.lisp @@ -18,28 +18,28 @@ (jlog:dbg "Quicklisp installed"))))) (with-project-to-be-run *jabs-current-project* - (let ((skelethon-name (or - (try (car (slot-value *jabs-current-project* 'jabs::skelethon))) - (try (slot-value *jabs-current-project* 'jabs::skelethon)) - *jabs-default-skelethon-name*))) - ;; pre-load skelethon - (load-skelethon skelethon-name) + (let ((skeleton-name (or + (try (car (slot-value *jabs-current-project* 'jabs::skeleton))) + (try (slot-value *jabs-current-project* 'jabs::skeleton)) + *jabs-default-skeleton-name*))) + ;; pre-load skeleton + (load-skeleton skeleton-name) ;; - (let* ((skelethon (find-skelethon skelethon-name)) - (skelethon-cache-dir + (let* ((skeleton (find-skeleton skeleton-name)) + (skeleton-cache-dir (or (try (make-pathname :directory (list :relative - (or (try (car (get-skelethon-cache skelethon))) - (try (get-skelethon-cache skelethon)))))) + (or (try (car (get-skeleton-cache skeleton))) + (try (get-skeleton-cache skeleton)))))) (make-pathname :directory '(:absolute "tmp")))) (path (merge-pathnames (merge-pathnames (make-pathname :directory (list :relative "quicklisp" (string-downcase (princ-to-string (get-project-name *jabs-current-project*))))) - skelethon-cache-dir) + skeleton-cache-dir) jabs::+jabs-run-directory+))) (initialize-repository path) (share-plugin (find-plugin :quicklisp :repository)) diff --git a/share/plugins/test/fiveam/build.jab b/share/plugins/test/fiveam/build.jab index 75ec0e393c63126e23932b4f3ef55c2e24a52720..0703efeeca6b66e2782bf801845e098e3af698d2 100644 --- a/share/plugins/test/fiveam/build.jab +++ b/share/plugins/test/fiveam/build.jab @@ -10,6 +10,6 @@ :license "Public Domain" :description "Personal use project" :serial t - :skelethon (:flat) + :skeleton (:flat) :depends-on (:fiveam) :components ((:file "fiveam"))) diff --git a/share/rounds/initialize.rd b/share/rounds/initialize.rd index e6c940b8e76f0dbd39dd64fedbbe1841f51dec48..8cb8f5422c6ab4e5c1a989ffdee133f907212add 100644 --- a/share/rounds/initialize.rd +++ b/share/rounds/initialize.rd @@ -1,5 +1,5 @@ ;; -*- mode: lisp -*- (:initialize - :process-skelethon + :process-skeleton ;; :load-plugins ) diff --git a/share/skelethons/default.skl b/share/skeletons/default.skl similarity index 100% rename from share/skelethons/default.skl rename to share/skeletons/default.skl diff --git a/share/skelethons/flat.skl b/share/skeletons/flat.skl similarity index 100% rename from share/skelethons/flat.skl rename to share/skeletons/flat.skl diff --git a/src/core/jabs-asdf/jabs-asdf.lisp b/src/core/jabs-asdf/jabs-asdf.lisp index c29617b09e2b8ff30a3a669e6910ad22e6cdbc7e..b02e696eb24218877566057be9555df2aed1b1ff 100644 --- a/src/core/jabs-asdf/jabs-asdf.lisp +++ b/src/core/jabs-asdf/jabs-asdf.lisp @@ -1,6 +1,6 @@ (defpackage asdf@core@plugin@jabs (:use :cl :tools@jabs :re@jabs :jabs - :skelethon@core@plugin@jabs)) + :skeleton@core@plugin@jabs)) ;; TODO: revise https://common-lisp.net/project/asdf/asdf.html#The-defsystem-grammar (in-package :asdf@core@plugin@jabs) @@ -118,8 +118,8 @@ compiling asdf.lisp to a FASL and then loading it." ;; (apply 'asdf/parse-defsystem:register-system-definition ',name ;; (clear-defsystem ',options :prefix -;; (or (car (get-skelethon-src -;; (find-skelethon (car (get-project-skelethon (find-project ',name)))))) +;; (or (car (get-skeleton-src +;; (find-skeleton (car (get-project-skeleton (find-project ',name)))))) ;; ""))) (defgeneric define-asdf-system (project) @@ -127,17 +127,17 @@ compiling asdf.lisp to a FASL and then loading it." (defmethod define-asdf-system ((project project)) (let* ((asdf-list) - (skelethon-name (or - (try (car (slot-value project 'skelethon))) - (try (slot-value project 'skelethon)) - (get-skelethon-name (find-skelethon *jabs-default-skelethon-name*)))) - (skelethon) + (skeleton-name (or + (try (car (slot-value project 'skeleton))) + (try (slot-value project 'skeleton)) + (get-skeleton-name (find-skeleton *jabs-default-skeleton-name*)))) + (skeleton) (name (get-project-name project)) - (skelethon-src)) - ;; Finding skelethon to get src-path - (setf skelethon (find-skelethon skelethon-name)) - (let ((skelethon-got-src (get-skelethon-src skelethon))) - (setf skelethon-src (if (atom skelethon-got-src) skelethon-got-src (car skelethon-got-src)))) + (skeleton-src)) + ;; Finding skeleton to get src-path + (setf skeleton (find-skeleton skeleton-name)) + (let ((skeleton-got-src (get-skeleton-src skeleton))) + (setf skeleton-src (if (atom skeleton-got-src) skeleton-got-src (car skeleton-got-src)))) ;; (dolist (v *asdf-symbols-list*) (let ((slot (try (slot-value project (tosymbol v :jabs))))) @@ -150,7 +150,7 @@ compiling asdf.lisp to a FASL and then loading it." ,name ',(append asdf-list (list :pathname (merge-pathnames - (pathname-as-directory skelethon-src) + (pathname-as-directory skeleton-src) (pathname-as-directory (slot-value project 'pathname))))))))) @@ -160,13 +160,13 @@ compiling asdf.lisp to a FASL and then loading it." (defmethod set-additional-sources ((project project)) (let ((additional-sources (try (slot-value project 'jabs::sources))) (skel-lib - (get-skelethon-lib - (find-skelethon + (get-skeleton-lib + (find-skeleton (or - (ignore-errors (car (slot-value project 'jabs:skelethon))) - (ignore-errors (slot-value project 'jabs:skelethon)) - *jabs-default-skelethon-name*))))) - ;; add skelethon lib dir + (ignore-errors (car (slot-value project 'jabs:skeleton))) + (ignore-errors (slot-value project 'jabs:skeleton)) + *jabs-default-skeleton-name*))))) + ;; add skeleton lib dir (push skel-lib additional-sources) ;; (when additional-sources @@ -202,7 +202,7 @@ compiling asdf.lisp to a FASL and then loading it." `(jabs::register-project ,(tools@jabs:tosymbol name) ',(append - '(:skelethon :flat) ; register ASDF system as project with flat skelethon + '(:skeleton :flat) ; register ASDF system as project with flat skeleton options)))))) ;;;; Some macros for better ASDF compatability diff --git a/src/core/jabs-depmanager/jabs-depmanager.lisp b/src/core/jabs-depmanager/jabs-depmanager.lisp index 2dabd5fd1a51509604c12b67a664028039d19ff8..280e2d452bb581a6c9e628ebc738842a02833a94 100644 --- a/src/core/jabs-depmanager/jabs-depmanager.lisp +++ b/src/core/jabs-depmanager/jabs-depmanager.lisp @@ -71,18 +71,18 @@ Created for ASDF compatability" (defmethod get-project-projects-map ((project project)) "Get project names mapped to files for only for given project w\o global map" - (let* ((skel-name (or (car (try (slot-value project 'skelethon))) - *jabs-default-skelethon-name*)) + (let* ((skel-name (or (car (try (slot-value project 'skeleton))) + *jabs-default-skeleton-name*)) (skel (or - (find-skelethon skel-name) + (find-skeleton skel-name) (and - (load-skelethon skel-name) - (find-skelethon skel-name)))) - (lib (or (try (car (get-skelethon-lib skel))) - (get-skelethon-lib skel))) - (contrib (or (try (car (get-skelethon-contrib skel))) - (get-skelethon-contrib skel))) - (opt (get-skelethon-opt skel)) + (load-skeleton skel-name) + (find-skeleton skel-name)))) + (lib (or (try (car (get-skeleton-lib skel))) + (get-skeleton-lib skel))) + (contrib (or (try (car (get-skeleton-contrib skel))) + (get-skeleton-contrib skel))) + (opt (get-skeleton-opt skel)) (hash (make-hash-table))) ;; (mapcar #'(lambda (x) @@ -98,18 +98,18 @@ w\o global map" (defmethod get-project-systems-map ((project project)) "Get asdf system names mapped to files for only for given project w\o global map. For ASDF back compatability" - (let* ((skel-name (or (car (try (slot-value project 'skelethon))) - *jabs-default-skelethon-name*)) + (let* ((skel-name (or (car (try (slot-value project 'skeleton))) + *jabs-default-skeleton-name*)) (skel (or - (find-skelethon skel-name) + (find-skeleton skel-name) (and - (load-skelethon skel-name) - (find-skelethon skel-name)))) - (lib (or (try (car (get-skelethon-lib skel))) - (get-skelethon-lib skel))) - (contrib (or (try (car (get-skelethon-contrib skel))) - (get-skelethon-contrib skel))) - (opt (get-skelethon-opt skel)) + (load-skeleton skel-name) + (find-skeleton skel-name)))) + (lib (or (try (car (get-skeleton-lib skel))) + (get-skeleton-lib skel))) + (contrib (or (try (car (get-skeleton-contrib skel))) + (get-skeleton-contrib skel))) + (opt (get-skeleton-opt skel)) (hash (make-hash-table))) ;; (mapcar #'(lambda (x) diff --git a/src/core/jabs-operations/jabs-operations.lisp b/src/core/jabs-operations/jabs-operations.lisp index 4285b670c1502046370e2097619cfe47385f8ec3..4cdadc90657f33205a27b583d85e30ad9766fb2f 100644 --- a/src/core/jabs-operations/jabs-operations.lisp +++ b/src/core/jabs-operations/jabs-operations.lisp @@ -1,6 +1,6 @@ (defpackage operations@core@plugin@jabs (:use :cl :tools@jabs :re@jabs :jabs - :skelethon@core@plugin@jabs)) + :skeleton@core@plugin@jabs)) (in-package :operations@core@plugin@jabs) diff --git a/src/core/jabs-skelethon/jabs-skelethon.lisp b/src/core/jabs-skelethon/jabs-skelethon.lisp deleted file mode 100644 index 861c04f8207bba34388e2e76b4735a7c0d80752c..0000000000000000000000000000000000000000 --- a/src/core/jabs-skelethon/jabs-skelethon.lisp +++ /dev/null @@ -1,375 +0,0 @@ -(defpackage skelethon@core@plugin@jabs - (:use :cl :tools@jabs :re@jabs :jabs)) - -(in-package :skelethon@core@plugin@jabs) - -(make-instance 'jabs::plugin :name :skelethon :type :core :version jabs::+jabs-version+) - -(in-package :jabs) - -(export '(defskelethon - find-skelethon - ;; run-skelethon - skelethon - ;; - get-skelethon-name - get-skelethon-src - get-skelethon-bin - get-skelethon-lib - get-skelethon-doc - get-skelethon-share - get-skelethon-test - get-skelethon-contrib - get-skelethon-conf - get-skelethon-public - get-skelethon-script - get-skelethon-cache - get-skelethon-log - get-skelethon-template - get-skelethon-opt - get-skelethon-tmp - get-skelethon-target - get-skelethon-readme-file - get-skelethon-license-file - get-skelethon-install-file - ;; - *jabs-default-skelethon-name* - load-skelethon - )) - -(defvar *jabs-skelethon-directories* - (list - (merge-pathnames (make-pathname :directory '(:relative "skelethons")) *jabs-share-directory*) - (merge-pathnames (make-pathname :directory '(:relative ".jabs" "skelethons")) (user-homedir-pathname)) - (merge-pathnames (make-pathname :directory '(:relative ".jabs" "skelethons")) (os-pwd)) - )) - -(defvar *jabs-default-skelethon-name* :default) -(defvar *jabs-skelethon-registry* (make-hash-table)) -(defvar *jabs-current-skelethon* nil) -(defvar *jabs-skelethon-template-type* "skl") - -(defclass skelethon () - ((name :accessor get-skelethon-name :initarg :name) - (src :accessor get-skelethon-src :initarg :src) - (bin :accessor get-skelethon-bin :initarg :bin) - (lib :accessor get-skelethon-lib :initarg :lib) - (doc :accessor get-skelethon-doc :initarg :doc) - (share :accessor get-skelethon-share :initarg :share) - (test :accessor get-skelethon-test :initarg :test) - (contrib :accessor get-skelethon-contrib :initarg :contrib) - (conf :accessor get-skelethon-conf :initarg :conf) - (public :accessor get-skelethon-public :initarg :public) - (script :accessor get-skelethon-script :initarg :script) - (cache :accessor get-skelethon-cache :initarg :cache) - (log :accessor get-skelethon-log :initarg :log) - (template :accessor get-skelethon-template :initarg :template) - (opt :accessor get-skelethon-opt :initarg :opt) ;; other optional directories, not /opt :) - (tmp :accessor get-skelethon-tmp :initarg :tmp) - (target :accessor get-skelethon-target :initarg :target) - (readme-file :accessor get-skelethon-readme-file :initarg :readme-file) - (license-file :accessor get-skelethon-license-file :initarg :license-file) - (install-file :accessor get-skelethon-install-file :initarg :install-file))) - -(defun find-skelethon (name) - (check-type name keyword) - (gethash name *jabs-skelethon-registry*)) - -(defun skelethondir-p (dir) - "Skelethon directory record must be a string, or list - in format - - (\"dirname\" 755 :required) -or - (\"dirname\" :optional) -or - (\"dirname\" 511) - -It`s optional by default -" - (flet ((ro (symbol) - "check for :required or :optional" - (when (or (eq :required symbol) (eq :optional symbol)) t))) - (when (or (null dir) - (stringp dir) - (pathnamep dir) - (and (listp dir) - ;; 1st arg - (or (stringp (car dir)) - (pathnamep (car dir))) - ;; 2nd arg - (or (integerp (nth 1 dir)) - (ro (nth 1 dir))) - ;; 3rd arg - (or (null (nth 2 dir)) - (ro (nth 2 dir))) - (null (nth 3 dir)))) - t))) - -(defun listskelethondirs-p (dirs) - "Skelethon can take list of optional directories, which are -not included to main schema (like socket or dev dir etc)" - (cond ((null dirs) t) - ((atom dirs) nil) - (t (when (skelethondir-p (car dirs)) - (listskelethondirs-p (cdr dirs)))))) - -(deftype skelethondir () - '(satisfies skelethondir-p)) - -(deftype listskelethondirs () - '(satisfies listskelethondirs-p)) - -(defun register-skelethon (name &key bin lib src test conf share doc - contrib public script cache log template opt tmp - target readme-file license-file install-file) - (check-type name keyword) - (check-type bin (or null skelethondir)) - (check-type lib (or null skelethondir)) - (check-type src (or null skelethondir)) - (check-type test (or null skelethondir)) - (check-type conf (or null skelethondir)) - (check-type share (or null skelethondir)) - (check-type doc (or null skelethondir)) - (check-type contrib (or null skelethondir)) - (check-type public (or null skelethondir)) - (check-type script (or null skelethondir)) - (check-type cache (or null skelethondir)) - (check-type log (or null skelethondir)) - (check-type template (or null skelethondir)) - (check-type tmp (or null skelethondir)) - (check-type opt (or null listskelethondirs)) - (check-type target (or null skelethondir)) - (check-type readme-file (or null string)) - (check-type license-file (or null string)) - (check-type install-file (or null string)) - (jlog:dbg "Registering skelethon ``~a''" name) - (setf - (gethash name *jabs-skelethon-registry*) - (make-instance - 'skelethon - :name name - :bin bin :lib lib - :src src :test test :conf conf - :share share :doc doc - :contrib contrib :public public - :script script :cache cache :log log - :template template :tmp tmp :opt opt - :target target - :readme-file readme-file - :license-file license-file - :install-file install-file)) - (jlog:info "Skelethon ``~a'' registered" name)) - -(defmacro defskelethon (name &body options) - `(apply 'register-skelethon ,(tosymbol name) ',options)) - -(defgeneric initialize-license (skelethon) - ) - -(defmethod initialize-license ((skelethon skelethon)) ;; TODO: - t) - -(defgeneric initialize-readme (skelethon) - ) - -(defmethod initialize-readme ((skelethon skelethon)) ;; TODO: - t) - -(defgeneric initialize-install (skelethon) - ) - -(defmethod initialize-install ((skelethon skelethon)) ;; TODO: - t) - -(defun make-skelethon-directory (dir &key prefix force) ;; FIXME: rewrite for correct pathnames - (check-type dir skelethondir) - (check-type prefix (or null string pathname)) - (when (or (and - (listp dir) - (or (eq (nth 1 dir) :required) - (eq (nth 2 dir) :required))) - (not (null force))) - (let* ((path-dir (pathname-as-directory (parse-namestring (car dir)))) - (path-prefix (if (stringp prefix) (pathname-as-directory (parse-namestring prefix)) prefix)) - (mode (when (integerp (nth 1 dir)) (nth 1 dir))) - list - (full-dir-path (merge-pathnames path-dir path-prefix))) - ;; - (push full-dir-path list) - ;; add mode - (when (not (null mode)) - (nconc list (list :mode mode))) - (cond ((and - (file-exists-p full-dir-path) - (not (directory-pathname-p full-dir-path))) - (jlog:err "Directory ``~a'' is regular file. Can not create directory" full-dir-path)) - ((directory-exists-p (merge-pathnames path-dir path-prefix)) - (jlog:dbg "Directory ``~a'' already exists. Skipping" full-dir-path)) - (t - (jlog:info "Making directory ``~a''" full-dir-path) - (apply 'ensure-directories-exist list)))))) - -(defgeneric initialize-skelethon (skelethon &key prefix force) - ) - -(defmethod initialize-skelethon ((skelethon skelethon) &key (prefix "") (force nil)) - ;; directories-init - (let ((dirs (list - (get-skelethon-bin skelethon) - (get-skelethon-lib skelethon) - (get-skelethon-src skelethon) - (get-skelethon-test skelethon) - (get-skelethon-conf skelethon) - (get-skelethon-share skelethon) - (get-skelethon-doc skelethon) - (get-skelethon-contrib skelethon) - (get-skelethon-public skelethon) - (get-skelethon-script skelethon) - (get-skelethon-cache skelethon) - (get-skelethon-log skelethon) - (get-skelethon-template skelethon) - (get-skelethon-tmp skelethon)))) - (jlog:dbg "Initializing skelethon ``~a'' in ``~a''" - (get-skelethon-name skelethon) - (merge-pathnames (pathname-as-directory (if (stringp prefix) (parse-namestring prefix) prefix)) - (pathname-as-directory (os-pwd)))) - (dolist (dir (remove nil dirs)) - (make-skelethon-directory dir :prefix prefix :force force))) - ;; - (when (not (null (get-skelethon-opt skelethon))) - (dolist (dir (get-skelethon-opt skelethon)) - (make-skelethon-directory dir :prefix prefix :force force))) - ;; initializing standard files - ;; (initialize-license skelethon) - ;; (initialize-readme skelethon) - ;; (initialize-install skelethon) - (jlog:info ".[ Initialized skelethon ``~a'' in ``~a'' ]" - (get-skelethon-name skelethon) - (merge-pathnames (pathname-as-directory (if (stringp prefix) (parse-namestring prefix) prefix)) - (pathname-as-directory (os-pwd)))) - ) - -;; (defskelethon default -;; :bin "bin1" -;; :lib ("lib1") -;; :src ((:relative "src1") 0770 :required)) - -;; (initialize-skelethon (find-skelethon :test)) - -(defun parse-skelethon-from-file (file) - (check-type file (or string pathname)) - (let* ((content (car (os-cat file :list))) - (skelethon-name (tosymbol (car content))) - (skelethon-body (cdr content))) - ;; - (jlog:dbg "Processing skelethon file ``~a''" file) - (eval (cons 'defskelethon (cons skelethon-name skelethon-body))))) - -(defun parse-skelethon-inline (name skelethon) - (check-type name symbol) - (check-type skelethon list) - (eval (cons 'defskelethon (cons name skelethon)))) - -(defmacro make-get-project-smth-dir (dir) ;; TODO: rewrite w/o get-project-skelethon - `(progn - (defgeneric ,(intern (string-upcase (concatenate 'string "project-" dir "-dir"))) (project)) - (defmethod ,(intern (string-upcase (concatenate 'string "project-" dir "-dir"))) ((project project)) - (let ((dir (parse-namestring - (,(intern (string-upcase (concatenate 'string "get-skelethon-" dir))) - (find-skelethon - (or - (try (slot-value project 'skelethon)) - (list *jabs-default-skelethon-name*)) - )))) - (project-pathname (get-project-pathname project)) - (workdir (os-pwd))) - (cond ((eq :absolute (car (pathname-directory dir))) dir) - ((eq :absolute (car (pathname-directory project-pathname))) - (merge-pathnames dir project-pathname)) - (t (merge-n-directories workdir project-pathname dir))))))) - -(dolist (d (list "src" "bin" "lib" "doc" "share" "test" "contrib" "conf" "public" "cache" "script" "log" "template" "opt" "tmp")) - (eval `(make-get-project-smth-dir ,d))) - -;; TODO: skelethon:create-from-project -;; TODO: show list of skelethons - -;; TODO: +add project name to skelethon dirs -;; TODO: +add package naming convension -;; TODO: +add build.jab sample for all skelethons - -(defun process-skelethon (skelethon-params) - "process skelethon" - (let* ((project-name (get-project-name *jabs-current-project*)) - (skelethon-name (if (atom skelethon-params) skelethon-params (car skelethon-params))) - (skelethon-force (when (listp skelethon-params) (cadr skelethon-params))) - (skelethon-obj (if skelethon-name - (find-skelethon skelethon-name) - (progn - (jlog:wrn "There is no skelethon ``~a'' for project ``~a''. Using default: ``~a''" - skelethon-name project-name *jabs-default-skelethon-name*) - (find-skelethon *jabs-default-skelethon-name*))))) - ;; - (when (null skelethon-obj) - (jlog:crit "There is no skelethon for project ``~a'' or default skeelethon ``~a''. Check your installation consistency" - project-name *jabs-default-skelethon-name*)) - (if skelethon-force - (jlog:dbg "Processing skelethon ``~a'' for project ``~a'' FORCE" skelethon-name project-name) - (jlog:dbg "Processing skelethon ``~a'' for project ``~a''" skelethon-name project-name)) - (setf skelethon-name (tosymbol (gensym "SKELETHON-"))) - (initialize-skelethon skelethon-obj :force skelethon-force))) - -(defun find-skelethon-file (name) - (check-type name (or string symbol)) - (let ((skelethon-name (string-downcase (princ-to-string name))) - (skelethon-dirs)) - (dolist (dirs *jabs-skelethon-directories*) - (dolist (dir (directory - (merge-pathnames - (make-pathname :name skelethon-name :type *jabs-skelethon-template-type*) - dirs))) - (push dir skelethon-dirs))) - (car skelethon-dirs))) - -(defun load-skelethon (skelethon) - (let ((skelethon-name (if (listp skelethon) (car skelethon) skelethon))) - (when (and (not (find-skelethon skelethon-name)) (or (atom skelethon) (null (cdr skelethon)) (eq (cdr skelethon) :force))) - (let ((file-to-load - (find-skelethon-file (string-downcase (princ-to-string skelethon-name))))) - (if file-to-load - (parse-skelethon-from-file file-to-load) - (jlog:crit "There is no file for skelethon ``~a''" skelethon-name)))))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;;; extending defproject syntax -(bind-project-symbol - :skelethon - #'(lambda (x) - (declare (ignore x)))) - -(defgeneric load-project-skelethon (project) - ) - -(defmethod load-project-skelethon ((project project)) - (let ((skelethon - (or - (try (slot-value project 'skelethon)) - (list *jabs-default-skelethon-name*)))) - (load-skelethon skelethon))) - -(defgeneric process-project-skelethon (project) - ) - -(defmethod process-project-skelethon ((project project)) - (let ((skelethon (or - (try (slot-value project 'skelethon)) - (list *jabs-default-skelethon-name*)))) - (process-skelethon skelethon))) - -;;;; adding define-project-hook to load skelethon -(add-hook *define-project-hook* #'load-project-skelethon) - -;;;; adding run-project-hook to process skelethon -;; (add-hook *run-project-hook* #'process-project-skelethon) diff --git a/src/core/jabs-skeleton/jabs-skeleton.lisp b/src/core/jabs-skeleton/jabs-skeleton.lisp new file mode 100644 index 0000000000000000000000000000000000000000..eeef3ea8be9bbddc2ac763a57ff232a763b6da25 --- /dev/null +++ b/src/core/jabs-skeleton/jabs-skeleton.lisp @@ -0,0 +1,375 @@ +(defpackage skeleton@core@plugin@jabs + (:use :cl :tools@jabs :re@jabs :jabs)) + +(in-package :skeleton@core@plugin@jabs) + +(make-instance 'jabs::plugin :name :skeleton :type :core :version jabs::+jabs-version+) + +(in-package :jabs) + +(export '(defskeleton + find-skeleton + ;; run-skeleton + skeleton + ;; + get-skeleton-name + get-skeleton-src + get-skeleton-bin + get-skeleton-lib + get-skeleton-doc + get-skeleton-share + get-skeleton-test + get-skeleton-contrib + get-skeleton-conf + get-skeleton-public + get-skeleton-script + get-skeleton-cache + get-skeleton-log + get-skeleton-template + get-skeleton-opt + get-skeleton-tmp + get-skeleton-target + get-skeleton-readme-file + get-skeleton-license-file + get-skeleton-install-file + ;; + *jabs-default-skeleton-name* + load-skeleton + )) + +(defvar *jabs-skeleton-directories* + (list + (merge-pathnames (make-pathname :directory '(:relative "skeletons")) *jabs-share-directory*) + (merge-pathnames (make-pathname :directory '(:relative ".jabs" "skeletons")) (user-homedir-pathname)) + (merge-pathnames (make-pathname :directory '(:relative ".jabs" "skeletons")) (os-pwd)) + )) + +(defvar *jabs-default-skeleton-name* :default) +(defvar *jabs-skeleton-registry* (make-hash-table)) +(defvar *jabs-current-skeleton* nil) +(defvar *jabs-skeleton-template-type* "skl") + +(defclass skeleton () + ((name :accessor get-skeleton-name :initarg :name) + (src :accessor get-skeleton-src :initarg :src) + (bin :accessor get-skeleton-bin :initarg :bin) + (lib :accessor get-skeleton-lib :initarg :lib) + (doc :accessor get-skeleton-doc :initarg :doc) + (share :accessor get-skeleton-share :initarg :share) + (test :accessor get-skeleton-test :initarg :test) + (contrib :accessor get-skeleton-contrib :initarg :contrib) + (conf :accessor get-skeleton-conf :initarg :conf) + (public :accessor get-skeleton-public :initarg :public) + (script :accessor get-skeleton-script :initarg :script) + (cache :accessor get-skeleton-cache :initarg :cache) + (log :accessor get-skeleton-log :initarg :log) + (template :accessor get-skeleton-template :initarg :template) + (opt :accessor get-skeleton-opt :initarg :opt) ;; other optional directories, not /opt :) + (tmp :accessor get-skeleton-tmp :initarg :tmp) + (target :accessor get-skeleton-target :initarg :target) + (readme-file :accessor get-skeleton-readme-file :initarg :readme-file) + (license-file :accessor get-skeleton-license-file :initarg :license-file) + (install-file :accessor get-skeleton-install-file :initarg :install-file))) + +(defun find-skeleton (name) + (check-type name keyword) + (gethash name *jabs-skeleton-registry*)) + +(defun skeletondir-p (dir) + "Skelethon directory record must be a string, or list + in format + + (\"dirname\" 755 :required) +or + (\"dirname\" :optional) +or + (\"dirname\" 511) + +It`s optional by default +" + (flet ((ro (symbol) + "check for :required or :optional" + (when (or (eq :required symbol) (eq :optional symbol)) t))) + (when (or (null dir) + (stringp dir) + (pathnamep dir) + (and (listp dir) + ;; 1st arg + (or (stringp (car dir)) + (pathnamep (car dir))) + ;; 2nd arg + (or (integerp (nth 1 dir)) + (ro (nth 1 dir))) + ;; 3rd arg + (or (null (nth 2 dir)) + (ro (nth 2 dir))) + (null (nth 3 dir)))) + t))) + +(defun listskeletondirs-p (dirs) + "Skelethon can take list of optional directories, which are +not included to main schema (like socket or dev dir etc)" + (cond ((null dirs) t) + ((atom dirs) nil) + (t (when (skeletondir-p (car dirs)) + (listskeletondirs-p (cdr dirs)))))) + +(deftype skeletondir () + '(satisfies skeletondir-p)) + +(deftype listskeletondirs () + '(satisfies listskeletondirs-p)) + +(defun register-skeleton (name &key bin lib src test conf share doc + contrib public script cache log template opt tmp + target readme-file license-file install-file) + (check-type name keyword) + (check-type bin (or null skeletondir)) + (check-type lib (or null skeletondir)) + (check-type src (or null skeletondir)) + (check-type test (or null skeletondir)) + (check-type conf (or null skeletondir)) + (check-type share (or null skeletondir)) + (check-type doc (or null skeletondir)) + (check-type contrib (or null skeletondir)) + (check-type public (or null skeletondir)) + (check-type script (or null skeletondir)) + (check-type cache (or null skeletondir)) + (check-type log (or null skeletondir)) + (check-type template (or null skeletondir)) + (check-type tmp (or null skeletondir)) + (check-type opt (or null listskeletondirs)) + (check-type target (or null skeletondir)) + (check-type readme-file (or null string)) + (check-type license-file (or null string)) + (check-type install-file (or null string)) + (jlog:dbg "Registering skeleton ``~a''" name) + (setf + (gethash name *jabs-skeleton-registry*) + (make-instance + 'skeleton + :name name + :bin bin :lib lib + :src src :test test :conf conf + :share share :doc doc + :contrib contrib :public public + :script script :cache cache :log log + :template template :tmp tmp :opt opt + :target target + :readme-file readme-file + :license-file license-file + :install-file install-file)) + (jlog:info "Skelethon ``~a'' registered" name)) + +(defmacro defskeleton (name &body options) + `(apply 'register-skeleton ,(tosymbol name) ',options)) + +(defgeneric initialize-license (skeleton) + ) + +(defmethod initialize-license ((skeleton skeleton)) ;; TODO: + t) + +(defgeneric initialize-readme (skeleton) + ) + +(defmethod initialize-readme ((skeleton skeleton)) ;; TODO: + t) + +(defgeneric initialize-install (skeleton) + ) + +(defmethod initialize-install ((skeleton skeleton)) ;; TODO: + t) + +(defun make-skeleton-directory (dir &key prefix force) ;; FIXME: rewrite for correct pathnames + (check-type dir skeletondir) + (check-type prefix (or null string pathname)) + (when (or (and + (listp dir) + (or (eq (nth 1 dir) :required) + (eq (nth 2 dir) :required))) + (not (null force))) + (let* ((path-dir (pathname-as-directory (parse-namestring (car dir)))) + (path-prefix (if (stringp prefix) (pathname-as-directory (parse-namestring prefix)) prefix)) + (mode (when (integerp (nth 1 dir)) (nth 1 dir))) + list + (full-dir-path (merge-pathnames path-dir path-prefix))) + ;; + (push full-dir-path list) + ;; add mode + (when (not (null mode)) + (nconc list (list :mode mode))) + (cond ((and + (file-exists-p full-dir-path) + (not (directory-pathname-p full-dir-path))) + (jlog:err "Directory ``~a'' is regular file. Can not create directory" full-dir-path)) + ((directory-exists-p (merge-pathnames path-dir path-prefix)) + (jlog:dbg "Directory ``~a'' already exists. Skipping" full-dir-path)) + (t + (jlog:info "Making directory ``~a''" full-dir-path) + (apply 'ensure-directories-exist list)))))) + +(defgeneric initialize-skeleton (skeleton &key prefix force) + ) + +(defmethod initialize-skeleton ((skeleton skeleton) &key (prefix "") (force nil)) + ;; directories-init + (let ((dirs (list + (get-skeleton-bin skeleton) + (get-skeleton-lib skeleton) + (get-skeleton-src skeleton) + (get-skeleton-test skeleton) + (get-skeleton-conf skeleton) + (get-skeleton-share skeleton) + (get-skeleton-doc skeleton) + (get-skeleton-contrib skeleton) + (get-skeleton-public skeleton) + (get-skeleton-script skeleton) + (get-skeleton-cache skeleton) + (get-skeleton-log skeleton) + (get-skeleton-template skeleton) + (get-skeleton-tmp skeleton)))) + (jlog:dbg "Initializing skeleton ``~a'' in ``~a''" + (get-skeleton-name skeleton) + (merge-pathnames (pathname-as-directory (if (stringp prefix) (parse-namestring prefix) prefix)) + (pathname-as-directory (os-pwd)))) + (dolist (dir (remove nil dirs)) + (make-skeleton-directory dir :prefix prefix :force force))) + ;; + (when (not (null (get-skeleton-opt skeleton))) + (dolist (dir (get-skeleton-opt skeleton)) + (make-skeleton-directory dir :prefix prefix :force force))) + ;; initializing standard files + ;; (initialize-license skeleton) + ;; (initialize-readme skeleton) + ;; (initialize-install skeleton) + (jlog:info ".[ Initialized skeleton ``~a'' in ``~a'' ]" + (get-skeleton-name skeleton) + (merge-pathnames (pathname-as-directory (if (stringp prefix) (parse-namestring prefix) prefix)) + (pathname-as-directory (os-pwd)))) + ) + +;; (defskeleton default +;; :bin "bin1" +;; :lib ("lib1") +;; :src ((:relative "src1") 0770 :required)) + +;; (initialize-skeleton (find-skeleton :test)) + +(defun parse-skeleton-from-file (file) + (check-type file (or string pathname)) + (let* ((content (car (os-cat file :list))) + (skeleton-name (tosymbol (car content))) + (skeleton-body (cdr content))) + ;; + (jlog:dbg "Processing skeleton file ``~a''" file) + (eval (cons 'defskeleton (cons skeleton-name skeleton-body))))) + +(defun parse-skeleton-inline (name skeleton) + (check-type name symbol) + (check-type skeleton list) + (eval (cons 'defskeleton (cons name skeleton)))) + +(defmacro make-get-project-smth-dir (dir) ;; TODO: rewrite w/o get-project-skeleton + `(progn + (defgeneric ,(intern (string-upcase (concatenate 'string "project-" dir "-dir"))) (project)) + (defmethod ,(intern (string-upcase (concatenate 'string "project-" dir "-dir"))) ((project project)) + (let ((dir (parse-namestring + (,(intern (string-upcase (concatenate 'string "get-skeleton-" dir))) + (find-skeleton + (or + (try (slot-value project 'skeleton)) + (list *jabs-default-skeleton-name*)) + )))) + (project-pathname (get-project-pathname project)) + (workdir (os-pwd))) + (cond ((eq :absolute (car (pathname-directory dir))) dir) + ((eq :absolute (car (pathname-directory project-pathname))) + (merge-pathnames dir project-pathname)) + (t (merge-n-directories workdir project-pathname dir))))))) + +(dolist (d (list "src" "bin" "lib" "doc" "share" "test" "contrib" "conf" "public" "cache" "script" "log" "template" "opt" "tmp")) + (eval `(make-get-project-smth-dir ,d))) + +;; TODO: skeleton:create-from-project +;; TODO: show list of skeletons + +;; TODO: +add project name to skeleton dirs +;; TODO: +add package naming convension +;; TODO: +add build.jab sample for all skeletons + +(defun process-skeleton (skeleton-params) + "process skeleton" + (let* ((project-name (get-project-name *jabs-current-project*)) + (skeleton-name (if (atom skeleton-params) skeleton-params (car skeleton-params))) + (skeleton-force (when (listp skeleton-params) (cadr skeleton-params))) + (skeleton-obj (if skeleton-name + (find-skeleton skeleton-name) + (progn + (jlog:wrn "There is no skeleton ``~a'' for project ``~a''. Using default: ``~a''" + skeleton-name project-name *jabs-default-skeleton-name*) + (find-skeleton *jabs-default-skeleton-name*))))) + ;; + (when (null skeleton-obj) + (jlog:crit "There is no skeleton for project ``~a'' or default skeelethon ``~a''. Check your installation consistency" + project-name *jabs-default-skeleton-name*)) + (if skeleton-force + (jlog:dbg "Processing skeleton ``~a'' for project ``~a'' FORCE" skeleton-name project-name) + (jlog:dbg "Processing skeleton ``~a'' for project ``~a''" skeleton-name project-name)) + (setf skeleton-name (tosymbol (gensym "SKELETHON-"))) + (initialize-skeleton skeleton-obj :force skeleton-force))) + +(defun find-skeleton-file (name) + (check-type name (or string symbol)) + (let ((skeleton-name (string-downcase (princ-to-string name))) + (skeleton-dirs)) + (dolist (dirs *jabs-skeleton-directories*) + (dolist (dir (directory + (merge-pathnames + (make-pathname :name skeleton-name :type *jabs-skeleton-template-type*) + dirs))) + (push dir skeleton-dirs))) + (car skeleton-dirs))) + +(defun load-skeleton (skeleton) + (let ((skeleton-name (if (listp skeleton) (car skeleton) skeleton))) + (when (and (not (find-skeleton skeleton-name)) (or (atom skeleton) (null (cdr skeleton)) (eq (cdr skeleton) :force))) + (let ((file-to-load + (find-skeleton-file (string-downcase (princ-to-string skeleton-name))))) + (if file-to-load + (parse-skeleton-from-file file-to-load) + (jlog:crit "There is no file for skeleton ``~a''" skeleton-name)))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;;; extending defproject syntax +(bind-project-symbol + :skeleton + #'(lambda (x) + (declare (ignore x)))) + +(defgeneric load-project-skeleton (project) + ) + +(defmethod load-project-skeleton ((project project)) + (let ((skeleton + (or + (try (slot-value project 'skeleton)) + (list *jabs-default-skeleton-name*)))) + (load-skeleton skeleton))) + +(defgeneric process-project-skeleton (project) + ) + +(defmethod process-project-skeleton ((project project)) + (let ((skeleton (or + (try (slot-value project 'skeleton)) + (list *jabs-default-skeleton-name*)))) + (process-skeleton skeleton))) + +;;;; adding define-project-hook to load skeleton +(add-hook *define-project-hook* #'load-project-skeleton) + +;;;; adding run-project-hook to process skeleton +;; (add-hook *run-project-hook* #'process-project-skeleton) diff --git a/src/core/jabs-test/jabs-test.lisp b/src/core/jabs-test/jabs-test.lisp index 881ee175d66b220764abba13f887237a20bfc49f..c55154ba7f55c01d29e358e5eda9341847d3dec7 100644 --- a/src/core/jabs-test/jabs-test.lisp +++ b/src/core/jabs-test/jabs-test.lisp @@ -77,19 +77,19 @@ The logic is: if you don't have modeline, than all of your test files acceptable. Else, you should mark, what test engine do you use " - (let* ((skelethon (find-skelethon - (or (try (car (project-slot-value project 'skelethon))) - (try (project-slot-value project 'skelethon)) - *jabs-default-skelethon-name*))) - (skelethon-test-dir (pathname-as-directory + (let* ((skeleton (find-skeleton + (or (try (car (project-slot-value project 'skeleton))) + (try (project-slot-value project 'skeleton)) + *jabs-default-skeleton-name*))) + (skeleton-test-dir (pathname-as-directory (parse-namestring - (or (try (car (get-skelethon-test skelethon))) - (try (get-skelethon-test skelethon)) + (or (try (car (get-skeleton-test skeleton))) + (try (get-skeleton-test skeleton)) "")))) (project-pathname (pathname-as-directory (parse-namestring (or (project-slot-value project 'pathname) ""))))) - ;; (jlog:note "~a" (merge-pathnames skelethon-test-dir project-pathname)) + ;; (jlog:note "~a" (merge-pathnames skeleton-test-dir project-pathname)) (labels ((check-files (string files) (if (null files) nil (let ((scanstring @@ -107,7 +107,7 @@ Else, you should mark, what test engine do you use (get-plugin-name plugin) (get-plugin-type plugin)) t) (os-find (merge-pathnames - (merge-pathnames skelethon-test-dir project-pathname) + (merge-pathnames skeleton-test-dir project-pathname) (os-pwd)) :type :file :extension "lisp"))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -164,7 +164,7 @@ Else, you should mark, what test engine do you use ;; hit@round@bout -> bout -> round@bout -> round@ -> hit@@bout -> hit@round@ -> hit@@ -;; TEST running all files from skelethon test directory by default +;; TEST running all files from skeleton test directory by default ;; "**/Test*.java" - includes all of its subdirectories and all Java filenames that start with "Test". ;; "**/*Test.java" - includes all of its subdirectories and all Java filenames that end with "Test". diff --git a/src/jabs-loader.lisp.input b/src/jabs-loader.lisp.input index 5b5f0b25a5cf97dba44a08e785fd011d0f58ded8..1ab649e4f02aacfcaac801a457f92f8b4a25e911 100644 --- a/src/jabs-loader.lisp.input +++ b/src/jabs-loader.lisp.input @@ -28,7 +28,7 @@ ;;load core plugins (jlog:info "Loading core plugins") -(dolist (v '("jabs-skelethon" +(dolist (v '("jabs-skeleton" "jabs-asdf" "jabs-depmanager" "jabs-hit" diff --git a/src/jabs-plugin.lisp b/src/jabs-plugin.lisp index 07a96faadfa2a1450fd2ee81a38cbe5c35ccd69d..423b09b1f35031fe44f0fd18e998cad4f9d6a8cf 100644 --- a/src/jabs-plugin.lisp +++ b/src/jabs-plugin.lisp @@ -297,7 +297,7 @@ by many projects w/o requirement to set it as plugin in (plugin-type (tosymbol (cadr (split #\@ (princ-to-string plugin)))))) (load-plugin plugin-name plugin-type))))) -;; adding run-project-hook to load and process skelethon +;; adding run-project-hook to load and process skeleton (add-hook *define-project-hook* #'(lambda (x) diff --git a/src/wrappers/jab/jab.lisp.input b/src/wrappers/jab/jab.lisp.input index 8d632962b356927695c1fe44bd4820674554361c..03707020d068af440d8aaa0997132328918d08ce 100644 --- a/src/wrappers/jab/jab.lisp.input +++ b/src/wrappers/jab/jab.lisp.input @@ -81,7 +81,7 @@ --autogen-project Generates simple buildfile (``build.jab'' by default. See -f option) available options: -Dtmpl-version= - -Dtmpl-skelethon= + -Dtmpl-skeleton= --serve Start swank server to work with app interactively -f, --buildfile=FILENAME Use selected buildfile instead of default diff --git a/test/e2e.sh b/test/e2e.sh index 87086b21faea00ea1b0562a5f6bf2f73c6dc8059..d899c34708decad4e7dd6e3a42a262572ea5d8c8 100755 --- a/test/e2e.sh +++ b/test/e2e.sh @@ -11,7 +11,7 @@ cd ${DIR} echo '(in-package :jabs)' > testfile.lisp echo '(format *error-output* "Hello World~%")' >> testfile.lisp -${ROOT}/src/wrappers/jn/jn.sh -Dbouts=tmpl-mkproject -Dplugins=tmpl@generic -Dtmpl-skelethon=flat +${ROOT}/src/wrappers/jn/jn.sh -Dbouts=tmpl-mkproject -Dplugins=tmpl@generic -Dtmpl-skeleton=flat set +e