[ALOY-1244] Alloy: "alloy new" should remove/empty "Resources" folder
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | None |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | Alloy 1.5.1 |
| Fix Version/s | n/a |
| Components | Tooling |
| Labels | n/a |
| Reporter | Fokke Zandbergen |
| Assignee | Tim Poulsen |
| Created | 2015-02-14T13:57:46.000+0000 |
| Updated | 2015-07-31T21:09:44.000+0000 |
Description
When you convert a classic project in an Alloy project, the classic
Resources/app.js file will remain untouched because Alloy works with Resources/\[platform\]/app.js.
While this isn't a problem, it is really confusing for new users, wondering if that code will be executed.
Solution
It would be better if runningalloy new would delete or empty the Resources folder.
As per [~sfeather]'s suggestion this might be improved upon by letting the user confirm he's aware Resources folder will be deleted and/or renaming it to e.g. Resources (classic) so it is preserved. This would also improve the current situation where the first time the user runs alloy compile or ti build he will lose his classic files as well.
To reproduce
Execute the following in a temporary directory:
ti create -t app -p ios -n res --id test.res -d . -u http://appcelerator.com
cd res
alloy new
ti build -p ios -b
cd Resources
nano app.js
You'll see that even after alloy compiles Resources/app.js is still the default classic app.js.
alloy newshould NOT be destructive. If a user is converting a classic to alloy, their old project would be IN Resources, and they may have forgotten to move the contents themselves, and now Alloy has eaten it. This is a bad idea.Although
alloy newcurrently is NOT destructive, the next time you runti buildtheResourcesfolder IS destructed, apart from theapp.jsfile. So I don't see much difference. The UX could even improve ifalloy newwould prompt the user to confirmResourcesto be destructed."So I don't see much difference." 1. Your ticket is not for
ti buildit is foralloy new. 2. The behavior ofti buildis a different stage of development, namely building, not converting. 3. A user converting a project from classic to alloy doesn't have a place to put their old files in the new structure untilalloy newhas been run. If you are looking for a consumer/user friendly solution, take the contents of the classic Resources, move/rename/place them in Resources.classic or Resources.old to protect/preserve them, create the alloy structure as before and if purging Resources is so important to you, do it.By not much different I mean: * Current: you lose the classic files (except for
app.js) as soon as you doti buildoralloy compileafteralloy new* Proposed: you lose the classic files as soon as you doalloy newI agree that if you're unaware that Alloy soon or later will cleanResources, both the current and proposed situation might surprise users and cause them to lose their classic files (if they're not using versioning or backups). So I've updated the ticket to ask for the user to confirm or for the currentResourcesdirectory to be renamed. Thanks for that suggestion Stephen!