Unable to install Rails using Gem

I am new to Ruby on Rails. I was trying to get Ruby on Rails installed.     I am on Windows XP with access to internet through a proxy. I installed Ruby and then Gem. I downloaded both as standalone packages and unzipped them. But when i tried installing Rails through Gem , I got the below error " C:\Program Files\rubygems-1.7.2>gem install rails --version 3.0.1 ERROR: While executing gem ... (Zlib::GzipFile::Error)     not in gzip format " Before I installing Rails through Gem I had set the environment variable HTTP_PROXY and I believe it works fine.

   I am not able to make this work. I was not able to download a standalone package of Rails for the version(3.0.1) I am trying to install.

   Any help / workaround would be appreciated.

P.S. I am unable to understand why the installation has to be only through Gem.

In effect I'd want to install Rails without having an internet connection. Example I may want to install Rails on a production server from where I cannot connect to the internet. Is there a way out?

Thanks in advance, Shafeeq

You can install gems from local copies of the gemfiles using the "-l" option.

Where do I download the Gem files for Rails Version 3.0 and all its dependencies from ? Is there a documentation which describes how to do it?

Any pointers to it? I am unable to locate the standalone packages for Rails 3.

Any pointers to it? I am unable to locate the standalone packages for Rails 3.

Rails 3 is a gem. You get it from Ruby Gems.

http://rubygems.org/gems/rails

Amazing what you find when you do a search.

B.

Thanks Bryan. I was aware that Rails 3 is a gem and that it can be downloaded from http://rubygems.org but I had to download all the dependent gems in a tree like fashion and whose depth I do not know. All this through a browser :(( Is this the only solution for what I am looking for or is there an easier way out.    I know that I may sound a little lazy but I come from J2EE background where I did not have to do all such things.

Thanks, Shafeeq

Bundler's 'package' command does what you're describing here:

http://gembundler.com/bundle_package.html

It'll resolve the gem dependencies for you, fetch the necessary gem files, and then store them inside your project.

Of course, this depends on having an internet connection and a working Rubygems on the machine that you initially run 'bundle package' on. But after that, any other machine can install the dependencies for your app (including rails) without hitting rubygems.org.

Chris

<snip Windows proxy issues>

I am not able to make this work. I was not able to download a standalone package of Rails for the version(3.0.1) I am trying to install.

Any help / workaround would be appreciated.

P.S. I am unable to understand why the installation has to be only through Gem.

The short answer is that the 'rails' package is really just a very small piece of software that specifies several dependencies (i.e other software packages that it requires to run: activerecord, actionpack, etc.). These packages in turn have their own dependencies. As you've discovered, resolving these dependencies by hand is a pain, so we have a package manager specifically for Ruby packages, called Rubygems.

If you're not used to package managers, it seems a bit ridiculous at first -- why can't the software vendor just package up everything necessary for a particular piece of software into one download? It's a very common pattern in open source software distribution (e.g. apt-get in Debian/Ubuntu; pypi for Python) because you might as well make use of shared libraries if you can (no need to redownload Rack five times just because five pieces of software need it), plus it absolves individual software maintainers from having to do all that packaging work every time they release -- they just specify their dependencies and they're done.

