zen0wu / topcoder-greed

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

Some templates don't really need backups #89

Closed vexorian closed 10 years ago

vexorian commented 10 years ago

Source code and samples are usually modified by user, so if new file is generated it is worth keeping a backup.

But HTML is unlikely to be modified by user. Maybe have a template option to disable backups?

            problem-desc {
                override = false
                backup = false
                outputFile = "${Problem.Name}.html"
                templateFile = "builtin problem/desc.html.tmpl"
            }

The issue with this would be that it would be best if it was considered "true" by default.

zen0wu commented 10 years ago

Actually, I thought the override = false is enough for the user to use. But there may be situations where the user click regenerate code or switch problem-desc template for example. A better way is to have a enumeration-like type for the override option, instead of just a boolean.

vexorian commented 10 years ago

Does override = true stop backups from appearing?

zen0wu commented 10 years ago

No. When override = true, it will be backed up and then overwritten. override = false means no overwritten and no backup, as long as the file exists.

zen0wu commented 10 years ago

Plan to add enumeration support for the parser and change the override option to a 3-value enum type (force, backup, skip)

vexorian commented 10 years ago

force = always override, no backup backup = always override with backup skip = don't override automatically, if regenerate code button is used, use backup.

Right?

zen0wu commented 10 years ago

Exactly!

I will update the wiki later.

vexorian commented 10 years ago

It is ironic that it was precisely in yesterday's match that I learned a good use case for keeping backup of problem statement. It allows you to have a record of old version of problem statement in case the admins change it.

Although, as long as you don't close your browser window, it works too.

zen0wu commented 10 years ago

Really... I didn't participate yesterday's SRM, but I believe that rarely happens :-)