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

[WIP] Pushing towards using Pathname consistently. Closes #216 #218

Closed
wants to merge 5 commits into from

Conversation

bartkamphorst
Copy link
Member

@bartkamphorst bartkamphorst commented Aug 15, 2016

Related to #216. Note that while the gollum-lib specs pass, the gollum specs do not. Including these changes therefore requires changing gollum's code as well.

@bartkamphorst bartkamphorst added this to the 5.0 milestone Aug 15, 2016
@dometto
Copy link
Member

dometto commented Aug 15, 2016

Good stuff! Is there an easy way to detect where else this needs to happen?

@bartkamphorst
Copy link
Member Author

Not really, I follow the request chain, and keep an eye out for ::File.dirname calls etc (these accept Pathname objects but return strings). There are many changes still to make, as there are many places where there are checks for '/' or '.' etc.

@dometto
Copy link
Member

dometto commented Mar 28, 2017

Tests are failing on jruby because Page#path now returns a Pathname object. On MRI this is automatically interpreted as a string, but apparently not so on java:

TypeError: cannot convert instance of class org.jruby.ext.pathname.RubyPathname to class java.lang.String

The error is raised when Page#path is handed to the adapter, in two places (so far):

git_layer_rjgit.rb:384:in `diff'
git_layer_rjgit.rb:212:in `log'

Three basic ways of fixing this:

  • Explicitly convert Page#path to a string before handing it to the adapter (at least in Wiki#full_reverse_diff_for and Page#last_version)
  • Explicitly convert to string inside the adapter (in the above mentioned methods)
  • Monkeypatch or subclass Pathname so that it allows conversion to java.lang.String

@bartkamphorst
Copy link
Member Author

Explicitly convert to string inside the adapter (in the above mentioned methods)

This option has my vote. I'd like to use Pathnames throughout the project, and explicitly call .to_s where external methods force us to.

@dometto
Copy link
Member

dometto commented Apr 5, 2017

I resolved the merge conflicts which arose because of #249.

@dometto dometto changed the title [WIP] Pushing towards using Pathname consistently. [WIP] Pushing towards using Pathname consistently. Closes #216 Apr 5, 2017
@dometto dometto closed this Apr 20, 2017
@dometto dometto deleted the use_pathname branch April 20, 2017 18:59
@bartkamphorst
Copy link
Member Author

@dometto Did this end up in gollum-lib-5.x some way or other?

@dometto
Copy link
Member

dometto commented Apr 21, 2017

Argh. No, looks like I accidentally deleted the branch on which this PR was based. I think we can restore it though.

@dometto dometto restored the use_pathname branch April 21, 2017 10:28
@dometto dometto reopened this Apr 21, 2017
@bartkamphorst
Copy link
Member Author

👍

@dometto
Copy link
Member

dometto commented Apr 21, 2017

Restored and also resolved a new merge conflict. You may have to recheck the page.rb file for new code that may be improved by using Pathname though. I see I've used ::File.basename and such here and there when refactoring the Page class.

Sorry for the messup!

@bartkamphorst
Copy link
Member Author

No worries, just glad my work still has a chance of being included in the next big release. ;)

@dometto
Copy link
Member

dometto commented Oct 15, 2018

Just solved another merge conflict. Tests still fail, but that all seems to be due to some mistaken calls to Pathname#include? (mostly in the tests themselves), which should be easy to solve.

Related to #216. Note that while the gollum-lib specs pass, the gollum specs do not. Including these changes therefore requires changing gollum's code as well.

What needs to happen to gollum before this can be merged?

@bartkamphorst
Copy link
Member Author

Just solved another merge conflict. Tests still fail, but that all seems to be due to some mistaken calls to Pathname#include? (mostly in the tests themselves), which should be easy to solve.

Very cool. 👍

What needs to happen to gollum before this can be merged?

I don't remember to be honest. We would just have to hook up this gollum-lib code to gollum and see.

@bartkamphorst bartkamphorst removed this from the 5.0 milestone Oct 3, 2019
@dometto
Copy link
Member

dometto commented Oct 3, 2019

Do we still want to get this into 5.x?

@bartkamphorst
Copy link
Member Author

No, I think we can release without. I'm keeping it open though for future reference.

@dometto dometto closed this Mar 13, 2020
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.

2 participants