Skip to content
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

Move Dir.mkdir_p to FileUtils.mkdir_p #6092

Closed
wants to merge 1 commit into from
Closed

Conversation

j8r
Copy link
Contributor

@j8r j8r commented May 12, 2018

Dir.mkdir_p is also moved to FileUtils.mkdir_p

@j8r j8r force-pushed the dir-rename branch 3 times, most recently from 7dc3f24 to 4bd2ea9 Compare May 13, 2018 00:23
@wooster0
Copy link
Contributor

wooster0 commented May 13, 2018

What about remove instead of delete? I think that would fit better. rmdir means remove directory and there are also still some comments and specs left that say something like:

# Removes the directory at the given path.

or

  it "tests delete with a path that cannot be removed" do

there "Removes" should be better "Deletes" and "removed" should be "deleted" I think.

Or just change delete to remove.

@j8r
Copy link
Contributor Author

j8r commented May 13, 2018

I will change everything to delete because under the ground Crystal::System::Dir.delete is callled and there is also File.delete.
The word delete better fit in this case than remove because the directory isn't recoverable after deletion (https://english.stackexchange.com/questions/52508/difference-between-delete-and-remove/52509#52509)

@RX14
Copy link
Contributor

RX14 commented May 13, 2018

We should be moving everything to Path soon anyway so might as well save all the refactors for that?

@j8r
Copy link
Contributor Author

j8r commented May 13, 2018

@RX14 As far I've seen in #5635 , the PR is mostly about adding the Path. I haven't seen modifications about FileUtils(yet?) - how it will be incorporated?. I have thought it was preferable to do this such small changes in a separate PR.

@straight-shoota
Copy link
Member

Adding Path type is one thing. Restructuring the APIs of File, Dir and FileUtils is another issue. This should be discussed on a higher level, with everything in sight. Not a PR about single methods.

@j8r
Copy link
Contributor Author

j8r commented May 14, 2018

For me mkdir and rmdir looks weird on Dir (and Path?), but everyone has its own tastes.
I was just looking at improving this on the actual API, for now.

@RX14
Copy link
Contributor

RX14 commented May 14, 2018

I agree with you, and I actually like this change. What i'm suggesting is to break everyone's path handing at once in one release not break it a little bit few releases in a row. If we're going to make a massive breaking change on the horizon anyway we might as well bundle this up with that.

Now just make sure we don't forget this when the time comes :)

@j8r
Copy link
Contributor Author

j8r commented May 14, 2018

Finally I quite agree with you. Ok to keep rmdir and mkdir at the moment.
What about only merging Dir.mkdir_p to FileUtils.mkdir_p? It maybe be a breaking change, sure, not that big because it only removes an alias.

@j8r j8r force-pushed the dir-rename branch 2 times, most recently from 8f75d0a to 5f76eb3 Compare May 16, 2018 20:41
@j8r j8r changed the title Rename Dir.rm/mkdir to delete/create Move Dir.mkdir_p to FileUtils.mkdir_p May 16, 2018
@j8r
Copy link
Contributor Author

j8r commented May 28, 2018

@RX14 Are you OK with this change - WDYT?

@straight-shoota
Copy link
Member

It doesn't make any sense to separate mkdir and mkdir_p in different namespaces. They're actually the same thing, just with slightly different behaviour. The CLI tool has -p as a parameter, they're not two different tools.

Subsequently, I'd leave mkdir_p in Dir. Yes, maybe even name it mkdir and make parents mode default. This is typically much more commonly used than mkdir without parents. The latter could be achieved with Dir.mkdir("foo", parents: false).

@j8r
Copy link
Contributor Author

j8r commented Jul 12, 2018

Agree @straight-shoota , it would be even greater to have a recursive argument (or something else) in common for commands like mkdir, rm, cp

@j8r j8r closed this Jul 24, 2018
@j8r j8r deleted the dir-rename branch October 16, 2018 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants