tdreyno / middleman-blog-editor-issues

Public bug tracker for middleman-blog-editor gem
http://middleman-blog-editor.awardwinningfjords.com
3 stars 0 forks source link

NoMethodError: undefined method `path_matcher' for #<Middleman::Blog::BlogData #7

Closed wanderingcrow closed 10 years ago

wanderingcrow commented 10 years ago

This might just be my setup, but I'm getting the following error when I have the blog editor enabled in my config file:

NoMethodError: undefined method path_matcher' for #<Middleman::Blog::BlogData:0x007fd3227ed388> /Users/pk/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/middleman-blog-editor-0.4.1/lib/middleman-blog-editor/extension_3_1.rb:52:incall' /Users/pk/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/showexceptions.rb:24:in call' /Users/pk/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/head.rb:11:incall' /Users/pk/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/lint.rb:49:in _call' /Users/pk/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/lint.rb:37:incall' /Users/pk/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:138:in call' /Users/pk/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:inservice' /Users/pk/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in service' /Users/pk/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:inrun' /Users/pk/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

I did some searching, but couldn't see what might be causing this. Any thoughts?

config file: https://gist.github.com/javaporter/7771316

TMaYaD commented 10 years ago

In lib/middleman-blog-editor/extension_3_1.rb replacing

 52         if @mm.blog.path_matcher.match(url.sub(/^\//, ''))

with

 52         matcher = @mm.blog.respond_to?(:path_matcher) ? @mm.blog.path_matcher.match(url.sub(/^\//, '')) : @mm.blog.source_template.extract(url.sub(/^\//, ''))
 53         if matcher

will work.

wanderingcrow commented 10 years ago

That did it, thanks much!

tdreyno commented 10 years ago

Let's keep this open if we're got bad code in the extension.

TMaYaD commented 10 years ago

Yeah, its better to fix it properly than a work around like above. For more information, here is the middle-man blog commit that broke this.

https://github.com/middleman/middleman-blog/commit/7e606bfa76699356c4210fd7881453b8de5895b7

tdreyno commented 10 years ago

Okay, getting an updated version out to fix this today!

nayefc commented 10 years ago

Hello,

I'm still getting this issue (running latest middleman-blog-editor). I do not have a lib directory to make the suggested edit above. I have the blog editor installed as a gem.

Any ideas how I can get this fixed?

tdreyno commented 10 years ago

Do you have the latest version of the gem? v0.4.1? Check your Gemfile and run bundle update to make sure.

tdreyno commented 10 years ago

@nayefc If that doesn't work, let me know, and I'll push out an updated gem.

nayefc commented 10 years ago

I think this may have been the issue (although I'm pretty sure I always had v0.4.1). It works now, thanks!

nayefc commented 10 years ago

Hello,

I am getting the same error again. I haven't touched anything since then so I'm not sure what happened. When I uncomment activate :blog_editor, I get the same error. It happens for all the website for any route. The error I get is:

NoMethodError at /blog
undefined method `path_matcher' for #<Middleman::Blog::BlogData:0x007fe69f13b888>

Ruby    /Users/ncopty/.rvm/gems/ruby-2.0.0-p247/gems/middleman-blog-editor-0.4.1/lib/middleman-blog-editor/extension_3_1.rb: in call, line 52
Web GET localhost/blog

Running bundle install shows the following versions installed:

Using middleman (3.2.2) Using middleman-blog (3.5.1) Using middleman-blog-editor (0.4.1)

Thank you,

tdreyno commented 10 years ago

@nayefc I think this is fixed by v0.5.0 which I haven't pushed out yet. I'll keep you updated.

nayefc commented 10 years ago

Awesome, thanks! I'll be waiting.

nayefc commented 10 years ago

Any updates on this? It's been a while since I was able to use this.

tdreyno commented 10 years ago

@nayefc v0.5.0 is up. Update your Gemfile to use this new version and let me know.

nayefc commented 10 years ago

Works, thanks!