diff --git a/TODO b/TODO index 1d2da79..9699b39 100644 --- a/TODO +++ b/TODO @@ -2,4 +2,4 @@ * Add some option for user to choose between liceenses * Review license templates * build the debian folder nad required files for deb packages -* escape project name for a unix name \ No newline at end of file +* escape project name for a unix name "shell-quote-argument" \ No newline at end of file diff --git a/src/lib/project.el b/src/lib/project.el index e507957..efd6ce0 100644 --- a/src/lib/project.el +++ b/src/lib/project.el @@ -46,12 +46,31 @@ (setq project-author nil) (setq project-home-page nil) (setq project-author-email nil) + (setq project-desc nil) ) (progn (setq project-author (read-string "Project Author: ")) (setq project-author-email (read-string "Project Author Email: ")) (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) + ) + ) ) \ No newline at end of file diff --git a/src/plugins/cproject.el b/src/plugins/cproject.el index 79cbf74..0e534f1 100644 --- a/src/plugins/cproject.el +++ b/src/plugins/cproject.el @@ -48,14 +48,10 @@ (defun generic-c () "Create a generic type C project" (interactive) (c-new-project) - (setq current-template-file (concat TEMPLATESPATH "c/generic_c/main.c.tmpl")) - - (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)) - - ) + (let (current-template-file license-data) + (setq current-template-file (concat TEMPLATESPATH "c/generic_c/main.c.tmpl")) + (setq license-data (insert-license)) + (log license-data) ) ) (init-menus) \ No newline at end of file diff --git a/src/templates/licenses/gpl.tmpl b/src/templates/licenses/gpl.tmpl index 9f04328..c3e5868 100644 --- a/src/templates/licenses/gpl.tmpl +++ b/src/templates/licenses/gpl.tmpl @@ -1,5 +1,5 @@ - $$PROJECT$$ - $$DESC$$ - Copyright (C) $$YEAR$$ $$AUTHOR$$ + ::project:: - ::desc:: + Copyright (C) ::year:: ::author:: <::email::> 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