mirror of
https://github.com/ivabus/pantry
synced 2024-11-22 08:25:07 +03:00
fix use of bundler
as a gem
many little fixes and tweaks here. Requires newer brewkit.
This commit is contained in:
parent
36ba4f26bc
commit
c137ff6003
2 changed files with 40 additions and 23 deletions
|
@ -10,7 +10,7 @@ dependencies:
|
|||
|
||||
runtime:
|
||||
env:
|
||||
RUBYLIB: ${{prefix}}/lib
|
||||
RUBYLIB: ${{prefix}}/lib:$RUBYLIB
|
||||
|
||||
build:
|
||||
dependencies:
|
||||
|
@ -24,12 +24,12 @@ build:
|
|||
--no-rdoc
|
||||
|
||||
- run: |
|
||||
patch -p1 < "$SRCROOT"/props/fit-n-finish.patch
|
||||
patch -p1 < "$SRCROOT"/props/fit-n-finish.1.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
|
||||
sed -ie '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
|
||||
- run: sed -ie 's/Gem.state_home, "gem",/Gem.state_home,/' defaults.rb
|
||||
working-directory: ${{prefix}}/lib/rubygems
|
||||
if: '>=3.4'
|
||||
|
||||
|
@ -41,7 +41,7 @@ build:
|
|||
working-directory: ${{prefix}}
|
||||
if: '>=3.5'
|
||||
|
||||
- run: sed -i -e
|
||||
- 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
|
||||
|
@ -52,34 +52,37 @@ build:
|
|||
- 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.
|
||||
# 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
|
||||
rm $tool
|
||||
cp $PROP $tool
|
||||
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"
|
||||
exec "$d"/gems/bundler-*/exe/bundle "$@"
|
||||
if [ -z "$GEM_PATH" ]; then
|
||||
export GEM_PATH="$d"
|
||||
else
|
||||
export GEM_PATH="$d:$GEM_PATH"
|
||||
fi
|
||||
exec ruby "$0" "$@"
|
||||
working-directory:
|
||||
${{prefix}}/bin
|
||||
${{prefix}}
|
||||
|
||||
# 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
|
||||
# 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
|
||||
|
@ -106,13 +109,27 @@ test:
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue