distributable: url: https://github.com/rubygems/rubygems/archive/refs/tags/v{{version}}.tar.gz strip-components: 1 versions: github: rubygems/rubygems dependencies: ruby-lang.org: '>=2.3' runtime: env: RUBYLIB: ${{prefix}}/lib:$RUBYLIB build: dependencies: gnu.org/patch: '*' ruby-lang.org: ~3.1 # testing a theory script: - ruby setup.rb --prefix={{prefix}} --env-shebang --no-ri --no-rdoc - run: | patch -p1 < "$SRCROOT"/props/fit-n-finish.1.patch patch -p1 < "$SRCROOT"/props/fit-n-finish.2.patch sed -ie 's/Gem.default_dir/Gem.default_system_dir/' lib/rubygems/path_support.rb working-directory: ${{prefix}} - run: sed -ie 's/Gem.state_home, "gem",/Gem.state_home,/' defaults.rb working-directory: ${{prefix}}/lib/rubygems if: '>=3.4' - run: patch -p1 < "$SRCROOT"/props/fit-n-finish.3.patch working-directory: ${{prefix}} if: '<3.5' - run: patch -p1 < "$SRCROOT"/props/fit-n-finish.4.patch working-directory: ${{prefix}} if: '>=3.5' - run: sed -ie 's/Dir\.mkdir dir, \*\[options\[:dir_mode\].*/FileUtils.mkdir_p dir, *[options[:dir_mode] \&\& 0o755].compact/' installer.rb working-directory: ${{prefix}}/lib/rubygems # these are provided by ruby-lang.org # they turn up here since that is how gem handles deps # but ruby is in PATH and has these and that is the preference - run: rm rake rbs rdbg typeprof working-directory: ${{prefix}}/bin # ruby has a neat feature where it will look for a ruby shebang and # ignore everything from before that, so we can make scripts that execute # as POSIX shell and then re-exec themselves as ruby scripts # REF https://github.com/pkgxdev/pantry/issues/4010 - run: | for tool in bundle bundler; do echo "$(cat $PROP gems/bundler-*/exe/$tool)" > bin/$tool done echo "$(cat $PROP bin/gem)" > bin/gem prop: | #!/bin/sh d="$(cd "$(dirname "$0")"/.. && pwd)" export RUBYLIB="$d/lib" if [ -z "$GEM_PATH" ]; then export GEM_PATH="$d" else export GEM_PATH="$d:$GEM_PATH" fi exec ruby "$0" "$@" working-directory: ${{prefix}} # no longer needed - rm -rf {{prefix}}/gems # the bundler code figures out the “gem path” for itself by checking for this directory structure # for some reason we are not installed in a gem-compatible way and # `GEM_PATH` is not used here (but it is later) # FIXME this stuff is messy, ideally we’d do much less stuff since it breaks easily with new releases - run: ln -s bin exe working-directory: ${{prefix}} # clean up empty, unused directory - rmdir {{prefix}}/plugins test: env: vRUBY: ${{deps.ruby-lang.org.version.marketing}}.0 script: # for debug - gem env - | gem install awesome_print --verbose ruby -e 'require "rubygems"' -e 'require "awesome_print"' -e'ap $LOAD_PATH' - | gem install hexapdf --verbose if [ -w /usr/local/lib/ruby/ ]; then v="$(/usr/local/bin/hexapdf version | cut -d' ' -f2)" test -d /usr/local/lib/ruby/gems/$vRUBY/gems/hexapdf-$v else v="$(~/.local/bin/hexapdf version | cut -d' ' -f2)" test -d ~/.gem/ruby/$vRUBY/gems/hexapdf-$v fi # test for https://github.com/pkgxdev/pantry/issues/4010 - run: | export GEM_HOME=$HOME/.bundler mv $FIXTURE Gemfile bundle install --path vendor/bundle fixture: | source 'https://rubygems.org' gem 'warbler', platforms: :jruby # verifies that our bundler can be used as a gem - run: ruby $FIXTURE fixture: content: | require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'ruby-macho', '~> 3' end extname: rb provides: - bin/bundle - bin/bundler - bin/gem