Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add options augument to initializer #6

Merged
merged 1 commit into from
Oct 5, 2017
Merged

add options augument to initializer #6

merged 1 commit into from
Oct 5, 2017

Conversation

famano
Copy link
Contributor

@famano famano commented Oct 5, 2017

Hi, when I use hanami-shrine i got following AugumentError.

/home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-shrine-0.3.0/lib/shrine/plugins/hanami.rb:9:in `initialize': wrong number of arguments (given 2, expected 1) (ArgumentError)
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/shrine-2.7.0/lib/shrine.rb:158:in `new'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/shrine-2.7.0/lib/shrine.rb:158:in `attachment'
	from /home/fumio/workspace/someapp/lib/someapp/entities/contract_version.rb:4:in `<class:ContractVersion>'
	from /home/fumio/workspace/someapp/lib/someapp/entities/contract_version.rb:3:in `<top (required)>'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-utils-1.0.4/lib/hanami/utils.rb:68:in `load'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-utils-1.0.4/lib/hanami/utils.rb:68:in `block in reload!'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-utils-1.0.4/lib/hanami/utils.rb:90:in `each'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-utils-1.0.4/lib/hanami/utils.rb:90:in `for_each_file_in'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-utils-1.0.4/lib/hanami/utils.rb:68:in `reload!'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components/components.rb:59:in `block (2 levels) in <module:Components>'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components/component.rb:40:in `call'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components.rb:85:in `block (2 levels) in resolve'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:133:in `block in fetch_or_store'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:122:in `fetch'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:132:in `fetch_or_store'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components.rb:83:in `block in resolve'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components.rb:82:in `each'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components.rb:82:in `resolve'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components/component.rb:138:in `resolve_requirements'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components/component.rb:36:in `call'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components.rb:85:in `block (2 levels) in resolve'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:133:in `block in fetch_or_store'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:122:in `fetch'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb:132:in `fetch_or_store'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components.rb:83:in `block in resolve'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components.rb:82:in `each'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/components.rb:82:in `resolve'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/commands/command.rb:57:in `initialize'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/commands/console.rb:52:in `initialize'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/cli.rb:89:in `new'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/lib/hanami/cli.rb:89:in `console'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/gems/hanami-1.0.0/bin/hanami:5:in `<top (required)>'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/bin/hanami:23:in `load'
	from /home/fumio/workspace/someapp/vendor/bundle/ruby/2.3.0/bin/hanami:23:in `<main>'

Since shrine updated 2.7.0, it passes attachment two augments. I don't know what new **options exactly means, but with appending **option augment in initializer solves this error.

@janko
Copy link
Contributor

janko commented Oct 5, 2017

See shrinerb/shrine#167 for more details on that change. Sorry, it didn't occur to me that it would be backwards incompatible. Unlike *args, **options actually expects the class to accept additional arguments, so thats why the error occurred.

I will see if I can fix this regression in Shrine, though this fix is still valid.

@katafrakt
Copy link
Owner

@famano thank you for noticing it and finding a solution right away!

@janko-m thanks for explanation about what happened. Much appreciated.

I'm going to merge it.

@katafrakt katafrakt merged commit c26a959 into katafrakt:master Oct 5, 2017
@katafrakt
Copy link
Owner

Released version 0.4.0 which includes it (while dropping support for Shrine < 2.7.0)

@famano
Copy link
Contributor Author

famano commented Oct 6, 2017

Thanks to merge 😉

@famano famano deleted the adapt-to-shrine-ver2.8 branch October 6, 2017 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants