fredjean / middleman-s3_sync

The gem that tries really hard not to push files to S3.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined local variable or method `s3_sync_options'

sctb opened this issue · comments

When attempting to call bundle exec middleman build using
middleman-s3_sync 4.0.0 I get the following error:

/.../.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/configuration.rb:78:in `method_missing': undefined local variable or method `s3_sync_options' for #<Middleman::Application:0x70167262862060> (NameError)

This is occurring because of a reference to s3_sync_options in my
config.rb, which follows the activate :s3_sync block:

activate :cloudfront do |cf|
  cf.access_key_id = s3_sync_options.aws_access_key_id
  cf.secret_access_key = s3_sync_options.aws_secret_access_key
  ...
end

This works for a colleague but not for me. Is this the idiomatic way to
reuse S3Sync's configuration?

After replacing the calls to s3_sync_options, I'm now getting
an error calling after_s3_sync, which suggests that there is
a more general issue.

I had the wrong version of s3_sync installed, and after getting 3.3.3
I see this:

% bundle exec middleman build
/Users/sctb/.gem/ruby/2.0.0/gems/middleman-s3_sync-3.3.3/lib/middleman-s3_sync/extension.rb:85:in `s3_sync_options': undefined method `s3_sync_options' for Middleman::S3SyncExtension:Class (NoMethodError)

I'm flying back home tonight. I shod be able to look at this issue in more
details tomorrow. Please post a full backtrace so I can see what is going
on.

The s3_sync_options method isn't meant to be used to expose the aws
credentials. How are you configuring the gem?

-- Fred
On Oct 30, 2015 6:33 PM, "Scott Bell" notifications@github.com wrote:

I had the wrong version of s3_sync installed, and after getting 3.3.3
I see this:

% bundle exec middleman build
/Users/sctb/.gem/ruby/2.0.0/gems/middleman-s3_sync-3.3.3/lib/middleman-s3_sync/extension.rb:85:in s3_sync_options': undefined methods3_sync_options' for Middleman::S3SyncExtension:Class (NoMethodError)


Reply to this email directly or view it on GitHub
#105 (comment)
.

Here is the Gemfile:

source 'http://rubygems.org'

gem "json"
gem 'slim', '>= 3.0' 
gem "builder" 
gem 'coffee-script', '~> 2.3.0' 
gem 'compass-import-once', '~> 1.0.5'
gem 'sass', '~> 3.4.11'
gem "redcarpet" 
gem "tzinfo" 
gem "tzinfo-data" 

gem 'middleman', '~> 3.3'
gem "middleman-livereload"
gem "middleman-minify-html" 
gem 'middleman-autoprefixer' 

gem 'middleman-s3_sync', '~> 3.3' 
gem 'middleman-s3_redirect', '~> 3.0' 
gem 'middleman-cloudfront' 


gem 'oj'

... and the backtrace:

/Users/sctb/.gem/ruby/2.0.0/gems/middleman-s3_sync-3.3.3/lib/middleman-s3_sync/extension.rb:85:in `s3_sync_options': undefined method `s3_sync_options' for Middleman::S3SyncExtension:Class (NoMethodError)
    from /Users/sctb/Documents/src/www/yc/config.rb:73:in `block in initialize'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-cloudfront-0.2.1/lib/middleman-cloudfront/extension.rb:14:in `registered'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/extensions.rb:80:in `register'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/extensions.rb:112:in `activate'
    from /Users/sctb/Documents/src/www/yc/config.rb:72:in `initialize'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/extensions.rb:162:in `instance_eval'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/extensions.rb:162:in `initialize'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/data.rb:33:in `initialize'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/application.rb:210:in `initialize'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/request.rb:56:in `new'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/request.rb:56:in `inst'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/cli/build.rb:95:in `shared_instance'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/cli/build.rb:62:in `build'
    from /Users/sctb/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/sctb/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/sctb/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Users/sctb/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/cli.rb:72:in `method_missing'
    from /Users/sctb/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:29:in `run'
    from /Users/sctb/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:126:in `run'
    from /Users/sctb/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/sctb/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Users/sctb/.gem/ruby/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/lib/middleman-core/cli.rb:20:in `start'
    from /Users/sctb/.gem/ruby/2.0.0/gems/middleman-core-3.4.0/bin/middleman:18:in `<top (required)>'
    from /Users/sctb/.gem/ruby/2.0.0/bin/middleman:23:in `load'
    from /Users/sctb/.gem/ruby/2.0.0/bin/middleman:23:in `<main>'

v4.0.1 should address this.