pantry/projects/rubygems.org/package.yml
2023-12-26 09:51:02 +00:00

119 lines
3.4 KiB
YAML

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
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.patch
patch -p1 < "$SRCROOT"/props/fit-n-finish.2.patch
sed -i -e 's/Gem.default_dir/Gem.default_system_dir/' lib/rubygems/path_support.rb
working-directory: ${{prefix}}
- run: sed -i -e '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 -i -e
'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
# bundle and bundler are “gem” shims that try to invoke rubygems magic
# to figure out which bundler etc. to run. However this is not what we
# need since we are a specifically packages rubygems version and only
# want to use ourselves.
# REF https://github.com/pkgxdev/pantry/issues/4010
- run: |
for tool in bundle bundler; do
rm $tool
cp $PROP $tool
done
prop: |
#!/bin/sh
d="$(cd "$(dirname "$0")"/.. && pwd)"
export RUBYLIB="$d/lib"
exec "$d"/gems/bundler-*/exe/bundle "$@"
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
- run:
echo "$(cat $PROP gem)" > gem
prop: |
#!/bin/sh
RUBYLIB="$(cd "$(dirname "$0")"/../lib && pwd)" exec ruby "$0" "$@"
working-directory:
${{prefix}}/bin
# 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
- run: |
mv $FIXTURE Gemfile
bundle install --path vendor/bundle
fixture: |
source 'https://rubygems.org'
gem 'warbler', platforms: :jruby
provides:
- bin/bundle
- bin/bundler
- bin/gem