template loading done
This commit is contained in:
parent
38768c93e7
commit
a33c88e9e4
2
TODO
2
TODO
|
@ -2,4 +2,4 @@
|
||||||
* Add some option for user to choose between liceenses
|
* Add some option for user to choose between liceenses
|
||||||
* Review license templates
|
* Review license templates
|
||||||
* build the debian folder nad required files for deb packages
|
* build the debian folder nad required files for deb packages
|
||||||
* escape project name for a unix name
|
* escape project name for a unix name "shell-quote-argument"
|
|
@ -46,12 +46,31 @@
|
||||||
(setq project-author nil)
|
(setq project-author nil)
|
||||||
(setq project-home-page nil)
|
(setq project-home-page nil)
|
||||||
(setq project-author-email nil)
|
(setq project-author-email nil)
|
||||||
|
(setq project-desc nil)
|
||||||
)
|
)
|
||||||
(progn
|
(progn
|
||||||
(setq project-author (read-string "Project Author: "))
|
(setq project-author (read-string "Project Author: "))
|
||||||
(setq project-author-email (read-string "Project Author Email: "))
|
(setq project-author-email (read-string "Project Author Email: "))
|
||||||
(setq project-home-page (read-string "Home Page: "))
|
(setq project-home-page (read-string "Home Page: "))
|
||||||
|
(setq project-desc (read-string "Description: "))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
(defun insert-license ()
|
||||||
|
"Return the prepared license string."
|
||||||
|
(if project-license
|
||||||
|
(let (license-data license-file)
|
||||||
|
(setq license-file (concat TEMPLATESPATH (concat "licenses/" (concat project-license ".tmpl"))))
|
||||||
|
(setq license-data (io/read license-file))
|
||||||
|
(setq license-data (replace-regexp-in-string "::project::" project-name license-data))
|
||||||
|
(setq license-data (replace-regexp-in-string "::desc::" project-desc license-data))
|
||||||
|
(setq license-data (replace-regexp-in-string "::author::" project-author license-data))
|
||||||
|
(setq license-data (replace-regexp-in-string "::email::" project-author-email license-data))
|
||||||
|
(setq license-data (replace-regexp-in-string "::year::" (format-time-string "%Y") license-data))
|
||||||
|
(identity license-data)
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
|
@ -48,14 +48,10 @@
|
||||||
(defun generic-c () "Create a generic type C project"
|
(defun generic-c () "Create a generic type C project"
|
||||||
(interactive)
|
(interactive)
|
||||||
(c-new-project)
|
(c-new-project)
|
||||||
(setq current-template-file (concat TEMPLATESPATH "c/generic_c/main.c.tmpl"))
|
(let (current-template-file license-data)
|
||||||
|
(setq current-template-file (concat TEMPLATESPATH "c/generic_c/main.c.tmpl"))
|
||||||
(if project-license
|
(setq license-data (insert-license))
|
||||||
(let (license-data license-file)
|
(log license-data)
|
||||||
(setq license-file (concat TEMPLATESPATH (concat "licenses/" (concat project-license ".tmpl"))))
|
|
||||||
(setq license-data (io/read license-file))
|
|
||||||
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(init-menus)
|
(init-menus)
|
|
@ -1,5 +1,5 @@
|
||||||
$$PROJECT$$ - $$DESC$$
|
::project:: - ::desc::
|
||||||
Copyright (C) $$YEAR$$ $$AUTHOR$$
|
Copyright (C) ::year:: ::author:: <::email::>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
Loading…
Reference in New Issue