Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite chruby-fish in fish #39

Merged
merged 19 commits into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from 18 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
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ os:
# - linux
- osx

osx_image: xcode8.3
osx_image: xcode11.3

env:
global:
- HOMEBREW_NO_AUTO_UPDATE=1
matrix:
- FISH_VERSION="--HEAD"
- FISH_VERSION="" # 2.5.0
- FISH_VERSION="" # 3.1.0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably a good idea to add a note to the README about the minimum supported Fish version, given that we're now using some built-in functions that only became available in later versions of Fish.

I'm fine with setting the minimum supported version to the latest stable release of Fish. If others find that things work on their version, I'd accept PRs reducing the minimum supported version based on their feedback.


language: c

Expand All @@ -22,8 +22,8 @@ install:
- fish --version

before_script:
- travis_wait rm -rf $HOME/.rvm $HOME/.rvmrc
- __rvm_unload
- sudo rm -rf ~/.rvm
- make test/opt/rubies
- ls -lah /Users/travis/build/JeanMertz/chruby-fish/test/opt/rubies/

Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## UNRELEASED

## v1.0.0-beta.1

Rewrite in fish, stop relying on bash chruby.
bouk marked this conversation as resolved.
Show resolved Hide resolved

**Fixes**

- Fix [#31](https://github.com/JeanMertz/chruby-fish/issues/31)
- Fix [#37](https://github.com/JeanMertz/chruby-fish/issues/37)
- Fix [#39](https://github.com/JeanMertz/chruby-fish/issues/39)

## v0.8.2 (2018-09-15)

**Fixes**
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME=chruby-fish
VERSION=0.8.2
VERSION=1.0.0
AUTHOR=JeanMertz
URL=https://github.com/$(AUTHOR)/$(NAME)

Expand Down
33 changes: 8 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

[![Build Status](https://travis-ci.org/JeanMertz/chruby-fish.svg?branch=master)][ci]

Thin wrapper around [chruby][] to make it work with the [Fish shell][]
`chruby` re-implemented for the [Fish shell][].

## install

**note** that `chruby-fish` is dependent on `chruby`, please
[install it first][].
## Install

```bash
wget -O chruby-fish-0.8.2.tar.gz https://github.com/JeanMertz/chruby-fish/archive/v0.8.2.tar.gz
tar -xzvf chruby-fish-0.8.2.tar.gz
cd chruby-fish-0.8.2/
sudo make install
make install
```

### Homebrew
Expand All @@ -30,9 +27,6 @@ Or the absolute latest chruby-fish can be installed from source:
brew install chruby-fish --HEAD
```

chruby is installed as a dependency of chruby-fish, if you installed chruby
manually, add the `--without-chruby` flag to the above commands.

### Arch Linux

chruby-fish is included in the [AUR](https://aur.archlinux.org/packages/chruby-fish/):
Expand All @@ -41,22 +35,15 @@ chruby-fish is included in the [AUR](https://aur.archlinux.org/packages/chruby-f
yay -S chruby-fish
```

## configuration
## Fish version support

Add the following line to your `config.fish` file:
This package is tested against HEAD and the latest stable version of fish.

```sh
source /usr/local/share/chruby/chruby.fish
```
## Configuration

To enable auto-switching, also add the `auto.fish` file:

```sh
source /usr/local/share/chruby/auto.fish
```
The `chruby` function is in your autoload path, so you don't need to configure it.

If you use a custom install location for chruby, use the
[`CHRUBY_ROOT` variable][chruby_root] to point in the right direction.
Auto-switching is enabled by default, set CHRUBY_AUTO_DISABLE=1 if you don't want that.

For more general instructions, see the [chruby documentation][].

Expand Down Expand Up @@ -89,10 +76,6 @@ THE SOFTWARE.
```

[ci]: https://travis-ci.org/JeanMertz/chruby-fish
[gittip]: https://www.gittip.com/JeanMertz
[chruby]: https://github.com/postmodern/chruby
[fish shell]: https://fishshell.com
[install it first]: https://github.com/postmodern/chruby#install
[homebrew]: https://brew.sh/
[chruby_root]: https://github.com/JeanMertz/chruby-fish/blob/ad62361884941067485df6c417959cdc2a42c182/share/chruby/chruby.fish#L33-L34
[chruby documentation]: https://github.com/postmodern/chruby#chruby
75 changes: 0 additions & 75 deletions share/chruby/auto.fish

This file was deleted.

176 changes: 0 additions & 176 deletions share/chruby/chruby.fish

This file was deleted.

20 changes: 20 additions & 0 deletions share/fish/vendor_conf.d/chruby_auto.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function chruby_auto -e fish_prompt
test "$CHRUBY_AUTO_DISABLE" = 1; and return
set -l dir $PWD/
while test -n "$dir"
set dir (string split -r -m1 / $dir)[1]
if test -f "$dir/.ruby-version"; and read -l ruby_version <"$dir/.ruby-version"
if test $ruby_version = "$RUBY_AUTO_VERSION"
return
end
set -g RUBY_AUTO_VERSION $ruby_version
chruby $ruby_version
return $status
end
end

if test -n "$RUBY_AUTO_VERSION"
chruby_reset
set -e RUBY_AUTO_VERSION
end
end
Loading