Living on the edge with Ruby 2.5 (preview)

12 Dec 2017
Ori Pekelman
CPO

Many of you know Platform.sh as your go-to modern PHP cloud solution; A bunch of you have been running NodeJS for the last two years.

But Platform.sh can do so much more. Did you know Platform.sh is a perfect platform for Ruby and Rails applications? There is basically nothing easier than deploying a Rails application on Platform.sh. You just add the platform_sh_rails  gem to your Gemfile. Copy over or generate our YAML config. Git push. Nothing to configure.

As a matter-of-fact, some of our tooling is happily running Ruby on Platform.sh for quite some time. And... not only you can run Ruby and Rails applications with incredible ease. You can do so with the latest versions. Drum roll…

Introducing Ruby 2.5 on platform.sh. So even before the official release you can test your code for the latest and greatest.

How do you migrate an existing Ruby 2.4 project on Platform.sh to Ruby 2.5?

Create a new branch. Open .platform.app.yaml change one character ( type: ruby:2.4 to type: ruby:2.5 ). Commit. Push. Test everything is dandy. You are ready. When 2.5 is officially out, just merge to master. OH, or just run in production. We are Ruby people. We live on the edge.

What’s new ?

For one, bundler is bundled as a standard library. Before, we would install Bundler as a global dependency. Which meant the version of Bundler you would have on production could be different than the version which you use locally. You could still gem install bundler but that is no fun. Now it is transparent.

Ruby 2.5 introduces some cool small features I personally love. Like how rescue/else/ensure is now so much cleaner without having to put do/end blocks. I also like the small adjustments to Array and String (delete_prefix and delete_suffix for string, prepend and append for array). Basically, stuff that we’ve been importing active_support for, just to get some sugar.

But probably the most important is performance. I haven’t run my own tests but if I am to believe the blogs. Wow. Cool. See http://engineering.appfolio.com/appfolio-engineering/2017/5/22/rails-speed-with-ruby-240-and-discourse-180 and http://www.rubyguides.com/2017/11/ruby-2-5-performance/


Enjoy, be safe, and live on the edge.