bit101 / ProjectMaker

A Sublime Text 2/3 plugin to allow creating any kind of project from your own custom templates
MIT License
233 stars 36 forks source link

Token replacement in Filename when format is like en_project_name_.ext #27

Closed hanneshal closed 9 years ago

hanneshal commented 11 years ago

Hey there,

is it possible to replace _projectname when the file name in a project template is like: en_project_name.extension so it would become enMyCoolProject.extenstion ?

System MAC OSX 10.8.5 + ST2 Right now the token is not being replaced. Bug or Feature ?

Regards Hannes

P.S.: Thx for your work! :+1:

hanneshal commented 10 years ago

Any tips ?

ghost commented 10 years ago

+1 for this.

puppet-rspec names the files in the following style:

module_class_spec.rb

This would turn to:

_project_name__class_spec.rb

which is not working.

bit101 commented 10 years ago

Well, the way it works now is that the entire file name (minus the extension) needs to begin and end with an underscore. Anything between the underscore is read as a token. i.e. _anytoken.txt. So if you had a token named any_token with a value of "stuff" that file would become stuff.txt. projectname is just another built-in token. If the file name doesn't begin with and end with _, it's ignored. And if it does match, the entire file name is replaced. There's no facility for partial file name replacing at this point.

I'd have to look into how feasible this is. It would take quite a bit of rework, as first all the file names are checked to see if they contain the token pattern and put into a list of tokenized file names, which are later checked against existing tokens. What you are asking for would mean that that initial parsing would need to take into account any file name that had multiple underscores. And the replacement would need to be more intelligent.

I'll look into it though.

hanneshal commented 9 years ago

I'll close this one. its rather old and I'm using yeoman for such stuff right now. thx