Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Bundler to @global gemset under RVM and is it a correct way

I am on OS X (if it matters).

If I install a Ruby using RVM, it will install Bundler by default to @global gemset

Let say I want a different version of the bundler. I assumed that all I needed to do is to execute

gem install bundler --version <SomeVersion>

However, this will install bundler to default gemset and RVM doesn't set a PATH to it.

As result, if I type bundler it will still launch a bundler which was installed with Ruby into @global

Two questions:

  • How can I install bundler to @global gemset.
  • Is this correct pattern to install bundler into @global gemset or I am missing something
like image 354
Victor Ronin Avatar asked Mar 05 '15 16:03

Victor Ronin


People also ask

How do you install a bundler?

Install BundlerSelect Tools | Bundler | Install Bundler from the main menu. Press Ctrl twice and execute the gem install bundler command in the invoked popup. Open the RubyMine terminal emulator and execute the gem install bundler command.

What is RVM Gemset?

RVM gives you compartmentalized independent ruby setups. This means that ruby, gems and irb are all separate and self-contained - from the system, and from each other. You may even have separate named gemsets. Let's say, for example, that you are testing two versions of a gem, with ruby 2.1.

How do I change my default bundler?

gem env – try to search in provided list under GEM PATHS, in specifications/default. remove there bundler-VERSION. gemspec. install bundler, if you don't have specific: gem install bundler:VERSION --default.

How does bundler work in Ruby?

Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. Bundler is an exit from dependency hell, and ensures that the gems you need are present in development, staging, and production. Starting work on a project is as simple as bundle install .


1 Answers

This is how you can install bundler in the global gemset:

rvm @global do gem install bundler

as a practice, I don't see any issue, since bundler is never part of the gemfile in any case.

One glitch to note, if you have projects running multiple rails and ruby version (as old as 1.8.7 and rails 2.x) using newer bundler is not backwards compatible, so you'll be forced to use multiple bundler versions.

like image 88
JAR.JAR.beans Avatar answered Sep 19 '22 13:09

JAR.JAR.beans