Open vinc opened 6 years ago
Thank you for this and the other issues you opened; I'll be happy to look at them over the next few days.
However, one thing that you should know...I won't merge code if it doesn't have tests, so it's in your interest to get the test suite running in your development environment. What happened when you tried?
No worries, I'm with you on not merging without tests! How do you run the test suite though?
rpec
isn't in the gemspec
, and when I add it, well, all tests fail when I run bundle exec rspec
.
I just checked Travis, you run bundle exec rake test
, okay!
Yeah, it's Minitest::Spec on this project, not RSpec.
That was an experiment, really; if it gets too unwieldy, feel free to switch it to RSpec.
Also, Guard is all set up for this project, so you can just have it running in the background instead of running tests manually.
Okay I fixed the existing tests by adding a method url
to the object page
and fixing the method path
to return the actual path (without the first "/" like middleman does) instead of a URL.
I'll come back to this PR soon to add some real tests of the problem and its resolution.
I'm not sure I understand what problem this PR is solving. Can you give me a concrete example of the "bad" behavior?
Other than:
If I have two pages,
/sources/foo/index.html.erb
and/sources/foo/bar.html.erb
and I visit/foo/bar/
in my browser (with pretty URLs) I expect to find links to/foo/
and/foo/bar/
in the breadcrumb. But that not the case, instead it's the usual/foo/index.html
and/foo/bar.html
.
The "bad" behavior is this gem doesn't seem to work with pretty URLs, my fork does.
Could be something wrong with my config, especially now that this PR is one year old.
Sorry, I think I was reading too fast and overlooked some of your problem description. Let me take a less hurried look and see what I can figure out.
Hello, did you have a chance to get a look at this PR to make breadcrumbs and directory indexes work together?
I don't see any other users encountering this case in the issues of this repo since the creation of this PR though, so it doesn't look very important at all and I've been using my fork in the meantime.
Let me refresh my memory on this and see what I can do.
...but in the meantime, would you please respond to my review comments?
FWIW, there are other people who would like for this to work. :+1:
@aw-was-here Fantastic. Can you help by writing tests so this code can get merged?
If I knew more ruby, I'd totally help out. Sorry! [As someone else involved with open source, I get how frustrating that is.]
@aw-was-here Out of curiosity, if you don't know Ruby well, how are you using Middleman at all, and why would this feature be useful to you in the first place?
@vinc Can we get this to a state where I can merge it?
(Travis failures seem to be related to #20, not any code here.)
To be honest after reading again the PR I'm not happy with using URI(page.url).path
instead of page.path
to get the pretty printed path, it feels like a hack. A better fix should perhaps be in middleman itself? I'll try to have a look at that.
Here's a problem I found: when you add
activate :directory_indexes
toconfig.rb
, the links in the breadcrumb stay the same.If I have two pages,
/sources/foo/index.html.erb
and/sources/foo/bar.html.erb
and I visit/foo/bar/
in my browser (with pretty URLs) I expect to find links to/foo/
and/foo/bar/
in the breadcrumb. But that not the case, instead it's the usual/foo/index.html
and/foo/bar.html
.Here is how to reproduce the problem on a fresh install:
With this PR we get the expected links.
But there's just one catch that I found so far, without pretty URLs activated you still get
/foo/
instead of/foo/index.html
. Though that isn't a problem for me.P.S. I'd like to be able to run the test suite with
bundle exec rspec
to see if I break something and add a test for my PR but couldn't get it working. Sorry about that.