-
Notifications
You must be signed in to change notification settings - Fork 101
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
Updated new job composer project validation - Single Project Model #2990
Updated new job composer project validation - Single Project Model #2990
Conversation
I need to improve the tests if this approach goes in the right direction. |
apps/dashboard/app/models/project.rb
Outdated
if directory.to_s.include?(Project.dataroot.to_s) | ||
FileUtils.remove_dir(project_dataroot, force = true) | ||
else | ||
FileUtils.remove_dir(configuration_directory, force = true) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we just want FileUtils.remove_dir(configuration_directory, true)
and not what's in the if
block right? I think deleting the entire directory would be an extra checkbox or similar as it may hold code, data and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to only delete the configuration_directory
to avoid deleting scripts and outputs.
I kept the delete the project_dataroot
as it was part of the original code.
An issue with no deleting project_dataroot
is that ids are re-used so the same dir could be reused when deleting and creating projects. Which is not a good edge case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An issue with no deleting project_dataroot is that ids are re-used so the same dir could be reused when deleting and creating projects. Which is not a good edge case.
Yea IDs need to change, I just hadn't filed the ticket yet - #2991
I like this better than before - reviewing it I can see we're all over the place in terms of who knows what (controller now needing to I'm going to hack around and see if there's something simpler because there just has to be. |
Yea the more I look at this the less I like what we're doing. Can I ask that you pick something else up and let me take care of this? Looking through git blame - we did not take great care around the directory and now there's a lot of cruft surrounding it (like |
OK - will look for something else in the backlog |
Sorry for the back and forth - I just needed to do this myself to see what's what. You can continue on this pull request if you like. Here are my comments after doing this myself from scratch (from master)
Here's the diff I was hacking around on. It has a few more updates than are strictly required but we're sort of doing different things in different spots that we need to clean up. |
I had a look at your approach and made some changes locally for validation. Not quite sure how to fix this issue. |
Yea I noticed that too. I think we can set |
I have made some changes based on your patch. |
apps/dashboard/app/models/project.rb
Outdated
else | ||
FileUtils.remove_dir(configuration_directory, force = true) | ||
end | ||
FileUtils.remove_dir(configuration_directory, force = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
I use RubyMine. Will check if this plugin, or similar, is available
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea really it's just a rubocop rule, solargraph is just the language server. Looks like jetbrains has support for it.
There's a .rubocop.yml
at the top level of this project with a rake task to copy it to a more local directory (if you're like me and just open the apps/dashboard
directory instead of the entire project).
@johrstrom if the general approach for the PR is going in the right direction, I can continue working on the tests. I haven't fix them as I wasn't sure you were ok with the solution. |
Sorry I didn't realize you were held up by me. Yes I think this is the right approach. |
37a5df7
to
f4ac483
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me, thanks!
Fixes #2976
Updated project validation now that project directory can be configured by the user.
Draft PR to showcase approach for new project validation using create and update flows