ianfixes / nmea_plus

GPS, AIS, and other NMEA message parsing and decoding; ruby gem
Apache License 2.0
33 stars 5 forks source link

Allow Ruby 3.0 #121

Open rxbynerd opened 3 years ago

rxbynerd commented 3 years ago

This pull request changes the required_ruby_version in the gemspec from "anything up to Ruby 3" to "anything above Ruby 2", allowing the gem to install with Ruby 3.

This was necessary as I have an Apple M1 device, and Ruby 2.x doesn't compile cleanly.

The tests pass locally with the following output. ``` rubynerd@Fixie [12:07:54] [~/Code/nmea_plus] [allow-ruby-three] [100% ⚡️ @ 79W] [3.0.2] -> % bundle exec rspec ....................................................................................................................................... ....................................................................................................................................... ................... Finished in 0.13437 seconds (files took 0.12861 seconds to load) 289 examples, 0 failures Coverage report generated for RSpec to /Users/rubynerd/Code/nmea_plus/coverage. 5475 / 6147 LOC (89.07%) covered. Coverage report generated for RSpec to /Users/rubynerd/Code/nmea_plus/coverage/coverage.json. 5475 / 6147 LOC (89.07%) covered. ```

Thank you for creating this gem, please let me know if there's anything else you need to merge & release!

ianfixes commented 3 years ago

Thanks for this! It also occurs to me that I have turned off Travis CI without turning on GitHub CI... I should attend to that. Do you need this urgently?

rxbynerd commented 3 years ago

I don't need this urgently, no — I published a version I can use to GitHub Packages, and after a "fun" afternoon of Docker-based banter, pointed my build process to that version instead. I wouldn't recommend that at all, but it means I'm not under time pressure here.

That said, if there's anything I can do to help get this merged then let me know!

theorician commented 1 year ago

@ianfixes Hi. Would it be possible to please merge this in as a matter of urgency? Ruby 2 has been EOL for over half a year now. This makes your gem unusable to anyone that tries to keep up with security updates etc. Thanks :)

mauroc commented 7 months ago

I second that request! thank you

rxbynerd commented 7 months ago

Hi @ianfixes — please let me know if you'd like me to take a look at GitHub Actions to help get this merged, this library has been amazingly useful for me & would be more than happy to donate some time as a thank you! :bow:

mauroc commented 7 months ago

agree it 's a great gem. I have been using it on a production site for years. I have just upgraded ruby to 3.0 and the site is now broken. Since I am a bit pressed, I tried to install your fork (https://github.com/rubynerd-forks/nmea_plus) by adding source "https://rubygems.pkg.github.com/rubynerd-forks" do gem "nmea_plus", "1.0.25" end to the gemfile, but I get Authentication is required for rubygems.pkg.github.com. Please supply credentials for this source. You can do this by running: bundle config set --global rubygems.pkg.github.com username:password even though your repo is public. What am I dointg wrong? (not a git expert here) - Thank you

rxbynerd commented 7 months ago

I think you'll need some sort of credentials to pull from GitHub Packages, namely a personal access token.

Edit: apologies hit cmd-enter too soon!

Here's the setup I have for pulling this through in a Docker build:

Dockerfile:

ARG BUNDLE_RUBYGEMS__PKG__GITHUB__COM
ENV BUNDLE_RUBYGEMS__PKG__GITHUB__COM ${BUNDLE_RUBYGEMS__PKG__GITHUB__COM}

cloudbuild.yaml:

---
steps:
- name: 'gcr.io/cloud-builders/docker'
  entrypoint: 'bash'
  args: ['-c', 'docker build -t gcr.io/rubynerd-net/skrt:$COMMIT_SHA --build-arg BUNDLE_RUBYGEMS__PKG__GITHUB__COM=$$BUNDLE_RUBYGEMS__PKG__GITHUB__COM --build-arg COMMIT_SHA=$COMMIT_SHA .']
  secretEnv: ['BUNDLE_RUBYGEMS__PKG__GITHUB__COM']
images: ['gcr.io/rubynerd-net/skrt']
availableSecrets:
  secretManager:
  - versionName: projects/163317929648/secrets/skrt-rubynerd-forks-access/versions/latest
    env: BUNDLE_RUBYGEMS__PKG__GITHUB__COM

This project is overdue for porting to GitHub Actions, it's been running in production for some time & I have auto-deployments set up with Actions. If you need I can look at porting it across sometime this weekend.

Alternatively, I can publish the rubynerd-forks branch to rubygems.org, if we don't hear back from a maintainer here.

mauroc commented 7 months ago

gotcha. I tried with my github credentials to no avail. This is a bit over my head now (I don't use docker). Hopefully we hear back from the maintainer - and yes - pls lmk if you post it to rubygems.org. thanks for your help!

mauroc commented 7 months ago

BTW - I did try to fork the official repo and upgraded the ruby version in .gemspec, but I get all sorts of errors about not finding a parser file . Unfortunately I don't have time to dig into that right now....

rxbynerd commented 7 months ago

If you don't use docker it should be much simpler: simply set the environment variable (BUNDLE_RUBYGEMS__PKG__GITHUB__COM) to a classic personal access token (not your username and password) with the read:packages scope, which you can create via your GitHub settings.

R.E. parser file — you can make that with rake -f parser/Rakefile

mauroc commented 7 months ago

I did just that and the gem now works! I would still kindly ask that if the official gem doesn't get upgraded to Ruby 3.0 soon, you publish your version to Rubygems.org. I am sure there are other people that are in the same situation as me, or will be at some point. Ruby 2.0 really is a thing of the past. Thank you again

rxbynerd commented 7 months ago

Awesome — great to hear that you're back up and running!

I would prefer to get @ianfixes input before publishing, but if we haven't heard by the weekend, I'll take a look this weekend & update here.

Please don't hesitate to remind me if I miss this, or if there are any additional issues with the fork in the meantime!

mauroc commented 7 months ago

Hi @rxbynerd - it's been pretty quiet here. I think moving this to a new home may be a good idea. Any chance you could get around to it this week? I'd be happy to contribute in the future to the extent I can. Our project relies on this gem...Thank you!

rxbynerd commented 7 months ago

Hi @mauroc — thanks for the nudge, I'll add this to my todo list — we're a little busy wrapping some DIY at the moment, but I'll see what I can get done by next week!

pierre-alain-b commented 7 months ago

I totally agree. I've just tested nmea_plus with ruby 3.0 (after changing the required ruby version in the gemspec) and it works well. So it would be good to have the tool working out of the box for anyone...