forked from FG42/FG42
Project DSL related files moved to their own namespace
This commit is contained in:
parent
5f82e9340c
commit
274b064225
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
(ability project-config ()
|
(ability project-config ()
|
||||||
"Makes projects configurable."
|
"Makes projects configurable."
|
||||||
(require 'extensions/development/project-configuration))
|
(require 'projects/configuration))
|
||||||
|
|
||||||
(ability bookmarks ()
|
(ability bookmarks ()
|
||||||
(require 'bm)
|
(require 'bm)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
;;; project-configurations --- A small library to load project specific configurations.
|
;;; configurations --- A small library to load project specific configurations.
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'seq)
|
(require 'seq)
|
||||||
|
@ -6,6 +6,9 @@
|
||||||
(defvar project-config-dir "~/.fg42/project-config/"
|
(defvar project-config-dir "~/.fg42/project-config/"
|
||||||
"This variable contains the path to the projects global configurations.")
|
"This variable contains the path to the projects global configurations.")
|
||||||
|
|
||||||
|
(defvar __project-name__ nil
|
||||||
|
"It's an internal variable to holds the current project name.")
|
||||||
|
|
||||||
(defun project-name (project)
|
(defun project-name (project)
|
||||||
"Return the project name of the given PROJECT."
|
"Return the project name of the given PROJECT."
|
||||||
(car (last (seq-filter
|
(car (last (seq-filter
|
||||||
|
@ -32,7 +35,7 @@
|
||||||
|
|
||||||
(defun load-config-file (project-name config)
|
(defun load-config-file (project-name config)
|
||||||
"Load the given CONFIG file with the given PROJECT-NAME."
|
"Load the given CONFIG file with the given PROJECT-NAME."
|
||||||
(require 'extensions/development/project-dsl)
|
(require 'projects/dsl)
|
||||||
(setq __project-name__ project-name)
|
(setq __project-name__ project-name)
|
||||||
(load config))
|
(load config))
|
||||||
|
|
||||||
|
@ -47,5 +50,5 @@
|
||||||
(message "No configuration has been found for current project."))))
|
(message "No configuration has been found for current project."))))
|
||||||
|
|
||||||
|
|
||||||
(provide 'extensions/development/project-configuration)
|
(provide 'projects/configuration)
|
||||||
;;; project-configuration.el ends here
|
;;; configuration.el ends here
|
|
@ -1,23 +1,24 @@
|
||||||
;;; project-dsl --- A dsl to be used with project configurations.
|
;;; dsl --- A dsl to be used with project configurations.
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(defvar open-project-configurations (make-hash-table :test 'equal)
|
(defvar open-project-configurations (make-hash-table :test 'equal)
|
||||||
"This hashmap is responsible for storing project configurations.")
|
"This hashmap is responsible for storing project configurations.")
|
||||||
|
|
||||||
(defmacro on-run (body)
|
;; DSL -----------------------------------------------------
|
||||||
"It's going to run the given BODY when user wanted to run the project."
|
(defmacro deftask (name body)
|
||||||
|
"Create a new task for the project with the given NAME and BODY."
|
||||||
`(let ((pmap (gethash __project-name__
|
`(let ((pmap (gethash __project-name__
|
||||||
open-project-configurations
|
open-project-configurations
|
||||||
(make-hash-table :test 'equal))))
|
(make-hash-table :test 'equal))))
|
||||||
|
|
||||||
(puthash :run (lambda (buffer) ,body) pmap)
|
(puthash ,(symbol-name name) (lambda (buffer) ,body) pmap)
|
||||||
(puthash __project-name__ pmap open-project-configurations)))
|
(puthash __project-name__ pmap open-project-configurations)))
|
||||||
|
|
||||||
(defmacro run-shell-command (command)
|
(defmacro run-shell-command (command)
|
||||||
"Run the given shell COMMAND on the run buffer."
|
"Run the given shell COMMAND on the run buffer."
|
||||||
`(async-shell-command ,command buffer))
|
`(async-shell-command ,command buffer))
|
||||||
|
|
||||||
;; TASK RUNNERS ---------------------------------------
|
;; TASK RUNNERS --------------------------------------------
|
||||||
(defun with-buffer (name action)
|
(defun with-buffer (name action)
|
||||||
"Create a buffer with the given NAME for the given ACTION."
|
"Create a buffer with the given NAME for the given ACTION."
|
||||||
(get-buffer-create (format "*%s %s*" name action)))
|
(get-buffer-create (format "*%s %s*" name action)))
|
||||||
|
@ -39,7 +40,7 @@
|
||||||
"Execute the :run task for the current project."
|
"Execute the :run task for the current project."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((project (cdr (project-current))))
|
(let ((project (cdr (project-current))))
|
||||||
(execute-task project :run)))
|
(execute-task project "run")))
|
||||||
|
|
||||||
(provide 'extensions/development/project-dsl)
|
(provide 'projects/dsl)
|
||||||
;;; project-dsl ends here
|
;;; dsl ends here
|
Loading…
Reference in New Issue