--- a/bin/rdbg +++ b/bin/rdbg @@ -1,24 +1,13 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -require 'bundler/inline' - -gemfile do - source 'https://rubygems.org' - gem 'debug', '>= 1.0.0' -end +#!/bin/sh +set -eu +. ~/.lib/sh/stubexec.sh -def run - if File.exist?(Bundler.unbundled_env.fetch('BUNDLE_GEMFILE', 'Gemfile')) - Bundler.with_unbundled_env do - Bundler.reset! - yield - exit - end - end - yield -end +install_it() { + [ -w "$(gem env gemdir)" ] || + opt="--user-install" -run do - load Gem.bin_path('debug', 'rdbg') -end + gem install -q ${opt:-} "debug:>=1.0.0" + asdf reshim ruby || : +} + +stubexec "$@"