jf / rbenv-gemset

KISS yet powerful gem / gemset management for rbenv
669 stars 48 forks source link

Explixitly disable global gemset #59

Closed mrhead closed 9 years ago

mrhead commented 10 years ago

Is it possible to use just local gemset?

I have this issue:

[master][~/ruby/notes] rbenv gemset active
.gems global
[master][~/ruby/notes] ll .gems/gems
total 0
drwxr-xr-x   6 head  staff  204 Jan  2 21:36 .
drwxr-xr-x  11 head  staff  374 Jan  2 21:39 ..
drwxr-xr-x  11 head  staff  374 Jan  2 21:36 rspec-core-2.14.6
drwxr-xr-x  10 head  staff  340 Jan  2 21:36 rspec-expectations-2.14.3
drwxr-xr-x  10 head  staff  340 Jan  2 21:36 rspec-mocks-2.14.4
drwxr-xr-x  11 head  staff  374 Jan  2 21:36 rspec-rails-2.14.0
[master][~/ruby/notes] rspec
...
/Users/head/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.5.1/lib/bundler/runtime.rb:34:in `block in setup': You have already activated mime-types 1.25.1, but your Gemfile requires mime-types 1.25. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)

When I run bundle install it writes that everything is installed. But obviously it is installed just in the global gemset.

I think that it should be possible to disable global gemset somehow. bundle exex rspecworks for me, but I think that goal of using gemsets is to avoid it (and that is my goal).

Or is there some other solution to this issue?

jf commented 10 years ago

So let me be clear here: your Gemfile "requires mime-types 1.25"; but bundler doesn't recognize that, and doesn't do anything about that during bundle install?

jf commented 10 years ago

hey @mrhead, it looks like this might be a duplicate of some other errors that we're seeing; but unless you reproduce the contents of your Gemfile, there's no way of knowing.

One special note: I'd appreciate it if you would just drop that "cute-speak". This is neither funny... nor cute in any way. And it isnt proper English.

mrhead commented 10 years ago

Hello @js,

I am sorry I missed your previous reply.

Regarding your note: I am sorry if I was offensive, or something, but I am not native english speaker and I have no idea what do you mean with "cute-speak". If there is anything wrong in my speak, please point it out directly so I can omit it in the future.

Back to my issue. Here are my files:

# Gemfile
source 'https://rubygems.org'
ruby '2.1.0'

gem 'rails', '4.0.0'
gem 'jquery-rails', '~> 2.2.1'
gem 'bootstrap-sass', '~> 2.3.1.0'
gem 'rails_autolink'
gem 'pg'

group :assets do
  gem 'sass-rails',   '~> 4.0.0'
  gem 'coffee-rails', '~> 4.0.0'
  gem 'uglifier', '>= 1.0.3'
end

group :development, :test do
  gem 'rspec-rails'
  gem 'factory_girl_rails'
  gem 'spork-rails', git: 'http://github.com/railstutorial/spork-rails.git'
end

group :development do
  gem 'annotate'
  gem 'faker'
  gem 'spring'
end

group :test do
  gem 'capybara'
  gem 'launchy'
  gem 'capybara-webkit'
  gem 'database_cleaner'
end

group :production do
  gem 'rails_12factor'
end

gem 'turbolinks', '~> 1.1.1'
# Gemfile.lock
GIT
  remote: http://github.com/railstutorial/spork-rails.git
  revision: 5db525af2f917047057f546bc1ac2574d1c6b11e
  specs:
    spork-rails (3.2.1)
      spork (>= 1.0rc0)

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.0.0)
      actionpack (= 4.0.0)
      mail (~> 2.5.3)
    actionpack (4.0.0)
      activesupport (= 4.0.0)
      builder (~> 3.1.0)
      erubis (~> 2.7.0)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    activemodel (4.0.0)
      activesupport (= 4.0.0)
      builder (~> 3.1.0)
    activerecord (4.0.0)
      activemodel (= 4.0.0)
      activerecord-deprecated_finders (~> 1.0.2)
      activesupport (= 4.0.0)
      arel (~> 4.0.0)
    activerecord-deprecated_finders (1.0.3)
    activesupport (4.0.0)
      i18n (~> 0.6, >= 0.6.4)
      minitest (~> 4.2)
      multi_json (~> 1.3)
      thread_safe (~> 0.1)
      tzinfo (~> 0.3.37)
    addressable (2.3.5)
    annotate (2.5.0)
      rake
    arel (4.0.0)
    atomic (1.1.14)
    bootstrap-sass (2.3.1.3)
      sass (~> 3.2)
    builder (3.1.4)
    capybara (2.1.0)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    capybara-webkit (1.0.0)
      capybara (~> 2.0, >= 2.0.2)
      json
    coffee-rails (4.0.0)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0.beta, < 5.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.6.3)
    database_cleaner (1.2.0)
    diff-lcs (1.2.4)
    erubis (2.7.0)
    execjs (2.0.2)
    factory_girl (4.2.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.2.1)
      factory_girl (~> 4.2.0)
      railties (>= 3.0.0)
    faker (1.2.0)
      i18n (~> 0.5)
    hike (1.2.3)
    i18n (0.6.5)
    jquery-rails (2.2.2)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.0)
    launchy (2.3.0)
      addressable (~> 2.3)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.25)
    mini_portile (0.5.1)
    minitest (4.7.5)
    multi_json (1.8.2)
    nokogiri (1.6.0)
      mini_portile (~> 0.5.0)
    pg (0.17.0)
    polyglot (0.3.3)
    rack (1.5.2)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (4.0.0)
      actionmailer (= 4.0.0)
      actionpack (= 4.0.0)
      activerecord (= 4.0.0)
      activesupport (= 4.0.0)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.0.0)
      sprockets-rails (~> 2.0.0)
    rails_12factor (0.0.2)
      rails_serve_static_assets
      rails_stdout_logging
    rails_autolink (1.1.4)
      rails (> 3.1)
    rails_serve_static_assets (0.0.1)
    rails_stdout_logging (0.0.3)
    railties (4.0.0)
      actionpack (= 4.0.0)
      activesupport (= 4.0.0)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.1.0)
    rspec-core (2.14.6)
    rspec-expectations (2.14.3)
      diff-lcs (>= 1.1.3, < 2.0)
    rspec-mocks (2.14.4)
    rspec-rails (2.14.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 2.14.0)
      rspec-expectations (~> 2.14.0)
      rspec-mocks (~> 2.14.0)
    sass (3.2.12)
    sass-rails (4.0.1)
      railties (>= 4.0.0, < 5.0)
      sass (>= 3.1.10)
      sprockets-rails (~> 2.0.0)
    spork (1.0.0rc4)
    spring (1.0.0)
    sprockets (2.10.0)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.0.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (~> 2.8)
    thor (0.18.1)
    thread_safe (0.1.3)
      atomic
    tilt (1.4.1)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    turbolinks (1.1.1)
      coffee-rails
    tzinfo (0.3.38)
    uglifier (2.2.1)
      execjs (>= 0.3.0)
      multi_json (~> 1.0, >= 1.0.2)
    xpath (2.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  annotate
  bootstrap-sass (~> 2.3.1.0)
  capybara
  capybara-webkit
  coffee-rails (~> 4.0.0)
  database_cleaner
  factory_girl_rails
  faker
  jquery-rails (~> 2.2.1)
  launchy
  pg
  rails (= 4.0.0)
  rails_12factor
  rails_autolink
  rspec-rails
  sass-rails (~> 4.0.0)
  spork-rails!
  spring
  turbolinks (~> 1.1.1)
  uglifier (>= 1.0.3)

And some additional output:

[master][~/ruby/notes] cat .rbenv-gemsets
./gems
[master][~/ruby/notes] rbenv gemset list
2.1.0:
  /Users/head/ruby/notes/.gems  (shifted or removed)
[master][~/ruby/notes] rbenv gemset active
./gems global

To be honest I am not sure how exactly it should work. But I would expect that all my gems are installed in my projects gems directory. Therefore I do not need to care if there are more versions of some gem for some other project.

Right now if I just run rspec then it fails:

[master][~/ruby/notes] rspec
No DRb server is running. Running in local process instead ...
WARN: Unresolved specs during Gem::Specification.reset:
      mini_portile (~> 0.5.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/Users/head/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.5.1/lib/bundler/runtime.rb:34:in `block in setup': You have already activated mime-types 1.25.1, but your Gemfile requires mime-types 1.25. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
        from /Users/head/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.5.1/lib/bundler/runtime.rb:19:in `setup'
        from /Users/head/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.5.1/lib/bundler.rb:119:in `setup'
