Fri, 06 May 2022 06:33:41 -0400
Switch to stubexec, handle user_dir install
.Gemfile | file | annotate | diff | comparison | revisions | |
bin/pry | file | annotate | diff | comparison | revisions | |
bin/rdbg | file | annotate | diff | comparison | revisions | |
bin/setup-gem-faves | file | annotate | diff | comparison | revisions |
--- a/.Gemfile +++ b/.Gemfile @@ -1,7 +1,6 @@ # vim: ft=ruby source 'https://rubygems.org' -gem 'pry' gem 'httparty' gem 'asciidoctor' gem 'timetrap'
--- a/bin/pry +++ b/bin/pry @@ -1,26 +1,14 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -require 'bundler/inline' - -gemfile do - source 'https://rubygems.org' - gem 'pry', '~> 0.13.1' - gem 'pry-byebug' - gem 'pry-inline' -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('pry', 'pry') -end + gem install -q ${opt:-} \ + "pry:~>0.13.1" pry-byebug pry-inline + asdf reshim ruby || : +} + +stubexec "$@"
--- 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 "$@"
--- a/bin/setup-gem-faves +++ b/bin/setup-gem-faves @@ -1,9 +1,17 @@ #!/bin/sh set -eu +if ! [ -w "$(gem env gemdir)" ]; then + export GEM_HOME="$(ruby -e 'puts Gem.user_dir')" +fi + if ! bundle --version >/dev/null 2>&1; then gem install bundler fi +export \ + BUNDLE_IGNORE_CONFIG=1 \ + BUNDLE_FROZEN=0 + +bundle install --jobs=2 --gemfile=~/.Gemfile rm -f ~/.Gemfile.lock -exec bundle install --system --jobs=2 --gemfile=~/.Gemfile