3

I know i can read it from http://bundler.io, but i have some doubts in my mind.

  1. Is it like npm for NodeJs and Maven for Java/J2EE.
  2. The first command i executed is gem install bundler. What is gem here and What is bundler, can some one enlighten me in terms of NodeJs or Maven.
  3. Where these getting installed?. I don't specify -g like i do in NodeJs for globally.
C:\Users\Shane>gem install bundler
Fetching: bundler-1.5.3.gem (100%)
Successfully installed bundler-1.5.3
Parsing documentation for bundler-1.5.3
Installing ri documentation for bundler-1.5.3
1 gem installed

C:\Users\Shane>gem install sqlite3
Fetching: sqlite3-1.3.9-x86-mingw32.gem (100%)
Successfully installed sqlite3-1.3.9-x86-mingw32
Parsing documentation for sqlite3-1.3.9-x86-mingw32
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/sqlite3/1.8/sql
tive.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/sqlite3/1.9/sql
tive.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/sqlite3/2.0/sql
tive.so, skipping
Installing ri documentation for sqlite3-1.3.9-x86-mingw32
1 gem installed
Shane
  • 5,517
  • 15
  • 49
  • 79
  • 1
    You might find [this](http://stackoverflow.com/questions/4604064/rubygems-bundler-and-rvm-confusion) useful. As for *Ruby*, `gem` is the *RubyGems* command, which is like *npm* for *Node*, but without `package.json` support. Therefore we use the gem *bundler* to manage our dependencies in a `Gemfile` as we would usually define in `package.json`. Then `bundle install` would be the equivalent of `npm install`. – hexacyanide Mar 02 '14 at 17:37
  • Where is the Gemfile located? is the bundle = package.json?. – Shane Mar 02 '14 at 17:46
  • The `Gemfile` is located in the root of your *Ruby* application. – hexacyanide Mar 02 '14 at 18:37

2 Answers2

3

I dont have much knowledge of nodejs or java but can give you some idea.

Is it like npm for NodeJs and Maven for Java/J2EE

Yes, It is somewhat like that npm.Bundler helps to manage application dependency like xyz app requires foo bar gem. gem is like of libraries which extend the app functionality. This gems are primary located in rubygems.org server.

The first command i executed is gem install bundler. What is gem here and What is bundler, can some one enlighten me in terms of NodeJs or Maven.

when you do gem install <gem_name> , it creates a request to rubygems.org and download the repo(gem) and put it in the configured location. The location can be found in gem env command. To get the details of gem, you have to use gem install <gem_name> -d . So, when you are doing gem install bundler, you are installing bundler gem. This gem will help you to resolve/manage/install application dependencies. This is like npm install bundler with npm .

Where these getting installed?. I don't specify -g like i do in NodeJs for globally.

No, there is no need to write -g option here. My default, we install gems in one location which is not inside apps. personally i think transferring all those gems from one computer to another is slightly cumbersome, rather i prefer to run a command which automatically install all dependency. This is where bundler shines. Let say you have an app which requires foo , bar dependency since it uses its functionality. Without bundler, you have install this gems by running gem install foo , gem install bar. But with bundler, you will just do bundle install and you are done.

That's all. This will give you good start.

Paritosh Piplewar
  • 7,982
  • 5
  • 26
  • 41
1

gem install bundler installs a gem(library) that will help you to manage your project dependencies.

Then you have a project that contains a file called Gemfile , when you cd into that directory and enter bundle install it will install all gems needed for that project.

To check where your gems are being installed take a look at the output of gem env.

sites
  • 21,417
  • 17
  • 87
  • 146