Undefined method `options' for #<Middleman::Application:0x70156794690600> (NoMethodError)
Closed this issue · 22 comments
Hi Karl,
I'm getting the following error using middleman-sync:
/Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/middleman-sync-3.0.6/lib/middleman-sync/commands.rb:24:in
sync': undefined method options' for #<Middleman::Application:0x70156794690600> (NoMethodError) from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/thor-0.15.4/lib/thor/task.rb:27:in
run'
from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/thor-0.15.4/lib/thor/invocation.rb:120:in invoke_task' from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/thor-0.15.4/lib/thor.rb:275:in
dispatch'
from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/thor-0.15.4/lib/thor/base.rb:425:in start' from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/middleman-core-3.0.6/lib/middleman-core/cli.rb:77:in
method_missing'
from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/thor-0.15.4/lib/thor/task.rb:29:in run' from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/thor-0.15.4/lib/thor/task.rb:126:in
run'
from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/thor-0.15.4/lib/thor/invocation.rb:120:in invoke_task' from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/thor-0.15.4/lib/thor.rb:275:in
dispatch'
from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/thor-0.15.4/lib/thor/base.rb:425:in start' from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/middleman-core-3.0.6/lib/middleman-core/cli.rb:22:in
start'
from /Users/pedr/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/middleman-core-3.0.6/bin/middleman:18:in <top (required)>' from /Users/pedr/.rbenv/versions/1.9.3-p194/bin/middleman:23:in
load'
from /Users/pedr/.rbenv/versions/1.9.3-p194/bin/middleman:23:in <main>'
Have you activated :sync in your config.rb?
Yes:
# Activate sync extension activate :sync do |sync| sync.fog_provider = 'AWS' # Your storage provider sync.fog_directory = 'andrewphillipsmusic' # Your bucket name sync.fog_region = 'eu-west-1' # The region your storage bucket is in (eg us-east-1, us-west-1, eu-west-1, ap-southeast-1 ) sync.aws_access_key_id = 'XXXX' # Your Amazon S3 access key sync.aws_secret_access_key = 'XXXXX' # Your Amazon S3 access secret sync.existing_remote_files = 'keep' # What to do with your existing remote files? ( keep or delete ) sync.after_build = false # Disable sync to run after Middleman build ( defaults to true ) end
That looks like its commented out? ( although https://github.com/karlfreeman/middleman-sync/blob/master/lib/middleman-sync/commands.rb#L26 should be a bit more clever with raising an exception )
Sorry. Just commented it out because it wasn't working. Edited it.
Ahh no worries. What version of middleman are you running?
Middleman 3.0.6
When I first added middleman-sync I git the following:
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
middleman-sync (~> 3.0.5) ruby depends on
activesupport (= 3.1.8) rubymiddleman (~> 3.0.6) ruby depends on
activesupport (3.2.9)
But updated activesupport and it seemed to fix that.
Hmm, just trying it out now on middleman 3.0.6 and can't reproduce it. Give me a min to get 1.9.3-p194 on my machine and I'll get back to you
I've tried with 1.9.2-p290 and get the same error.
My Gemfile:
source :rubygems
gem "middleman", "~>3.0.6"
gem "middleman-sprockets"
gem "middleman-sync", "~> 3.0.5"
gem "susy"
Hmm, the activesupport conflict is interesting, Essentially middleman-sync is a wrapper around AssetSync so for middleman and middleman-sync to conflict with activesupport would mean its the dependencies of the two that are causing a fuss.
Not sure how the decency conflict with activsupport is happening. Using your Gemfile bundler pulls down 3.2.8
Curiouser and curiouser. Trying to work out where that's getting required from.
middleman-core has a dependency to activesupport as activesupport ~> 3.2.6 and activesupport is at 3.2.9 so that will do it.
Hmm, ok. Well I guess I'm not sure what could be causing that problem :(
I wish I knew Ruby a bit better so I could dive in there :( So the Sync Module is adding an options helper method to Middleman::Application but for some reason this method isn't available when it's being called. Does that sound about right?
Bang on the money. I'll try looking in to it a bit more. Problem is, I can't reproduce what your seeing :(
Thanks anyhow. I'll keep playing with my setup. Could you paste up a config.rb file with middleman sync added so I can check I'm not doing something idiotic?
As far as I can see:
- Middleman Sync is never registered when running $ middleman sync, so options are never created or added. (Sprockets is picked up and registered though).
- Middleman Sync is registered when running $ middleman build but after_build is never called.
Will try and replicate this, this weekend. As far as I can tell this must be something to do with either middleman-core or asset_sync :(
I ended up scrubbing any trace of Ruby from my system and reinstalling rbenv from scratch. Middleman-Sync Seems to be working OK now. Sorry I can't give you a more specific fix than that. Hopefully it was just a strange quirk somewhere in my setup and won't effect anyone else. Thanks for taking a look at it.