-
Notifications
You must be signed in to change notification settings - Fork 173
No error checking in haml:erb2haml
task
#193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same here: no .haml file was created and after deleting the original files all views are gone (i done this on a new test project, a real project would be destroyed by that function!) |
Honestly I forgot about this. I'll look into it and make a PR sometime this week |
@dirschn Thanks, sounds good! How about the idea moving all original files into a backup-folder (e.g. «view_backups_20250430»)? Then you may not need to ask if theese files should be destroyed. I will write a version for that for my gem (svelte-on-rails). for that i copied out your rake task (erb2haml) and will add this improvements. I will leave you a copy of that when it ist tested, i think this week. |
@chmich Quick disclaimer, I'm not a maintainer here or anything, just a random schmuck who noticed an issue and wanted to fix it. That said, I thought about your suggestion and I keep coming back to thinking it's unnecessary. That kind of thing can be solved by either using version control or choosing not to delete and backing them up yourself. Again, I'm not a maintainer and if one of those fine folks likes the idea I'd be happy to implement it here! |
@dirschn I agree with you that a backup folder is unnecessary because of VCS. But for thinking of a 100% safe process I prefer a way that is independent and safe. And on the other hand, if all views are backed up in one folder, it is one click to delete that folder. So I decided to go this way. So, my task is to find on svelte_on_rails:install_haml_vite, and there the part Install::Haml |
@chmich Yeah I can definitely appreciate that line of thinking, for sure. I'll hold off until the maintainers render a decision, but I'd be happy to port that over here as well if they think it's worth the effort! |
And, as i saw, you wrote for a better error control of the converting process. On my script i wrapped the execution of |
Oh, very cool! I haven't heard of that. My intention here was to make as small of a change as possible to what's existing, but maybe I'll make a follow-up PR with a clean up of the whole task! |
Thank you, @dirschn! But the better place for this task might be the And for the safety of the whole process: Like you, I did my test on an empty rails project. But on an existing project with many views, restoring them all from VCS can be a lot of work! You could leave a hint like Do not forget to commit before running this task ... but you know ... we are all human ... mistakes happen :) |
@chmich That's a good point, personally I hate writing HTML and HAML is the first thing I do in a Rails project, but I forget that some folks could switch an established project. I think I'll restructure my PR a little now, and incorporate some of what you've suggested here. Thanks for the suggestions!
Do you mean |
@dirschn Same here. The reason I wrote this is to test cases for my new gem, and to be able to quickly test new rails apps when new versions come out. And like you, I do everything in haml. Converting existing apps is a case I do not have or rarely have. |
I think i know what the error was on my case: On the original script there is a line where |
Yup, this is the same issue I had. My solution here solves it as well, but I'm certainly interested in making it more robust. I'll take a second crack at it in the next day or two |
I noticed this on html2haml |
I have now removed my code block on my answer above and replaced it with the link to the repository. I think this is now the correct installer to copy and paste into this gem or for a PR. I highly recommend this to the maintainers of this project, as the current task is super dangerous! That one gem adds and removes another gem is a unusual aproach! But this is the purpose: The In my case, this is a really heavy installer, where haml is just one part of more. But I wanted to have a good developer acceptance of these many necessary installation steps, so I invested a lot of time in making a safe running process. But the Haml part (link above) should serve exactly the same purpose as it is needed here. So, my need now is solved, but, as a Haml fan, like @dirschn, i would be happy to see these features here on You can easily test my task: Just follow the Steps Install from cero. By that you get much more than just haml, but haml too and see how it works. |
@chmich Thanks for all that! I'll take a look at it, if I have any notes or questions do you have any preference how I get them to you? I can open an issue in your repo to keep this one a little cleaner |
Yes, please, @dirschn if you have questions or issues or ideas please leave it on my repo and we can develop there. The haml task (intalling both gems and execute the conversion) is within a separated module. |
I ran the
haml:erb2haml
task after runninggem install html2haml
, and apparentlyhtml2haml
didn't install properly. The task reported that it couldn't find it for each file, yet at the end it acted as though the task completed successfully and asked whether I wanted to delete the original files. I said yes, because this was an unimportant brand new project, and after the task was done all of my views were erased because none of the ones it said were generated actually were generated.It seems like there could be some checking in the script to at least verify the expected files exist before reporting a success? I'd be happy to take a crack at it, but I'm a little surprised no one else has reported this yet.
The text was updated successfully, but these errors were encountered: