-
-
Notifications
You must be signed in to change notification settings - Fork 633
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
Compatibility with Ruby 2.0+ #651
Conversation
Something seems to be up with TravisCI trying to install EDIT: Seems to be related to this issue npm/npm#14042, and it's apparently fixable by downgrading npm or running shinkrwrap again with npm 3.10.10+ |
@samnang @mapreal19 @robwise This one looks OK to me. Ugly, but I guess some people need it. I vote for this one. How about you guys? |
@justin808 To me, it's okay if we want to support them for a while and pay attention of features that might break for this, but it shouldn't a long term because Rails 5 already drop their support. If we just trying with minimum dependency on Rails, then it might not be a problem. |
@justin808 @bbonamin we could remove the duplication for those required arguments with a helper method. Take a look at this answer http://stackoverflow.com/a/15078852/2273578 I would rather see those methods like this: def rails_context(server_side: required) Review status: 0 of 7 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
lol I vote for this just the way I voted for it the last time someone did this almost a year ago, this repo really hardly uses keyword arguments so it's a no-brainer to keep it backwards compatible. I'm not sure why we keep re-introducing breaking changes: https://github.com/shakacode/react_on_rails/blob/28776cbc36b22dc3aa91a5b1fe9f9b2b3c20fdc7/CHANGELOG.md#210---2016-01-26 |
12053d9
to
7edc2d0
Compare
@mapreal19 I've pushed a change with a DRYer approach to doing to required validation. Let me know if you think it's good 😃 |
2 similar comments
Please rebase your changes on top of my latest commit. |
Done 👍 ! Merry Christmas! 🎄 |
2 similar comments
Small suggestions @bbonamin. Looking good! Reviewed 4 of 7 files at r1, 3 of 3 files at r2, 1 of 1 files at r3. app/helpers/react_on_rails_helper.rb, line 263 at r3 (raw file):
We should do these one per param per line. Easier to read. lib/react_on_rails/test_helper/webpack_assets_status_checker.rb, line 14 at r3 (raw file):
can we use the helper Comments from Reviewable |
Review status: all files reviewed at latest revision, 3 unresolved discussions. CHANGELOG.md, line 9 at r3 (raw file):
Please see the other changelog entries and make consistent. Comments from Reviewable |
Please put your changelog comments under 6.3.3. |
It's not compatible with Ruby < 2.2
Required keyword arguments were introduced in Ruby 2.1, but can be emulated in 2.0 by using a default value that raises an ArgumentError Add notes to CHANGELOG
To work around the issue npm/npm#14042, where npm tries to install optional dependencies and fails.
646e9bc
to
b30045b
Compare
@justin808 Thanks for the feedback! I've addressed your comments, and added a |
So that rubygems.org can pick it up and display it on the gem page.
GREAT JOB! Reviewed 5 of 5 files at r4. Comments from Reviewable |
1 similar comment
Thanks @bbonamin! Reviewed 1 of 7 files at r1, 2 of 3 files at r2, 1 of 1 files at r3, 5 of 5 files at r4. Comments from Reviewable |
First of all, let me express how grateful I am for this gem. I've recently been learning about react and webpack, and react_on_rails has made it a breeze to implement what I've learned in my Rails projects! It's allowed us to add "sprinkles" of React in certain Rails views, without commiting to rewriting everything from scratch. Thank you!
Now, for a project I'm currently working on, we need compatibility with Ruby 2.0 (yeah yeah, I know it's not receiving fixes or patches anymore, but we can't upgrade yet.)
The rubygems page for react_on_rails doesn't specify a minimum ruby version, but if you try to use the gem with < 2.1, it breaks because of the required keyword arguments that were introduced in 2.1.
The changes in this PR do "backport" this behavior to 2.0. I couldn't find anything else other than these syntax changes that would make the gem incompatible with 2.0, and tests seem to pass.
Thoughts?
This change is