user1628331
user1628331

Reputation: 1

Installing Ruby on Rails in a closed network on windows

I am a nb to RoR, I used the windows installer and it install fine. The problem is when RoR is trying to get out to http://rubygems.org, it can't get there.

So my question is where can I change where it sources that information and can I download those gems individually and place them into a directory for RoR to source?

I appreciate any help I have beating my head on this for days.

Upvotes: 0

Views: 136

Answers (1)

Charles Caldwell
Charles Caldwell

Reputation: 17179

It is possible that you are behind a proxy. Though your web browser and other various applications are probably set up to work through the proxy, RubyGems is not.

If you know your http proxy address and port, you can pass it as a command line argument to Ruby Gems.

Though I would suggest setting up your proxy as a system variable, you may not have that option as I also don't have that option at my current place of employment.

gem install rails --http-proxy=https://your.proxy.address:portnumber

Information about this at RubyGems manual.

EDIT:

There is a way to manually download and install a gem. It can be cumbersome and annoying but it is possible.

Go to RubyGems.org and use the search feature to find the gem you need. For this example, I will use Devise. On the page for Devise is a download link. Download the gem and cd into that location. If you save it to C:\manual_gems, then cd C:\manual_gems.

The current version of Devise is 2.1.2. So, once you are in the folder you saved the gem to:

gem install devise-2.1.2.gem

Here comes the cumbersome part. You will notice an error saying that it requires dependencies. The RubyGems page also gives a list of dependencies. You will have to follow this same process for each of the dependencies before finally being able to install the gem.

For instance, Devise requires Warden which in turn requires ActionPack, ActiveSupport, Rack-SSL, Rake, RDoc, and Thor (which you may already have installed if you have Rails). It's a recursive trip that RubyGems and Bundler take care of for you.

When all of that is in place, you can modify your GemFile in your Rails app to point to the local gems. I have not tested it but there is an accepted answer on a similar SO question on the topic which provides the solution of:

gem 'devise', path: 'path/to/devise'

Again, cumbersome but if you really want to get a Rails app up and running in a limited environment such as that you imply, this should either work or get you well on your way.

Upvotes: 2

Related Questions