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

Ability to have a global gemset #16

Closed
joefiorini opened this issue Oct 18, 2011 · 6 comments
Closed

Ability to have a global gemset #16

joefiorini opened this issue Oct 18, 2011 · 6 comments

Comments

@joefiorini
Copy link
Collaborator

Every time I create a new gemset the first thing I have to do is gem install bundler. I also have to cd to my home directory any time I want to run something already installed but not in a gemset. I started adding a global gemset (similar to the RVM implementation) but thought it might be better to just keep the non-gemset path in GEM_PATH. I can see advantages and disadvantages to both approaches. Do you have a preference on this, Jamis? I'm happy to implement and send a pull request.

@matthewlehner
Copy link

Just specify a global gemset in your home directory .rbenv-gemsets file - like so:

$ echo global > ~/.rbenv-gemsets
$ gem install bundler
$ cd my-project
$ echo "my-project-gemset global" > .rbenv-gemsets
$ bundle install

I had to run rbenv rehash to make this work, but I think that's because of the bundler plugin I'm using to specify the correct executables for the gemset.

@jamis
Copy link
Collaborator

jamis commented Oct 25, 2011

I'm a little reluctant to add the concept of a "global" gemset, because I fear it'll require special cases and general ugliness. I like @matthewlehner's suggestion, because it should "just work". That said, I'm not opposed to the feature itself. If you can make a built-in "global gemset" work without too much ugliness, I'd consider it.

@joefiorini
Copy link
Collaborator Author

I was able to make @matthewiehner's suggestion work, so I'll try that for a while and see how it works. Thanks!

@callahad
Copy link

callahad commented Nov 3, 2011

What if "global" was simply repurposed to point to gems installed outside of any given gemset, which is an already extant, standard location? This would mimic the use of the "system" keyword in rbenv itself, and could resolve to the active ruby's native gemdir, as reported by gem environment gemdir.

For instance, a gemsets file containing myproject global might yield a $GEM_PATH including
…/ruby-1.8.7-p352/gemsets/myproject and …/ruby-1.8.7-p352/lib/ruby/gems/1.8.

It keeps everything opt-in, uses standard paths, and as far as I can tell, would only require a small change to the line that sets $path in etc/rbenv.d/exec/gemset.bash.

Would that be sufficiently clean?

@jamis
Copy link
Collaborator

jamis commented Nov 5, 2011

That's kind of the special-case thing I was talking about, which makes me uncomfortable. However, if you want to take a stab at it and submit a pull request, we could use that as a basis for discussion. I'm definitely not opposed to the idea of a global gemset; I'm just concerned that the increased cost of maintenance might outweigh the benefit.

@joefiorini
Copy link
Collaborator Author

I've been having great luck with @matthewlehner's suggestion. I have a .rbenv-gemsets file in ~ that just has "global" in it. Then all my project gemset files have "project-name global". I wrote a shell script to ensure I never forget the global gemset:

write-gemset () {
    echo "$1 global" > .rbenv-gemsets
}

jf added a commit that referenced this issue Jan 19, 2015
auto-inclusion of the *specially-reserved and named gemset called "global".

*(For the history and timeline of this feature (also known as "the gemset
known as 'global'"), see #16, #18, and #20.)

Closes #59.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants