Skip to content

Commit

Permalink
fix: create bundle config on install path (#8)
Browse files Browse the repository at this point in the history
* fix: create bundle config on install path

* docs: add resolution for updating ruby version
  • Loading branch information
ronnnnn authored Aug 6, 2024
1 parent d45de04 commit b432238
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,33 @@ pod --version
Check [asdf](https://github.com/asdf-vm/asdf) readme for more instructions on how to
install & manage versions.

# Troubleshooting

## Incompatibility Errors After Updating Ruby
If you encounter errors like the following after updating your Ruby version and running `pod`, it's likely due to a dependency mismatch:

```
~/.asdf/installs/cocoapods/1.15.2/vendor/bundle/ruby/3.3.0/gems/bigdecimal-3.1.4/lib/bigdecimal.rb:4:in `require': linked to incompatible ~/.asdf/installs/ruby/3.3.3/lib/libruby.3.3.dylib - ~/.asdf/installs/cocoapods/1.15.2/vendor/bundle/ruby/3.3.0/gems/bigdecimal-3.1.4/lib/bigdecimal.bundle (LoadError)
```

CocoaPods uses Bundler to manage its dependencies. When you change Ruby versions, you need to redownload these dependencies to ensure compatibility.

### Resolution

1. Navigate to your CocoaPods installation directory:

```bash
cd ~/.asdf/installs/cocoapods/{version} # Replace {version} with your installed version
```

2. Redownload and reinstall the dependencies:

```bash
bundle install --redownload
```

Now you should be able to run `pod` commands without errors.

# Contributing

Contributions of any kind welcome! See the [contributing guide](contributing.md).
Expand Down
12 changes: 8 additions & 4 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ install_version() {
mkdir -p "$install_path"
cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path"

local tool_cmd
tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)"
local working_path=$(pwd)

bundle config set path "vendor/bundle"
bundle install --gemfile="$install_path/Gemfile"
cd "$install_path"
bundle config --local path "vendor/bundle"
bundle install

cd "$working_path"

local tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)"

test -x "$install_path/bin/$tool_cmd" || fail "Expected $install_path/bin/$tool_cmd to be executable."

Expand Down

0 comments on commit b432238

Please sign in to comment.