module PoiseRuby::RubyCommandMixin::Resource

Private Instance Methods

default_gem_binary() click to toggle source

Find the default gem binary. If there is a parent use that, otherwise use the same logic as {PoiseRuby::RubyProviders::Base#gem_binary}.

@return [String]

# File lib/poise_ruby/ruby_command_mixin.rb, line 42
def default_gem_binary
  if parent_ruby
    parent_ruby.gem_binary
  else
    dir, base = ::File.split(ruby)
    # If this ruby is called something weird, bail out.
    raise NotImplementedError unless base.start_with?('ruby')
    # Allow for names like "ruby2.0" -> "gem2.0".
    ::File.join(dir, base.sub(/^ruby/, 'gem'))
  end
end