developer-portal / content

Content for the Fedora Developer Portal
https://developer.fedoraproject.org/
GNU General Public License v2.0
106 stars 248 forks source link

gem installations for user by default #423

Closed renich closed 2 years ago

renich commented 2 years ago

Added a method of asking rubygem to install it's gems to the user directory by default. Also added a suggestion to add the bin directory to the user's PATH.

jackorp commented 2 years ago

Hi, thanks for your contribution.

I am not sure why is this needed. With Fedora's Ruby, gems are automatically installing "locally" for a user as opposed to system-wide.

I am also not sure about the bin path. When I install a gem (e.g. rspec) in a "fresh install" RubyGems generates executables that run the gem into the ~/bin/ directory and we do not need to add that into $PATH, default bashrc from the bash package has these lines included:

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

IOW the directory that the gem executables end up in is already handled. But I am not sure if it is handled by other shells.

jackorp commented 2 years ago

Interesting thing: if you create/have a $HOME/.gemrc (empty one suffices), suddenly gems want to get installed system-wide. And the binpath is also different for --user-install under those circumstances...

renich commented 2 years ago

Interesting thing: if you create/have a $HOME/.gemrc (empty one suffices), suddenly gems want to get installed system-wide. And the binpath is also different for --user-install under those circumstances...

I was just going to check that.

What do we do?

jackorp commented 2 years ago

What do we do?

To me, this seems like a bug, since we are not overriding the install options.

Reporting this in Bugzilla against Fedora Ruby would be a start.

I am one of maintainers of Fedora Ruby, I can report it and take a look later.

jackorp commented 2 years ago

As to this PR's content, this does not seem like a bad idea.

I think that the more appropriate section would be IMO gems-installation.md as that part deals with gems.

And adjusting RubyGems behavior might be desirable whether you are running Ruby installed through DNF or rbenv or whatnot.

renich commented 2 years ago

OK. I will move it to that then.

renich commented 2 years ago

:S I got lost as well...

renich commented 2 years ago

Of course @jackorp. Sorry, I got lost with all the changes, heh. I'll fix it right away.

jackorp commented 2 years ago

LGTM. Thanks!