Left Right | 21 Jun 2012 14:17
Picon

Is SRecode the right tool for project templates?

Hello list.

I'm searching for a template system, and would be grateful if you to told me if SRecode is a proper tool to use for it, and if yes, then I'd greatly appreciate some guidance.

Here's what I'm looking for:
A "project template" needs to generate a set of directories and some files in the directories, this would be an example:

project-name
- src
|- com
|-- domain
|--- program
|---- Main.hx
- lib
- bin
|- scripts
|-- swfobject.js
|- images
|- index.html
- project.el

Some files, like index.html and Main.hx may contain variable content, where generation of the content depends on user's input. Some other files, like swfobject.js may be copied without change.
Templates to help inside the code (like class generators or function generators are cool, but not super important).

project.el has the most requirements for generation, it has to be aware of the environment where it is generated in (know the directory it is in, have access to environment variables), once created it will be used by a major mode to switch between projects.

Please, if I didn't explain it well enough, do ask.

I've red the documentation on SRecode, but I don't have a clear understanding what it does. It could really benefit from more examples involving use-case scenarios... I found couple of examples in CEDET sources, but I'm still not confident, and that's why I'm asking.

Now, if SRecode doesn't do exactly what I'm asking, but some eLisp code can automate it to the level that it does - I'm cool with it. But if I misunderstood its purpose, but you happen to know about a tool that better matches what I'm after - please do tell!

Thanks!

Oleg
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Cedet-devel mailing list
Cedet-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cedet-devel
Eric M. Ludlam | 22 Jun 2012 05:54
Picon
Gravatar

Re: Is SRecode the right tool for project templates?

Hi,

SRecode is all about providing a way for an Emacs programmer to generate 
code files programatically, and allowing users to easily updates some of 
the macros that contributed to the generated code files.

As such, I think your proposed application is what SRecode is designed for.

SRecode does not have templates for directory structures.  Just for text 
that would get inserted into a file.

SRecode pre-populates a set of dictionary values with data from the 
environment, such as the user name, current directory, and language 
specific features, such as a macro-name safe version of a file name for 
C headers.

SRecode allows you to create template files tagged with your application 
name, so your templates don't get confused with system or user 
templates.  This allows your application to use system templates, and in 
your app template override a subset of the code generating templates.

This all pre-supposed your are writing an Emacs Lisp program, and 
SRecode as a library you would use to do some of the work.  By itself, 
SRecode has a very limited interface restricted to simple insertion of 
templates.

Eric

On 06/21/2012 08:17 AM, Left Right wrote:
> Hello list.
>
> I'm searching for a template system, and would be grateful if you to
> told me if SRecode is a proper tool to use for it, and if yes, then I'd
> greatly appreciate some guidance.
>
> Here's what I'm looking for:
> A "project template" needs to generate a set of directories and some
> files in the directories, this would be an example:
>
> project-name
> - src
> |- com
> |-- domain
> |--- program
> |---- Main.hx
> - lib
> - bin
> |- scripts
> |-- swfobject.js
> |- images
> |- index.html
> - project.el
>
> Some files, like index.html and Main.hx may contain variable content,
> where generation of the content depends on user's input. Some other
> files, like swfobject.js may be copied without change.
> Templates to help inside the code (like class generators or function
> generators are cool, but not super important).
>
> project.el has the most requirements for generation, it has to be aware
> of the environment where it is generated in (know the directory it is
> in, have access to environment variables), once created it will be used
> by a major mode to switch between projects.
>
> Please, if I didn't explain it well enough, do ask.
>
> I've red the documentation on SRecode, but I don't have a clear
> understanding what it does. It could really benefit from more examples
> involving use-case scenarios... I found couple of examples in CEDET
> sources, but I'm still not confident, and that's why I'm asking.
>
> Now, if SRecode doesn't do exactly what I'm asking, but some eLisp code
> can automate it to the level that it does - I'm cool with it. But if I
> misunderstood its purpose, but you happen to know about a tool that
> better matches what I'm after - please do tell!
>
> Thanks!
>
> Oleg
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
>
> _______________________________________________
> Cedet-devel mailing list
> Cedet-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cedet-devel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Gmane