ruby_engine-2.0.3/ 0000755 0000041 0000041 00000000000 14632134567 014065 5 ustar www-data www-data ruby_engine-2.0.3/Gemfile.lock 0000755 0000041 0000041 00000001171 14632134567 016312 0 ustar www-data www-data PATH
remote: .
specs:
ruby_engine (2.0.3)
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.5.1)
rake (13.2.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
PLATFORMS
java
ruby
DEPENDENCIES
rake (~> 13.2)
rspec (~> 3.13)
ruby_engine!
BUNDLED WITH
2.2.22
ruby_engine-2.0.3/.gitignore 0000644 0000041 0000041 00000000021 14632134567 016046 0 ustar www-data www-data Gemfile.lock
pkg
ruby_engine-2.0.3/lib/ 0000755 0000041 0000041 00000000000 14632134567 014633 5 ustar www-data www-data ruby_engine-2.0.3/lib/ruby_engine.rb 0000644 0000041 0000041 00000001207 14632134567 017466 0 ustar www-data www-data # frozen_string_literal: true
module RubyEngine
VERSION = '2.0.3'
@interpreter = RUBY_ENGINE.to_s
class << self
def is?(what)
what === @interpreter
end
alias is is?
def to_s
@interpreter.to_s
end
alias inspect to_s
def mri?
RubyEngine.is? 'ruby'
end
alias official_ruby? mri?
alias ruby? mri?
alias cruby? mri?
def jruby?
RubyEngine.is? 'jruby'
end
alias java? jruby?
def rubinius?
RubyEngine.is? 'rbx'
end
alias rbx? rubinius?
def truffleruby?
RubyEngine.is? 'truffleruby'
end
alias truffle? truffleruby?
end
end
ruby_engine-2.0.3/spec/ 0000755 0000041 0000041 00000000000 14632134567 015017 5 ustar www-data www-data ruby_engine-2.0.3/spec/spec_helper.rb 0000644 0000041 0000041 00000000177 14632134567 017642 0 ustar www-data www-data require 'rspec'
require 'ruby_engine'
RSpec.configure do |config|
config.expect_with(:rspec) { |c| c.syntax = :should }
end
ruby_engine-2.0.3/spec/ruby_engine_spec.rb 0000644 0000041 0000041 00000001123 14632134567 020661 0 ustar www-data www-data require_relative 'spec_helper'
describe 'RubyEngine' do
before :all do
RubyEngine.instance_variable_set(:@interpreter, "jruby")
end
it 'should display RUBY_ENGINE if called directly (to_s)' do
RubyEngine.to_s.should == 'jruby'
end
describe '.is?' do
it 'returns true if current ruby engine matches' do
RubyEngine.is?('jruby').should == true
end
it 'returns false if current ruby engine does not match' do
RubyEngine.is?('maglev').should == false
end
it 'also supports regex' do
RubyEngine.is?(/ruby/).should == true
end
end
end
ruby_engine-2.0.3/.rspec 0000644 0000041 0000041 00000000040 14632134567 015174 0 ustar www-data www-data --colour --format documentation
ruby_engine-2.0.3/Rakefile 0000644 0000041 0000041 00000001624 14632134567 015535 0 ustar www-data www-data # # #
# Get gemspec info
gemspec_file = Dir["*.gemspec"].first
gemspec = eval File.read(gemspec_file), binding, gemspec_file
info = "#{gemspec.name} | #{gemspec.version} | " \
"#{gemspec.runtime_dependencies.size} dependencies | " \
"#{gemspec.files.size} files"
# # #
# Gem build and install task
desc info
task :gem do
puts info + "\n\n"
print " "; sh "gem build #{gemspec_file}"
FileUtils.mkdir_p "pkg"
FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", "pkg"
puts; sh %{gem install --no-document pkg/#{gemspec.name}-#{gemspec.version}.gem}
end
# # #
# Start an IRB session with the gem loaded
desc "#{gemspec.name} | IRB"
task :irb do
sh "irb -I ./lib -r #{gemspec.name.gsub '-','/'}"
end
# # #
# Run specs
begin
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task test: :spec
task default: :spec
rescue LoadError
warn("Failed to load rspec")
end
ruby_engine-2.0.3/ChangeLog.md 0000644 0000041 0000041 00000001215 14632134567 016235 0 ustar www-data www-data # Change Log
## 2.0.3 / 2024-04-22
* Drop rubygems-tasks dependency, fixes a Ruby 2.5 install problem
## 2.0.2 / 2024-04-22
* Upgrade RSpec to latest, remove Gemfile workaround
## 2.0.1 / 2024-04-02
* Add MFA to gemspec
* Update CI
## 2.0.0 / 2020-01-04
* Refactor / update for current Rubies
* Remove cardinal
* Remove ree
* Remove ironruby
* Add truffelruby
* Add `cruby?` alias to MRI
## 1.0.1 / 2014-01-15
* Fix RubyEngine.mri?
* Fix VERSION constant
## 1.0.0 / 2014-01-14
* Return "ruby" for MRI (instead of "mri")
* Return "unknown" if RUBY_ENGINE is not set (instead of "mri")
* Moved from zucker 13.1 gem into its own gem
ruby_engine-2.0.3/ruby_engine.gemspec 0000644 0000041 0000041 00000001713 14632134567 017742 0 ustar www-data www-data # -*- encoding: utf-8 -*-
require File.expand_path('../lib/ruby_engine', __FILE__)
Gem::Specification.new do |gem|
gem.name = "ruby_engine"
gem.version = RubyEngine::VERSION
gem.summary = 'Adds the RubyEngine pseudo-constant.'
gem.description = 'Gives you an RubyEngine class that simplifies checking for your Ruby implementation.'
gem.license = "MIT"
gem.authors = ["Jan Lelis"]
gem.email = ["hi@ruby.consulting"]
gem.homepage = "https://github.com/janlelis/ruby_engine"
gem.files = Dir["{**/}{.*,*}"].select{ |path| File.file?(path) && path !~ /^pkg/ }
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ['lib']
gem.metadata = { "rubygems_mfa_required" => "true" }
gem.add_development_dependency 'rake', '~> 13.2'
gem.add_development_dependency 'rspec', '~> 3.13'
end
ruby_engine-2.0.3/Gemfile 0000644 0000041 0000041 00000000047 14632134567 015361 0 ustar www-data www-data source 'https://rubygems.org'
gemspec
ruby_engine-2.0.3/MIT-LICENSE.txt 0000644 0000041 0000041 00000002043 14632134567 016336 0 ustar www-data www-data Copyright (c) 2014, 2020 Jan Lelis
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ruby_engine-2.0.3/README.md 0000644 0000041 0000041 00000001654 14632134567 015352 0 ustar www-data www-data # RubyEngine [
](https://badge.fury.io/rb/ruby_engine) [
](https://github.com/janlelis/ruby_engine/actions?query=workflow%3ATest)
Provides a `RubyEngine` constant for simple Ruby implementation checks.
## Setup
On your command-line:
$ gem install ruby_engine
In Ruby:
require 'ruby_engine'
## Usage
# Output the interpreter name
RubyEngine.to_s
# true for JRuby
RubyEngine.is? 'jruby'
# There are some query methods defined:
RubyEngine.cruby?
RubyEngine.jruby?
RubyEngine.truffle?
## Also See
- https://github.com/janlelis/ruby_version
- https://github.com/janlelis/ruby_info
- https://github.com/rdp/os
- https://github.com/janlelis/irbtools
## J-_-L
Copyright (c) 2010-2014, 2020 Jan Lelis. MIT License. Originated from the
zucker gem.