Help with RubyGems (the package manager) - ruby-on-rails

I really need help with Rubygems (that's the package manager for ruby). Since I'm behind a proxy, I've given up all hope of it working automatically, so I had to download a lot of packages manually and install them for rails to install. Now, I'm getting an error message:
Rails requires RubyGems >= 1.3.2 (...)
Once again, I manually downloaded rubygems-1.3.2.gem and installed it, however, it still doesn't work and gem -v shows 1.3.1. Help. Also, I can assure it that unless gem has HTTP1.1 Auth Proxy support, there is no way it by itself will be able to contact its server...

Before running rubygems commands, you should try something like (for windows)
set http_proxy=user:password#ip:port
Or export for linux, I guess.

It seems that one can simply download the source tarballs, untar them and use setup.rb to install the update. More information on it here.

I did this and was very pleased with the result (no problem!).

Related

Rails initialization checksum error

I'm trying to initialize a new rails app on windows, and running rails new <appname> generates everything up to vendor/assets/stylesheets/.keep, but when bundle install is run, rails generates this error:
Checksum of /versions does not match the checksum provided by server! Something is wrong.
I'm not sure what's causing this, as I've done nothing to rails itself. Any help is appreciated.
Edit: If it's an error caused by windows being finicky, I have the option of moving to Linux, but I'd like to know what's wrong first.
I had the same issue using windows, and was able to solve it by uninstalling bundler and installing an older version.
rails new <appname>
gem uninstall bundler
gem install bundler -v 1.9
cd <appname>
bundle install
That did it for me!
In my case there was a *.pre.1 version and I chose to uninstall that particular version and then "bundle install" worked.
Try removing your ruby cache folder and then try again. So for example if you are on Linux machine and you are using rbenv and say ruby 2.1.5 folder. Your path would be similar to something like (Not sure where on windows ruby is stored):
~/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/cache/
Removing this folder and trying bundle install again should resolve the issue.
It will be great, if you move to a Linux machine.
On windows it's a hell to pay in my 5 years of experience what i have learned is not to mess with (ror) or (rs) in windows. here's a cheeky thing you can do an easy way. I believe you are using github as repo, as a editor you are using sublime if thats is a case open your gemfile you will see check the image or
try to clear cache on your server or update the gems.
I had this same exact error and solved it the following way. I think you are missing the ruby DevKit being installed.
Go here http://rubyinstaller.org/downloads/ and download/install the latest 32-bit Ruby version (as of writing this 2.2.4, you will need it for the web-console gem)
Make sure to add your ruby\bin folder to your environmental path variable
The trick is hidden near the bottom-left of the same page under the "Development Kit" section. You need to download and extract the right one into a permanent location (as of writing this for 32-bit - DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe)
After extracting the files, go into the main directory and run "ruby dk.rb init" followed by "ruby dk.rb install" (More information can be found here
That fixed it for me and i can now fully install with no checksum issues
This problem began when i tried to run my app. I wrote rails s and the console said me Could not find sdoc-0.4.1 in any of the sources Run bundle install to install missing gems. Then i wrote bundle install and the message that appeared was Checksum of /versions does not match the checksum provided by server! Something is wrong.
I solve this problem following this steps:
Wrote bundle install
The console said me Could not find sdoc-0.4.1 in any of the sources
Then i reinstalled this gem with gem install sdoc -v 0.4.1
I tried again to write rails s and it's was solved.
`

Ruby On Rails 3.x Offline Install (without internet connection)

I really appreciate if one can provide some insight for installing ruby on rails 3.x framework to a computer without internet connection.
All the tutorials or explanations seem to assume that there is always an internet connection. Is there simple way to download a bundle with all the dependencies included and simply install the bundle.
Thanks in advance
Finally. The complete list of Gems that you need to download manually, in order to install Rails in Offline mode (or behind a proxy that prevents your "gem" commands from working).
This list assumes that you already have the following things (Windows 7):
Ruby 1.9.2
RubyGems 1.8.24
DevKit
THE LIST.
Go to rubygems.org and use the Search function to download each one of the following Gems. You don't need to type the complete name with version numbers and stuff. For example, just "actionmailer" will work and will find the latest version).
Each gem page shows you the command line you have to type when installing it normally in a computer that isn't behind a proxy. Ignore it and just click the download link.
actionmailer-3.2.6.gem
actionpack-3.2.6.gem
activerecord-3.2.6.gem
activeresource-3.2.6.gem
activesupport-3.2.6.gem
rake-0.9.2.2.gem
i18n-0.6.0.gem
multi_json-1.3.6.gem
activemodel-3.2.6.gem
arel-3.0.2.gem
tzinfo-0.3.33.gem
builder-3.0.0.gem
erubis-2.7.0.gem
journey-1.0.4.gem
rack-1.4.1.gem
rack-cache-1.2.gem
rack-test-0.6.1.gem
sprockets-2.1.3.gem
hike-1.2.1.gem
tilt-1.3.3.gem
mail-2.4.4.gem
mime-types-1.19.gem
treetop-1.4.10.gem
polyglot-0.3.3.gem
rails-3.2.6.gem
bundler-1.1.4.gem
railties-3.2.6.gem
rack-ssl-1.3.2.gem
rdoc-3.12.gem
thor-0.15.3.gem
JSON-1.7.3.gem
(31 files total)
Just keep in mind that the versions may change. I did this in June 2012 and those were the versions that worked for me.
Copy all those files to the Ruby installation dir.
Then, open a CMD console.
cd \
cd <RubyInstallDir>
gem install rails-3.2.6.gem
Installation should run normally.
It is possible that some dependencies need a different version.
In that case, the error message will show you the right version. So you just need to download the version from rubygems.org (there is a list of old versions in the gem's page) and run the gem install command again.
I hope this can help.
You can use bundler to achive that. Bundler accepts the path where you can specify the location for the gems to be installed. Run the following command where you have internet connection. It will download all the dependencies and pack them into the specified folder.
bundle install --path gems # 'gems' is the folder present in Rails.root
Now that all the dependencies are within the project, you can copy the project to the machine where you don't have internet connection. From now on use the commands like:
bundle exec rails server
bundle exec rails console
Note that you have to install the bundler gem manually in the target machine.
I know that this question refers to Rails 3, but I created PortableRails exactly because of this (which has recently been updated to support Rails 4). Just make sure that you run bundle --local instead of just bundle (which is what the new-action tries to perform).

Running Ruby from usr/bin instead of usr/local/bin?

So I was following the steps on Hivelogic to get ruby on rails setup on my machine. After compiling and installing, I used the which ruby command to double check it installed in the right place. It did not. I was able to install the Rails and MySQL gems though, but both POW and localhost:3000 don't work.
Is there anything wrong with having it in the usr/bin directory instead of usr/local/bin? My usr/local/bin is practically empty, but usr/bin has a ton of files in it.
Edit: I reinstalled ruby to usr/local/bin but now Rails won't install. Is it a problem that it's already installed in usr/bin?
That page is a few years old. The current best practice for Mac and Linux is to use rvm. You can see, even Hivelogic uses rvm now (though I'm not sure how I feel about installing it system wide).
Anything that recommends installing from source as the first option instead of a last-resort fallback is probably bad advice. It's better to install using a package manager like MacPorts or Homebrew both of which have current versions of Ruby 1.8 and 1.9.
MacPorts installs everything in /opt specifically to avoid conflict with system files. From time to time Apple will distribute an update that patches ruby and this can mess up anything you have in the way of dependencies if you've been using a modified /usr/bin/ruby. Generally the system ruby is supposed to be left as-is.
You can replace the "compile ruby" step with an installer like that and save yourself a lot of trouble in the future. Just be sure to have /opt/local/bin as one of the first items in your PATH just as you would for other solutions.
Since installing Ruby and Rails and some kind of database can be a confusing process, it seems like there should be a meta-installer to help you through the process.
So I finally managed to get rails installed in the correct spot. I had to change the line in my .profile to export PATH="/usr/local/bin:$PATH" and then do a sudo gem update --system after installing rubygems before rails could actually be installed.
RVM and Homebrew did not help at all.
EDIT: Since people have a problem with this answer, I'm giving an update. I have since installed RVM and am liking it, but only because I have a friend I ask all my questions to, as RVM is really confusing if you're not used to doing a lot on the command line. I needed help from him to install it because I didn't have any of the bash files, and thought they were hiding somewhere. If you're missing the bash files, just create them yourself. This took a long time to get working, but now I apparently have it setup right.

Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again (I have rubygems 1.3.6!)

I'm running rails version 2.3.5 and rubygems version 1.3.6, when I script/server I get this error
Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again:http://rubygems.rubyforge.org
any ideas how to fix this?
The first thing you should do is run: gem env
This will output, amongst other things, the RUBYGEMS_VERSION and your GEM_PATHS. Verify that everything you think is true, is indeed true.
In the GEM_PATHS, you will probably see multiple paths, the top most being the primary path.
You can set GEM_HOME to the primary gem directory in the your .bash_login/etc file. Open a new terminal and run gem env again to make sure that it is being picked up.
As Gordon indicated, make sure these GEM paths are in your PATH.
Some other things to think about ownership/permissions. If you use sudo when working with gems on your system, they get installed in a different directory than when you install/update normally.
Perhaps you installed the rubygems using sudo, but rails is not running as root.
Read the installation notes if you still cannot figure it out: ruby gems installation
Maybe it’s not finding your correct gem path. I’ve had similar problems related to that. You might need to update your bash prefs eg in .basrc you might have something like this:
GEMS=/home/me/ruby1.8/lib/ruby/gems/1.8/bin/
export PATH=$RUBY:$GEMS:$HOME/bin:$PATH:$NGINX:$MONIT:$GIT
I just ran into this issue today, and for those of you who do something similar to what I did here is the fix and a little background.
I was installing some dependencies for rmagik, took the easy way out and used macports, it automatically went ahead and updated my default ruby to /opt/... so rubygems went missing since it only intalled ruby.
my advise, use rvm (http://rvm.beginrescueend.com/) like raphael_turtle says, since you will want RVM to be in charge of updating your links to ruby, rubygems and rails.
*Be wary when installing via macports or brew, just make sure you see what else is being installed, and don't accidently overwrite your local configs.
I had the same problem. My installation was done for me by technical support, so it was not me who did the installation (security problems).
The problem was that I didn't have some access rights, so this helped:
sudo - su user_name_with_enough_access_rights
And then run scripts/server again.
I couldn't figure out what was wrong so I installed rvm with a new version of rails and ruby.

One-Click install for Ruby/Rails/SQLite?

I'm used to the One-Click install local environments of MAMP. Is there a Ruby equivalent... a download that you run and instantly get the most current versions of Ruby, Rails, SQLite running locally?
I'm using a Mac, running Leopard, and am aware that all of the aforementioned technologies ship with Leopard (except maybe SQLite). The books that I have reference newer versions and the last thing I need is to try to retrofit a tutorial to work with my version.
And one more less important question: What are "Gems" and is that something that I need to make sure is fully updated too?
Installation is pretty confusing when you first start with Rails! Even though a lot of what you need is already installed if you are using Mac, personally I found it really hard to find come concise information on how to best go about setting things up.
Since I didn't want anyone else to go through the headaches that I had when configuring their Mac development environment, I've written a 7 step guide to installing Ruby on Rails, MySQL, Apache with PHP, and phpMyAdmin on OSX Leopard. In short, everything you should need to get developing locally on your Mac!
Here's the link:
http://waavoo.com/2009/7-step-guide-installing-ruby-on-rails-mysql-apache-php-phpmyadmin-intel-mac-os-x-leopard/
Hope that helps!
Take a look at FiveRuns Install. It's a free Ruby on Rails stack that you can download.
RubyGems is the Ruby standard for publishing and managing third party libraries. Check out the User Guide.
Have fun!
I have no idea what mac os are you in but Leopard (10.5.x) already have ruby installed, all you need is to updated the gems using
gem update rails
in your command line.
if you're on Tiger (10.4.x) the installation is broken, and please follow this link.
You should also have a look at Phusion Passenger - this, along with the prefpane, allows you to have apache VirtualHosts set up the easy way.
Current versions of Rails are designed to work (for development) without needing an AMP -style stack, by using SQLite and a small Ruby Web server, so if you will only be doing Rails development you don't need to set up a stack - you can just type "rails" and it will work.
BUT the versions of RubyGems and Rails shipped with Leopard are now outdated, though, so you'll need to upgrade these before you go too far. There's an article that I wrote on setting up a Mac for development here, but the minimum commands go like this:
sudo gem install rubygems-update
sudo update_rubygems
sudo update_rubygems (yep, twice)
sudo gem update --system
These get RubyGems up to the current release, so that you can upgrade Rails safely. To do that, type:
gem update rails
The last command doesn't have sudo, because if you omit it, current versions of RubyGems will install a clean copy of the gems into your home directory, leaving the system versions untouched.
Finally, amend the .profile file in your home directory, so that the line with PATH in it says:
export PATH=$HOME/.gem/ruby/1.8/bin:$PATH
Close up any terminal windows for this to take effect. The utilities provided by the gem packages in your home directory will now have precedence over the system versions.
This means that you can type "rails" and the latest version will run, but you haven't messed with any of the software provided by Apple (apart from the system copy of RubyGems).
To upgrade your private copy of Rails whenever a new version comes along in future it's just this again:
gem update rails
just refer this....
http://wiki.rubyonrails.org/getting-started/installation/windows#installing_ruby_on_rails_on_windows
BitNami RubyStack is exactly what you are looking for http://bitnami.org/stack/rubystack

Resources