manastech / middleman-search

LunrJS-based search for Middleman
MIT License
58 stars 31 forks source link

Error when creating index in middleman 4 #8

Closed drallgood closed 8 years ago

drallgood commented 8 years ago

Hey. I just discovered this issue in middleman 4. Not sure how to solve it, or I would have send a PR. I think it doesn't like the provided block at all.

Error processing resource for index: gettingstarted/installationGuide.html
Contract violation for argument 2 of 2:
        Expected: Hash,
        Actual: #<Proc:0x007fa1732f2558@/Library/Ruby/Gems/2.0.0/gems/middleman-search-0.6.0/lib/middleman-search/search-index-resource.rb:111>
        Value guarded in: Middleman::Sitemap::Resource::render
        With Contract: Hash, Hash => String
        At: /Library/Ruby/Gems/2.0.0/gems/middleman-core-4.1.1/lib/middleman-core/sitemap/resource.rb:132 
 /Library/Ruby/Gems/2.0.0/gems/contracts-0.12.0/lib/contracts.rb:48:in `block in <class:Contract>'
 /Library/Ruby/Gems/2.0.0/gems/contracts-0.12.0/lib/contracts.rb:154:in `call'
 /Library/Ruby/Gems/2.0.0/gems/contracts-0.12.0/lib/contracts.rb:154:in `failure_callback'
 /Library/Ruby/Gems/2.0.0/gems/contracts-0.12.0/lib/contracts/method_handler.rb:143:in `rescue in block in redefine_method'
 /Library/Ruby/Gems/2.0.0/gems/contracts-0.12.0/lib/contracts/method_handler.rb:136:in `block in redefine_method'
 /Library/Ruby/Gems/2.0.0/gems/middleman-search-0.6.0/lib/middleman-search/search-index-resource.rb:111:in `value_for'
drallgood commented 8 years ago

Additional tidbit: This only seems to happen with middleman 4.1. They indeed removed the blocks support: https://github.com/middleman/middleman/commit/98e3c8aa79b6c311b10abed400bef32298c84e4e

drallgood commented 8 years ago

@matiasgarciaisaia Any suggestion how to fix this. it's really preventing us from updating our dependencies right now :disappointed:

drallgood commented 8 years ago

Will be fixed with #10

Jeeppler commented 8 years ago

@matiasgarciaisaia: This commit works fine, but is sadly not merged.

spalladino commented 8 years ago

Fixed in #10 (thanks @drallgood)