ruby(version, options = {})
public
:category: Gem Dependencies DSL Restricts this gem dependencies file
to the given ruby
version. The :engine options from Bundler are currently
ignored.
Show source
def ruby version, options = {}
engine = options[:engine]
engine_version = options[:engine_version]
raise ArgumentError,
'you must specify engine_version along with the ruby engine' if
engine and not engine_version
unless RUBY_VERSION == version then
message = "Your Ruby version is #{RUBY_VERSION}, " +
"but your #{gem_deps_file} requires #{version}"
raise Gem::RubyVersionMismatch, message
end
if engine and engine != Gem.ruby_engine then
message = "Your ruby engine is #{Gem.ruby_engine}, " +
"but your #{gem_deps_file} requires #{engine}"
raise Gem::RubyVersionMismatch, message
end
if engine_version then
my_engine_version = Object.const_get "#{Gem.ruby_engine.upcase}_VERSION"
if engine_version != my_engine_version then
message =
"Your ruby engine version is #{Gem.ruby_engine} #{my_engine_version}, " +
"but your #{gem_deps_file} requires #{engine} #{engine_version}"
raise Gem::RubyVersionMismatch, message
end
end
return true
end