Use Ruby 1.8 syntax for the Gemfile, and add a required Ruby version. #2285

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
Contributor

sodabrew commented Dec 14, 2012

This will make it easier for people to understand when they have a ruby version problem while trying to run bundle install.

If you run bundle install with ruby 1.8, you get this confusing error:

12:46 ~/git/gitlabhq (master)$ bundle install
Gemfile syntax error:
/Users/aaronstone/git/gitlabhq/Gemfile:14: syntax error, unexpected ':', expecting $end
gem "mysql2", group: :mysql
                    ^

After this PR, you will get a very readable error message:

12:48 ~/git/gitlabhq (master)$ bundle install
Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3
Use Ruby 1.8 syntax for the Gemfile, and add a required Ruby version.…
… This will make it easier for people to understand when they have a ruby version problem while trying to run bundle install.
Contributor

riyad commented Dec 14, 2012

+1 @randx what do you think?

Owner

rspeicher commented Dec 14, 2012

I wasn't aware of the ruby keyword. I like it.

Owner

dzaporozhets commented Dec 15, 2012

Nope. I dont like it

Contributor

vsizov commented Dec 16, 2012

@randx +1

irwinv commented on 4c034d5 Jan 17, 2013

Super c'est tout dont j'en avais besoin, cette correction, m'a un peu sauvé la journéegem, j'aller péter un câble ! ^^

mplewis commented Jan 22, 2013

For the record, if anyone got here by installing Ruby from debian-stable like I did, my problem was that I had Ruby 1.8.7 installed from debian-stable, while I needed to install Ruby from source.as the installation guide shows.

Contributor

AlexDenisov commented Feb 12, 2013

@mplewis, you can use RVM or rbenv

@ghost

ghost commented Feb 22, 2013

As "mplewis commented", this is because of using Ruby 1.8 and not 1.9.3 as described in installation guide. I had the same problem. Install Ruby 1.9.3 (and reinstall bundler "sudo gem install bundler").

Hi, this trouble was solved?

root@ubuntu:/home/gitlab/gitlab# sudo gem install bundler
Successfully installed bundler-1.3.4
Installing ri documentation for bundler-1.3.4
/usr/lib/ruby/1.8/rdoc/rdoc.rb:280: warning: conflicting chdir during another chdir block
/usr/lib/ruby/1.8/rdoc/rdoc.rb:287: warning: conflicting chdir during another chdir block
Done installing documentation for bundler after 9 seconds
1 gem installed

root@ubuntu:/home/gitlab/gitlab# sudo -u gitlab -H bundle install --deployment --without development test postgres
Gemfile syntax error:
/home/gitlab/gitlab/Gemfile:14: syntax error, unexpected ':', expecting $end
gem "mysql2", group: :mysql
^
root@ubuntu:/home/gitlab/gitlab#

root@ubuntu:/home/gitlab/gitlab# ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
root@ubuntu:/home/gitlab/gitlab#

Someone can help me? Why when I run 'sudo gem install bundler' shows me a conflicting with rdoc.rb file of ruby1.8 if I have installed ruby 2.0?

Contributor

cinderblock commented Apr 12, 2013

Why has this not been merged? That error was quite annoying and this is the first hit in a search for how to fix it.

Another solution: Remove earlier installed versions of ruby in your package list (e.g. with aptitude purge ruby1.8).

msouth commented Sep 17, 2013

Still a problem. Even when you think you're following the directions, you might not realize that the $PATH or whatever hasn't taken effect and you're still in a shell that's using the system ruby.

If the syntax of your file requires a later version, why wouldn't you indicate that in a way that is informative?

I hit this problem as well.

This should be merged imo.

geertw commented Dec 19, 2013

@kittblog: removing the Debian ruby package is not always an option; for example: we have a server which needs the puppet agent, and the Debian puppet package depends on the Debian ruby package. So we have two ruby's installed - the local installation for Gitlab and the system installation for puppet.

@sodabrew sodabrew deleted the sodabrew:patch-3 branch May 28, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment