template loading done

This commit is contained in:
lxsameer 2010-12-27 20:32:03 +03:30
parent 38768c93e7
commit a33c88e9e4
4 changed files with 26 additions and 11 deletions

2
TODO
View File

@ -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
* escape project name for a unix name "shell-quote-argument"

View File

@ -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)
)
)
)

View File

@ -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)

View File

@ -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