modernistik / parse-stack

Parse Server Ruby Client SDK
https://www.modernistik.com/gems/parse-stack/
MIT License
61 stars 21 forks source link

Doesn't load in Ruby 3.0.0 #62

Open mathieulb opened 3 years ago

mathieulb commented 3 years ago

I have to use Ruby 2.6.3 (the one bundled with MacOS) instead of Ruby 3.0.0 (the one installable by Homebrew) because the latter causes this error:

/usr/local/lib/ruby/gems/3.0.0/gems/parse-stack-1.9.1/lib/parse/model/associations/has_many.rb:352:in `has_many_queried': wrong number of arguments (given 3, expected 1..2) (ArgumentError)
from /usr/local/lib/ruby/gems/3.0.0/gems/parse-stack-1.9.1/lib/parse/model/associations/has_many.rb:409:in `has_many'
from /usr/local/lib/ruby/gems/3.0.0/gems/parse-stack-1.9.1/lib/parse/model/classes/user.rb:182:in `<class:User>'
from /usr/local/lib/ruby/gems/3.0.0/gems/parse-stack-1.9.1/lib/parse/model/classes/user.rb:146:in `<module:Parse>'
from /usr/local/lib/ruby/gems/3.0.0/gems/parse-stack-1.9.1/lib/parse/model/classes/user.rb:6:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/parse-stack-1.9.1/lib/parse/model/classes/product.rb:4:in `require_relative'
from /usr/local/lib/ruby/gems/3.0.0/gems/parse-stack-1.9.1/lib/parse/model/classes/product.rb:4:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/parse-stack-1.9.1/lib/parse/model/object.rb:567:in `require_relative'
from /usr/local/lib/ruby/gems/3.0.0/gems/parse-stack-1.9.1/lib/parse/model/object.rb:567:in `<top (required)>'
from /usr/local/lib/ruby/gems/3.0.0/gems/parse-stack-1.9.1/lib/parse/stack.rb:7:in `require_relative'
from /usr/local/lib/ruby/gems/3.0.0/gems/parse-stack-1.9.1/lib/parse/stack.rb:7:in `<top (required)>'
from <internal:/usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `require'
from <internal:/usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require'
from <internal:/usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
from fetch.rb:6:in `<main>'

<internal:/usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in require': cannot load such file -- parse/stack (LoadError) from <internal:/usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:inrequire' from fetch.rb:6:in `

'

mathieulb commented 3 years ago

This is fixable by inserting a ** to pass the options in parse/model/associations/has_many.rb:409 and parse/query.rb:769 ; this only covers my current usage, you'd have to find all cases of keyword-args being passed as a Hash and prefix them all with **.

apersaud commented 3 years ago

I'll take a look.

apersaud commented 3 years ago

Can you give branch feature/1.10.0 a try?

PR: https://github.com/modernistik/parse-stack/pull/64

mathieulb commented 3 years ago

did git clone https://github.com/modernistik/parse-stack.git -b feature/1.10.0 ; then before my program's require I inserted the line $:.unshift ENV["HOME"]+"/parse-stack" ; then I ran it using ruby 3.0.1 and it worked !

thanks

apersaud commented 3 years ago

If you have a development environment, I suggest using the Gemfile to point to the new version:

gem 'parse-stack', git: 'https://github.com/modernistik/parse-stack.git', branch: 'feature/1.10.0'
mathieulb commented 3 years ago

i'm getting this error running the line from your last comment :

ruby -e "gem 'parse-stack', git: 'https://github.com/modernistik/parse-stack.git', branch: 'feature/1.10.0'"
/usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/rubygems/dependency.rb:311:in 'to_specs': Could not find 'parse-stack' (>= 0) among 205 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/biaptlab/.gem/ruby/3.0.0:/usr/local/lib/ruby/gems/3.0.0:/usr/local/Cellar/ruby/3.0.1/lib/ruby/gems/3.0.0' , execute 'gem env' for more information
from /usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/rubygems/dependency.rb:323:in 'to_spec'
from /usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/rubygems/core_ext/kernel_gem.rb:62:in 'gem'
mathieulb commented 3 years ago

Maybe I should have included this too, but I don't know enough about gem to know whether that's helpful. gem env RubyGems Environment: