Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions scip_indexer/autoindex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ while [[ $# -gt 0 ]]; do
done

initialize_sorbet() {
echo "group :development do
gem 'tapioca', require: false
end" >> Gemfile

bundle install
bundle exec tapioca init
}

initialize_package() {
gem install "$GEM_NAME" -v "$GEM_VERSION"

# Assume that current directory is the gem root.
Expand All @@ -35,12 +44,17 @@ initialize_sorbet() {
| sed -E 's|^gem|source "https://rubygems.org"\ngem|' \
> Gemfile

echo "group :development do
gem 'tapioca', require: false
end" >> Gemfile
initialize_sorbet
}

bundle install
bundle exec tapioca init
check_index_and_exit() {
if [ -f "index.scip" ]; then
echo "Emitted index.scip successfully."
exit 0
else
echo "Failed to emit index.scip."
exit 1
fi
}

# FIXME: Modify the global gem sources list to use the configured host
Expand All @@ -58,10 +72,10 @@ if [ -n "${IS_PACKAGE_REPO:-}" ]; then
if [ -z "${GEM_VERSION:-}" ]; then
GEM_VERSION="$(grep ' version:' rubygems-metadata.yml | head -n 1 | sed -e 's/ version: //')"
fi
initialize_sorbet
set +e
initialize_package
scip-ruby . --gem-metadata "$GEM_NAME@$GEM_VERSION"
exit 0
check_index_and_exit
fi

if [ -f "sorbet/config" ]; then
Expand All @@ -71,15 +85,16 @@ if [ -f "sorbet/config" ]; then
else
scip-ruby
fi
exit 0
check_index_and_exit
fi


set +e
initialize_sorbet
# Can remove this once the 'default to using .' problem in
# https://github.com/sourcegraph/scip-ruby/issues/133 is fixed.
if [ -n "${GEM_NAME:-}" ] && [ -n "${GEM_VERSION:-}" ]; then
scip-ruby . --gem-metadata "$GEM_NAME@$GEM_VERSION"
else
scip-ruby .
fi
check_index_and_exit