some error handling in project library
This commit is contained in:
parent
8d95c57a5f
commit
8b12e2f335
4
TODO
4
TODO
|
@ -3,4 +3,6 @@
|
|||
* Review license templates
|
||||
* Build the debian folder nad required files for deb packages
|
||||
* Escape project name for a unix name "shell-quote-argument"
|
||||
* Add a config file for user to put his/her configuration there
|
||||
* Add a config file for user to put his/her configuration there
|
||||
* Allow templates file to store in subdirectories so new project can
|
||||
have subdirectories
|
|
@ -28,10 +28,12 @@
|
|||
|
||||
;; Project name
|
||||
(setq project-name (read-string "Project Name: "))
|
||||
(if (string= project-name "") (error "Project name must not be emty"))
|
||||
;; Shit IDE use unix-project-name for dealing with project OS activity stuffs
|
||||
(setq unix-project-name (downcase (replace-regexp-in-string " " "_" project-name)))
|
||||
;; if specified directory does not exists, shit will make it
|
||||
(setq project-path (read-directory-name "Project Path: " nil nil nil unix-project-name))
|
||||
(log project-path)
|
||||
(if (not (file-exists-p project-path))
|
||||
(progn
|
||||
(mkdir project-path)
|
||||
|
@ -103,4 +105,19 @@
|
|||
(setq data (replace-regexp-in-string "::license::" license-data data))
|
||||
)
|
||||
)
|
||||
|
||||
(defun project/write-dest-file (FILE DATA)
|
||||
"Write the rendered DATA to its destenation file in project source tree.
|
||||
destenation file address created from template FILE name.
|
||||
FILE : (string) Address of corresponding template
|
||||
DATA : (string) Rendered data"
|
||||
|
||||
(let (curfile destfile)
|
||||
(setq curfile (split-string FILE "/"))
|
||||
(nbutlast curfile)
|
||||
(setq curfile (replace-regexp-in-string "__project__" unix-project-name curfile))
|
||||
(setq curfile (replace-regexp-in-string "\.tmpl" "" curfile))
|
||||
(setq destfile (concat project-path curfile))
|
||||
)
|
||||
)
|
||||
|
Loading…
Reference in New Issue