0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Ruby interpreter and version checker.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1.4
~> 5.14.0
~> 13.0.1
~> 0.80.1
 Project Readme

Build Status for master branch Gem version License LGPL 3


ruby_checker provides a simple framework to enforce a specific ruby version and interpreter to be used. This is useful for projects that want to support only a sigle ruby version/interpreter.

Basic usage

Using it is as easy as follows:

require "ruby_checker"

RubyChecker::RubyChecker.new.check!(supported: "2.6.5")

This will enforce the 2.6.5 version for your application. Note though that it is not restricting the interpreter being used. In order to do this, just instantiate the object as follows:

require "ruby_checker"

RubyChecker::RubyChecker.new.check!(interpreter: RubyChecker::MRI, supported: "2.6.5")

This gem supports the major ruby vendors by using the following constants: RubyChecker::MRI, RubyChecker::JRUBY, RubyChecker::MRUBY and RubyChecker::TRUFFLE.

Ruby on Rails integration

If you are using this gem from within a Ruby on Rails project, you will notice the following:

  • This gem will use the Rails.logger for logging purposes instead of printing everything on the standard output.
  • You don't have to provide the support argument for the RubyChecker class, since it will be guessed from the .ruby-version file from the root of your project.

Moreover, this gem also implements a railtie with an initializer. This means that if you require this gem on your Gemfile, you won't have to write any code in order to get this gem up and running. That is if you are on this situation: you have a .ruby-version file and you are using MRI. If you are using another interpreter you can write in your config/application.rb the following:

config.ruby_checker.interpreter = ::RubyChecker::JRUBY  # or any other interpreter, even ANY.

Contributing

Read the CONTRIBUTING.md file.

Read the CHANGELOG.md file.

License

This project is based on work I did for the Portus project. I've extracted my code into a gem so it can be also used for other projects that might be interested in this.

Copyright (C) 2020 Miquel Sabaté Solà <mikisabate@gmail.com>

ruby_checker is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

ruby_checker is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with ruby_checker.  If not, see <http://www.gnu.org/licenses/>.