(Having said that, I believe there are all-in-one Rails packages available for Windows, but I haven't used any of them for several years, so I don't know what the status of them is. In any case, you'll want to get Rubygems working so that you can install other optional libraries as the needs of your app demand.)

The longer answer is that Ruby's dependence on the Rubygems system is a little controversial in certain circles (e.g. the Debian maintainers). There's no reason that Ruby software packages couldn't be released in a format that also allows for a generic standard installation straight into /usr/local/lib without relying on Rubygems for installation. Of course, you still have the problem of dependency resolution which you'd just have to punt to another system to handle. So unless you are fascinated by the politics of open source package management then you can ignore this paragraph. :slight_smile:

Chris

Chris,    Thanks for the response. I am used to package managers in systems like Ubuntu and understand the benefits of having package managers. But If you want to install a software like say Eclipse or Netbeans in Ubuntu you have the flexibility of doing so either through the package manager or by just unpacking the tarball into a directory of your choice. Its about having an alternative if one of it does not work or just about having the freedom to make a choice.    E.g. : When i am thrown with the below error and since I do not understand the inner working of Rubygems, I am left with no other option : C:\Documents and Settings\AllUsers\Desktop> gem install rails -- version 3.0.1 ERROR: While executing gem ... (Zlib::GzipFile::Error)     not in gzip format I was able to locate 'all in one' rails package until version 2.2.3 at http://rubyforge.org/frs/?group_id=307 but not the newer versions.

Regards, Shafeeq.

Chris,   Thanks for the response. I am used to package managers in systems like Ubuntu and understand the benefits of having package managers. But If you want to install a software like say Eclipse or Netbeans in Ubuntu you have the flexibility of doing so either through the package manager or by just unpacking the tarball into a directory of your choice. Its about having an alternative if one of it does not work or just about having the freedom to make a choice.   E.g. : When i am thrown with the below error and since I do not understand the inner working of Rubygems, I am left with no other option : C:\Documents and Settings\AllUsers\Desktop> gem install rails -- version 3.0.1 ERROR: While executing gem ... (Zlib::GzipFile::Error)    not in gzip format I was able to locate 'all in one' rails package until version 2.2.3 at http://rubyforge.org/frs/?group_id=307 but not the newer versions.

Installing Rails on Windows is a slightly different process than installing it on a *nix based OS. For Windows you will want to go here: http://rubyinstaller.org/ and download their installer for it following the guide they have.

The reason you can't find the latest packages for Rails on rubyforge.org is because they are no longer the official package management site. That is now rubygems.org.

As for dependencies, when you install Rails using the command gem install rails or ruby installer if on windows all the dependency libraries will be downloaded and installed for you. After downloading or installing a gem like rails you can always see all the dependencies for that gem by running gem dependencies <gem name>. Keep in mind that you don't have to install the gem to see it's dependencies. You can learn more by going here: http://docs.rubygems.org/read/chapter/10

B.

I appreciate the time members take to answer my question and help me out. But the answers so far are either not relevant to my question or did not really help me.    The question is quite simple. I want to install Rails 3 on a machine(server) where there is no internet connection. I am allowed only to FTP files to that server. I have installed Ruby and RubyGems on that server machine by FTPing the installation packages rubyinstaller-1.9.2-p180.exe and rubygems-1.7.2.tgz. Now I want to install Rails on the same server where there is no internet connection. I"ll not be able to use "gem install rails" because there is no internet connection. Is there a way I can package Rails gem and all its dependencies (in a machine where I have internet connection) into a single file to be FTPed to the server (where I dont have internet) for installation?

Thanks in advance !

The question is quite simple.

But the answer to simple questions is frequently much more complicated...

Is there a way I can package Rails gem and all its dependencies (in a machine where I have internet connection) into a single file to be FTPed to the server (where I dont have internet) for installation?

Yes. You can download all the dependent gems from rubygems.org. Zip them into one file, and ftp them.

I"ll not be able to use "gem install rails" because there is no internet connection.

Yes you can... you use "gem install rails -l" to install from local files.

a machine(server) where there is no internet connection.

As an aside, how will this machine receive OS, framework and application patches?

> The question is quite simple.

But the answer to simple questions is frequently much more complicated...

> Is there a way I can package Rails gem and > all its dependencies (in a machine where I have internet connection) > into a single file to be FTPed to the server (where I dont have > internet) for installation?

Yes. You can download all the dependent gems from rubygems.org. Zip them into one file, and ftp them.

      Thanks. When you said I can download all the dependent gems and zip them, do i have to download them all manually from rubygems.org using a browser? Or if I choose to download them all through RubyGems installer whats the path where I can find all the downloaded gems in the rails installation location? If the Gems are present at a location where there are lots of other non-Rails Gems, then wouldn't it be very painful to segregate the Rails Gems?     I wish there was a simpler way like all the Rails Gems packaged into one bundle available for download. This is in addition to the existing way of installation. This is about having an additional option to a valid situation where you can install do an installation over the internet.

> I"ll not be able to use "gem install rails" because there > is no internet connection.

Yes you can... you use "gem install rails -l" to install from local files.

   Thanks. This has been answered already and I am aware of the -l option.What I meant above by "gem install rails" is installation through internet.

> a machine(server) where there is no internet connection.

As an aside, how will this machine receive OS, framework and application patches?

OS installation / patches are taken care by another team. Even then I do not see a need to have an internet connection. Patch installations have always been offline.

The question is quite simple.

But the answer to simple questions is frequently much more complicated…

Is there a way I can package Rails gem and

all its dependencies (in a machine where I have internet connection)

into a single file to be FTPed to the server (where I dont have

internet) for installation?

Yes. You can download all the dependent gems from rubygems.org. Zip

them into one file, and ftp them.

Thanks. When you said I can download all the dependent gems and

zip them, do i have to download them all manually from rubygems.org

using a browser? Or if I choose to download them all through RubyGems

installer whats the path where I can find all the downloaded gems in

the rails installation location?

No you don’t have to download through a browser from rubygems.org. You can download them through the gem installer. You can find the location of where a gem is installed on your system by running the following command:

gem which <name_of_gem>

If the Gems are present at a location

where there are lots of other non-Rails Gems, then wouldn’t it be very

painful to segregate the Rails Gems?

There will be lots of gems installed on your system for different reasons. No it is not painful to segregate them. You can see a list of the gems that Rails has a dependency on by running the following command:

gem dependency rails

The gem installer is your best tool. Take the time to read the manuals which will give you more than enough information on the above questions you have and more.

http://docs.rubygems.org/

I wish there was a simpler way like all the Rails Gems packaged

into one bundle available for download. This is in addition to the

existing way of installation. This is about having an additional

option to a valid situation where you can install do an installation

over the internet.

The easier way is the gem installer whether you are connected to the internet or you have a copy of the gem package file you transferred onto your server from another machine. The gem installer does not need the internet to install a gem. You just have to have the gem you want to install. Where are all the packages that you need to install Rails? rubygems.org. And now the argument has come full circle.

B.

> > > The question is quite simple.

> > But the answer to simple questions is frequently much more complicated...

> > > Is there a way I can package Rails gem and > > > all its dependencies (in a machine where I have internet connection) > > > into a single file to be FTPed to the server (where I dont have > > > internet) for installation?

> > Yes. You can download all the dependent gems from rubygems.org. Zip > > them into one file, and ftp them

   Do i have to locate the gem files manually in order to zip them into a single file? Say i run "gem dependency -r rails" which returns me a list of say 100 gems. These gems are located in a directory where there are already 1000 gem files which includes these Rails and its dependent files also. Do I have to browse through the file system manually to locate these 100 rails dependent gem files(from the already existing 1000 files) in order to package/zip them into a single file? Wouldn't that be painful? Is there an automated way of packaging the gem files which would take the output from "gem dependency -r rails" and package them into a single file?

Thanks,

S

The question is quite simple.

But the answer to simple questions is frequently much more complicated…

Is there a way I can package Rails gem and

all its dependencies (in a machine where I have internet connection)

into a single file to be FTPed to the server (where I dont have

internet) for installation?

Yes. You can download all the dependent gems from rubygems.org. Zip

them into one file, and ftp them

Do i have to locate the gem files manually in order to zip them

into a single file? Say i run “gem dependency -r rails” which

returns me a list of say 100 gems. These gems are located in a

directory where there are already 1000 gem files which includes these

Rails and its dependent files also. Do I have to browse through the

file system manually to locate these 100 rails dependent gem

files(from the already existing 1000 files) in order to package/zip

them into a single file? Wouldn’t that be painful? Is there an

automated way of packaging the gem files which would take the output

from “gem dependency -r rails” and package them into a single file?

Yes you have to locate them. The good news is that 99.9% of the time they are all installed in the same path. This makes your job of finding them easier. Do you have to find them all by hand? No, you’re a programmer. Write a script that parses the output and then gets the packages for you placing them all into one nice zip file. Not everything in life is going to come easy and nicely packaged for you. Sometimes you have to work at it.

B.