zen0wu / topcoder-greed

greedy editor for topcoder arena
Apache License 2.0
229 stars 48 forks source link

Better control of created directory structure #99

Closed iofik closed 10 years ago

iofik commented 10 years ago

I want Greed to generate files in directory {Workspace}/499/ instead of {Workspace}/SRM 499/

I looked through documentation and code and could not find a way to do it. I think some special named renderer might help here. Like 'substring' or 'word'.

vexorian commented 10 years ago

Adding something to string() renderer or making a whole new renderer would be needed.

There are contests who are not SRMs, what do you expect it to do in that case?

@shivawu: What if we allow people to create their own named renderers and add them to greed through config?

vexorian commented 10 years ago

Maybe I can add a special parameter to ContestCategory to customize the "SRM " prefix.

iofik commented 10 years ago

Another option is to add two more fields to Contest: ${Contest.Type} and ${Contest.Number} -- or something like this. This will allow me to create directory structure I want. Also such structure can be used: ./SRM/499

wookayin commented 10 years ago

Yeah, I think we can add some useful fields that can be used in our template system, as you've mentioned above. But anyway, what do you expect for non-SRM rounds (e.g. Topcoder Open 2013 Round 1)?

iofik commented 10 years ago

Just rename them manually after contest is finished. =) TCO do not occur too often. I know, my naming scheme is flawed, but I kind of got used to it.

vexorian commented 10 years ago

In PR #100 I added a way to do this: codeRoot = "${Contest;category(srm=1,no-space,srm-text=) }"

It will make SRM 456 render as 456. The remaining contest names will render as TCO, TCHS or Other. But you can change them too.

wookayin commented 10 years ago

New customization #100 is good itself, but seems too hacky for this purpose :-)

vexorian commented 10 years ago

Still thinking allowing custom renderers is a good idea because people will always have very specific needs.

zen0wu commented 10 years ago

100 is indeed something. But I agree that this should be merged into the Contest class so that

the Contest object can provide more information. I'll just merge it for now.

@iofik Does this solve your problem?

iofik commented 10 years ago

Guys, thanks for all your quick responses and help!

@shivawu Yes.