...

It fails because there are more versions in global gemset. For me it looks that it has issues with some newer version of mime-types which is most probably used in some of my other projects.

But when I run bundle exec rspec, then everything is working well.

Is this correct behaviour or not? As I said, I would expect to have everything in my local gemset so I do not need to care about content of global gemset...

Also if there is any additional output which you need do not hesitate to ask for it.

Many thanks

jf commented 10 years ago

thanks, @mrhead . So I get that you dont speak English natively. But to point out the issue that I had a problem with: using 'x' instead of 'c' in various places in your first post... The subject, for instance: 'Explixitly disable ...' And then even in a command (bundle exex ..., which couldn't have been legal syntax). My apologies if I mistook you for doing it on purpose.

Now regarding the problem: thanks for the info - including that additional info that you thoughtfully volunteered as well. It seems like this is a problem that a few others have encountered as well. Can you give me the output for the following? 1. gem list 2. change the contents of .rbenv-gemsets to just global, and then do gem list again.

jf commented 10 years ago

hey @mrhead , were you formerly using .gems as your gemset... and then later switched to using ./gems instead? I dont think this is the cause of your problem, but you havent done a rbenv rehash since, and it would be good for you to do so.

mrhead commented 10 years ago

Hello @jf ,

I am sorry but meanwhile I've removed gemsets from my project and I did not save it (not even to its own branch). I've tried rbenv rehash before, but it did not help.

Feel free to close this issue if you do not have enough information.

Many thanks for your time.

lazywei commented 10 years ago

+1 for this I would like to know how to disable global gems.

ingemar commented 10 years ago

+1 for this I would like to know how to disable global gems

jf commented 10 years ago

Ok. I am not really against this but... do tell me more. Why, @lazywei and @Ingemar?

tombell commented 10 years ago

I would like the option to disable the global gemset because my local gemsets are specific to the local project, I do not want global gems leaking into that local environment.

I commonly install gems providing CLI tools into the global ruby install which are not generally local project development related. Everything the project requires will be installed into the local gemset.

neovatar commented 10 years ago

+1 from me (I really, really second this feature)

I have exactly the same situation as @tombell

Edited comment to be in line with my commit:

rbenv-gemset is a tool for clearly defined gemsets, so no gemset should be automagically "enforced" on the user. If the user really wants the global gemset included, it's easy to do so by including 'global' gemset in either the .rbenv-gemsets file or in the RBENV_GEMSETS env variable. rbenv-gemset can be used to keep seperated clean gem environments inside of projects, while having installed global gems for day to day work. Automatically including the global gemset "pollutes" the clean project specific gemsets.

Feel free to use my code. I can also create a pull request if you want.

jf commented 10 years ago

Ok, folks, I've mentioned this before (in another issue), but for the sake of everybody, I will repeat the history of things as far as how this global gemset thing came about. Chronologically, it goes like this: #16, #18, and #20.

I personally hate any sort of enforcement as well; so I get that argument. However, this was before my time, and now that the feature has been introduced, and rbenv-gemset is in actual wide use (and is actually useful, despite what some others say!).... I would prefer to find a way to make things easier for any upgraders. Until we come to a major version bump. So my own approach right now would be to introduce a special -global name to the .rbenv-gemsets file to basically say "no global gemset!". I trust that this would work for everybody here?

I would like to give a special shoutout to @neovatar, btw. Thanks for taking the initiative to submit a patch! I was just about to call for one....

neovatar commented 10 years ago

Good Idea, but I would do it the other way around (actually keeping it similar to the way it was): If you need the global gemset, specify a gemset (like global). IMHO the point of rbenv-gemset is, that you normally want to use "encapsulated" gemsets, isolated from your global gemset. Including the global gemset as default, defeats that purpose.

I would vote for excluding the global gemset by default and giving an option to include it (like putting a 'global' line into the .rbenv-gemsets file). Then update the documentation, to make it clear how to include the global gemset. I can do a pull request for the updated doc if you want. I get your concern about upgraders, which is what a good maintainer always needs to do. But introducing a new "special" gemset to remove the global one is no a very good solution in my opinion. It would add unneeded complexity to usage and to code.

Side note: I also commented on your concerns because I removed the Jruby workaround, it is not needed anymore, I did test with a manually installed Jruby 1.7.11.

I am attaching a pull request with my updated code, just see it as a possible solution you could use.

jf commented 10 years ago

Ok, let's address the issue of the global gemset first. Who here actually has a gemset named global?

neovatar commented 10 years ago

I do not have an actual gemset named global, since it was considered special and I only used it if I wanted to include my globally installed gems.

jf commented 10 years ago

Ok. There are a few things that I'll need to clarify:

  1. global is just like any other gemset (that you create)! In fact, to make use of gemset global, you have to specially create it yourself! global was just this specific name that ended up getting picked for this particular gemset that you have to install gems into or else it doesn't matter one iota, that gets appended whenever you have a gemsets file. Don't believe me? Take a look at #16, #18, and #20.
  2. Just as rbenv-gemset is meant for partitioning your gems, you should be responsible for managing how and where your gems are installed. If you happen to end up installing gems into your standard gem path (which is the gem env gemdir) that you dont want to be available everywhere, then you should remove those gems, and put those gems somewhere else. rbenv-gemsets allows you to have multiple gemsets! (To remove those gems, simply remove your gemsets file, and then do a gem uninstall.)
  3. I'm not going to cause rubinius to fail (see #53). And I dont really see anybody having any problems with the standard gems that come with ruby already. As an example, for ruby 2.1.1, these would be the following:
$ gem list

*** LOCAL GEMS ***

bigdecimal (1.2.4)
io-console (0.4.2)
json (1.8.1)
minitest (4.7.5)
psych (2.0.3)
rake (10.1.0)
rdoc (4.1.0)
test-unit (2.1.1.0)

Is anybody having any conflicts with these gems?

neovatar commented 10 years ago

ad 1.: Ok, I thought that global did reference the default gem path but the code show that it actually uses a global gemset. I think the way my patch works is closer to the thing what people tried to achieve with the original global gemset.

ad 2.: I really disagree here, taken from the Docs:

"rbenv-gemset is an extension for the rbenv ruby version manager that allows you to use "gemsets", sandboxed collections of gems. This lets you have multiple collections of gems installed in different sandboxes, and specify (on a per-application basis) which sets of gems should be used." Maybe I do misunderstand the "spirit" of rbenv-gemset here or do use it in a wrong way?

ad 3.: I did not think of rubunius, because I don not use it. I will test my patch against it.

Ok, I am seeing, that my patch does change the behaviour of the original global, so it is not optimal. I will think of an alternative solution.

jf commented 10 years ago

You've misunderstood what global is, @neovatar. I hope nobody else has (and if they have, I guess I cant blame them, seeing as how no documentation was written for this), but I'll need everybody who wants to weigh in on this issue to first understand and address my 3 points above (https://github.com/jf/rbenv-gemset/issues/59#issuecomment-38264174).

In addition, here's a 4th point to ponder:

Can rbenv-gemset stop you if you choose to install a gem without a gemset setup yet? (this is the case where it will -- because hey, this is a ruby! -- by default, go to the standard location as defined by your installed ruby). Should it?

neovatar commented 10 years ago

Ok I have redone the whole thing and added the possibility to use an .rbenv-gemset-options file to set options. I added an option to make it possible to disable the global gemset and an option to exclude the default gem path. It is backward compatible, since it does not change rbenv-gemset default behaviour, but gives the possibility to configure it in case its needed. Also it makes it possible to use configuration options for more advanced stuff should the need arise in the future.

Pullrequest: https://github.com/jf/rbenv-gemset/pull/66

What do you think of this solution?

jf commented 10 years ago

hmmm... do we really need to have another dot file? is this complicating things a bit?

neovatar commented 10 years ago

I thought about this for a while, but it seems it is the best option - even more if you want to stay backward compatible.

With the .rbenv-gemset.options file you could easily put the .rbenv-gemset-options file in your home dir and all projects below your home dir would use these extended settings. I am already using this in production right now.

jf commented 10 years ago

With the .rbenv-gemset.options file you could easily put the .rbenv-gemset-options file in your home dir and all projects below your home dir would use these extended settings. I am already using this in production right now.

The .rbenv-gemsets file already behaves this way, so I dont see your point here. Good to hear that you use your own code in production. I dont have to, and I'm not going to impose this on others.

neovatar commented 10 years ago

Yes, but .rbenv-gemsets only has a very simple format: Each line represents a gemset. If you would add some special options to this file, it would not be backwards compatible. Would that be a change that you want to do?

I didn't want to put pressure on you, when I said that I am using the code in production and I do not want to force it on either you or the rest of the rbenv-gemset users. I was just suggesting a solution to an issue some people are having. I am sorry, if I did leave another impression.

Do you have an alternate solution to this problem?

neovatar commented 10 years ago

Another idea: rbenv-bundler uses a directory to store some plugin states, e.g.:

touch -- "${plugin_root_dir}/share/rbenv/bundler/disabled"

(https://github.com/carsomyr/rbenv-bundler/blob/master/bin/rbenv-bundler)

You think that would be a better way to store rbenv-gemset settings? It would not use another dot file and it would be be backwards compatible. I can create a pull request, but I like to hear your opinion first.

jf commented 10 years ago

Hey @neovatar , sorry about the delay. I am of the opinion that we are overcomplicating things too far in advance. We have the one .rbenv-gemsets (or .ruby-gemset) file; the one true source of info, to find them all, and in the darkness bind them... This one true ring, I mean file, should suffice for now. You know exactly where you need to go to get info, or change things. I dont want to spread things out any more than this.

If you want to submit a patch, I'd appreciate it, but pls do so with the goal of adhering to the format I've stated. My thoughts (and I would really like for others to chime in here as well) are to go with the literals -global, and -standard in the gemset file, to disable the inclusion of the specially-reserved and named "global" gemset, and the default gem install dir (gem env gemdir) respectively.

neovatar commented 10 years ago

I still think a dedicated config file for those "special" options would be a good way to go, but I understand your single file policy. I will try too cook up something the next days.

bekicot commented 10 years ago

Hi @neovatar I think i like your implementation of sandboxing gem on each project is pretty good. Do you have working fork on this ? Actually i was miss understood on .rbenv-gemsets till in recent days when i creating a new rails project and when i run rake db:migrate bundler beg me to use bundle exec. I though the gem was sandboxed and it isn't. It still uses the global gems.

neovatar commented 10 years ago

Hi @bekicot + @jf! Sorry for the long delay, I was quite busy with work. I have an working fork for the sandboxing feature implemented in the way @jf suggested.

I referenced a commit in my fork, @jf can you check please, whether it meets your standards?

jf commented 10 years ago

hey sorry folks and @neovatar. My main system went down for a while (it's still down, actually), and I've had to take care of some other things. I'll try to comment very quickly in a short while.

neovatar commented 10 years ago

Welcome back @jf! I know your pain. My main rigs GFX card burned out yesterday...

I read your comments and updated the code.

neovatar commented 10 years ago

Sorry for the number of references, I will create a pull request to make code review more easy for you.

Pull request: https://github.com/jf/rbenv-gemset/pull/70

bekicot commented 10 years ago

@neovatar && @jf Thanks for your hard work. @neovatar I will try your fork after updating to ubuntu 14.04.

jf commented 10 years ago

Duplicating a comment I made for https://github.com/neovatar/rbenv-gemset/commit/697fedd7c09dd3cae1b8ff10084c2ccbe1a5be91:

I had hoped that u could have done better than this. I dont know what this is, but surely u could have known (after all, this is your patch) that simply deleting this would not do? (because the rest of your patch still called this code)

I was waiting to see how long it would take before you would realize this....

tombell commented 10 years ago

Looks like this issue isn't going to be solved, I'm just going to maintain my own fork with the global stuff removed.

The whole idea of gemsets is separation of gems, leaking global gems into these sets completely defies the point of this plugin to begin with.

tombell commented 10 years ago

If anyone subscribed to this issue still wants to disable global gems in local gemsets, I've forked and create a branch in the fork for commenting out the stuff that does the global stuff.

https://github.com:tombell/rbenv-gemset

I'll end up merging upstream changes back into my fork, while keeping the global stuff commented out.

At the end of the day it appears like it is going to be simpler to actively maintain a fork than reach some compromise for the "official" copy.

dlovellrw commented 9 years ago

My purpose in using rbenv-gemset is to have a clean set of gems in the project directory installed specifically for the project. My purpose is not to overlay in the project gems additional to some set installed elsewhere (global or otherwise). I'm using the @tombell fork. (In spite of the profane name, which about sums it up anyway.)

You can pick on me for my housecleaning of gemsets in parent directories; but, hey software can be hard enough without having to run down development environment quirks or differences. The fork allows me to cleanly nail down the gems in use for the project without any fuss or worry. +1 Thank you, Tom.

jf commented 9 years ago

Yup, @dlovellrw. I've remained silent for a long time but... I will work on it this weekend.

bekicot commented 9 years ago

Thanks @jf . We appreciate your hard work. Keep Up the good work :) .

jf commented 9 years ago

So guys, add "-global" to your gemsets file, and you won't have any gems from the "global" gemset anymore. This may become the default for the future, but we'll see....

mrentz commented 6 years ago

@jf Thanks for helping out here.

I think I'm totally out of my depth here but, what is the purpose of having a local gemset if the "global" set of gems get used anyway?

i.e.
$rbenv gemset active tempest

and then gem list lists all of the globally installed gems?

I must be missing something. Sorry if this is not making sense

mrentz commented 6 years ago

Oh yes my project specific .rbenv-gemsets file

tempest -global

Am I going "bonkers"? I can not install any of the gems that are already installed in global. I want to modify a gem and test it without breaking all of the other projects. Isn't that what the whole idea of gemsets would be for?

Surely I must be missing something.

Can anyone set me straight on this? Gemsets seem like a good concept.

jf commented 5 years ago

hi @mrentz, sorry for the (super!) late reply. I only just noticed this.

@jf Thanks for helping out here.

I think I'm totally out of my depth here but, what is the purpose of having a local gemset if the "global" set of gems get used anyway?

i.e. $rbenv gemset active tempest

and then gem list lists all of the globally installed gems?

(NOTE: please read https://github.com/jf/rbenv-gemset/issues/59#issuecomment-38264174 first so that we are both using the same terms the same way. What you call "global" is actually the standard gem path (you can even think of it as a gem set!) that comes set up when you install ruby. This just comes by default when you install ruby; and is not (again, see https://github.com/jf/rbenv-gemset/issues/59#issuecomment-38264174) the global gemset that rbenv-gemset refers to when you do a rbenv gemset active)

I must be missing something. Sorry if this is not making sense

To answer your question, you should be using rbenv-gemset from the time you install a ruby version. This will ensure that you have everything neatly organized in your gemsets the way you want them.

Am I going "bonkers"? I can not install any of the gems that are already installed in global.

(again, note that this isn't exactly "global", but the standard gem path that comes set up when you install ruby)

You actually can. If you temporarily comment out your gemsets in .rbenv-gemsets file, you should be able to "gem uninstall" whatever you need, and then install what you need into separate gemsets.