Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix missing new_ostruct_member in Ruby 2.7 #255

Merged
merged 11 commits into from
Jan 4, 2020

Conversation

qnighy
Copy link
Contributor

@qnighy qnighy commented Nov 29, 2019

OpenStruct#new_ostruct_member has been removed in ruby/ruby#2178.

@jcoyne
Copy link

jcoyne commented Dec 18, 2019

Ref #259

@qnighy qnighy mentioned this pull request Dec 29, 2019

if v.is_a?(Hash)
v = v["type"] == "hash" ? v["contents"] : __convert(v)
elsif v.is_a?(Array)
v = v.collect { |e| e.instance_of?(Hash) ? __convert(e) : e }
end

s.send("#{k}=".to_sym, v)
if s.respond_to?(:[]=)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment about why this conditional is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was meant for backward compatibility with older Ruby versions. Now I noticed that the version #[]= was introduced is way older than the version config claims to support... ruby/ruby@e44e356#diff-f0ac5119f74bfda273347c9925e910d7

Therefore I'm going to remove this conditional, rather than adding comments.

OpenStruct#[]= was introduced in Ruby 2.0: ruby/ruby@e44e356

This is way older than the version `config` supports, namely Ruby 2.4.
@jcoyne jcoyne mentioned this pull request Jan 2, 2020
Fryguy
Fryguy previously approved these changes Jan 2, 2020
Copy link
Member

@Fryguy Fryguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkuczynski This LGTM. Once #256 is merged, this should go green too.

@Fryguy
Copy link
Member

Fryguy commented Jan 2, 2020

@qnighy Does it make sense to add 2.7.0 to the .travis.yml as well to verify this is working?

@jrafanie
Copy link
Contributor

jrafanie commented Jan 2, 2020

Note, the failed tests are fixed in the hardcoding of sprockets in #250.

@qnighy
Copy link
Contributor Author

qnighy commented Jan 3, 2020

@Fryguy

@qnighy Does it make sense to add 2.7.0 to the .travis.yml as well to verify this is working?

Done!

@jrafanie
Copy link
Contributor

jrafanie commented Jan 3, 2020

Looks like the rails 4.2 test suite doesn't play nice with ruby 2.7 and the appraisal version it's trying to use. Is it time to drop rails 4.2 support? We've had several PRs that all seem to have issues with 4.2 and it's no longer supported upstream: see these PRs that hit 4.2 issues: #250 #251 #253 #254. @pkuczynski how can we help?

@Fryguy
Copy link
Member

Fryguy commented Jan 3, 2020

You can probably also add an exclude to .travis.yml for

    - rvm: 2.7.0
      gemfile: gemfiles/rails_4.2.gemfile

@pkuczynski pkuczynski added this to the 2.2.0 milestone Jan 4, 2020
@pkuczynski pkuczynski added the bug label Jan 4, 2020
pkuczynski added a commit that referenced this pull request Jan 4, 2020
@pkuczynski pkuczynski merged commit ab7039f into rubyconfig:master Jan 4, 2020
@pkuczynski
Copy link
Member

Thanks!

hachi-eiji added a commit to hachi-eiji/sandbox-todo-app that referenced this pull request Jan 5, 2020
lcaparroz added a commit to SUSE/rmt that referenced this pull request Jun 15, 2020
The current gem `config` version (1.7.2, Gemfile.lock) is not compatible
with Ruby 2.7 due to a protected method that has been removed from Ruby
OpenStruct class (standard library).

To correctly suppport Ruby 2.7 within rmt-server, I increased the gem
version to the latest release (2.2.1) which fixes the described issue.

Links:

* Issue: rubyconfig/config#259
* Pull Request: rubyconfig/config#255
* Release: https://github.com/rubyconfig/config/releases/tag/2.2.1
lcaparroz added a commit to SUSE/rmt that referenced this pull request Jun 16, 2020
The current gem `config` version (1.7.2, Gemfile.lock) is not compatible
with Ruby 2.7 due to a protected method that has been removed from Ruby
OpenStruct class (standard library).

To correctly suppport Ruby 2.7 within rmt-server, I increased the gem
version to the latest release (2.2.1) which fixes the described issue.

Links:

* Issue: rubyconfig/config#259
* Pull Request: rubyconfig/config#255
* Release: https://github.com/rubyconfig/config/releases/tag/2.2.1
lcaparroz added a commit to SUSE/rmt that referenced this pull request Jun 16, 2020
The current gem `config` version (1.7.2, Gemfile.lock) is not compatible
with Ruby 2.7 due to a protected method that has been removed from Ruby
OpenStruct class (standard library).

To correctly suppport Ruby 2.7 within rmt-server, I increased the gem
version to the latest release (2.2.1) which fixes the described issue.

Links:

* Issue: rubyconfig/config#259
* Pull Request: rubyconfig/config#255
* Release: https://github.com/rubyconfig/config/releases/tag/2.2.1
n-rodriguez added a commit to jbox-web/active_settings that referenced this pull request Oct 13, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Development

Successfully merging this pull request may close these issues.

5 participants