`requirement': wrong number of arguments

18 views
Skip to first unread message

sleepycat

unread,
Feb 23, 2011, 7:39:22 PM2/23/11
to Gitorious
I was working my way through the install tutorial and as they
mentioned I ran into the

undefined local variable or method `version_requirements'

problem.

I did the code they specifed into my environment.rb like this:


# Specifies gem version of Rails to use when vendor/rails is not
present
RAILS_GEM_VERSION = '2.3' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default
configuration
require File.join(File.dirname(__FILE__), 'boot')

#
#Added to prevent the "undefined local variable or method
`version_requirements' problem
#
if Gem::VERSION >= "1.3.6"
module Rails
class GemDependency
def requirement
r = super #(r == Gem::Requirement.default) ? nil : r
end
end
end
end

Rails::Initializer.run do |config|
gitorious_yaml = YAML.load_file(File.join(RAILS_ROOT, "config/
gitorious.yml"))[RAILS_ENV]
raise "Your config/gitorious.yml does not have an entry for your
current Rails environment. Please consult config/gitorious.sample.yml
for instructions." unless gitorious_yaml

# Settings in config/environments/* take precedence over those
specified here.
# Application configuration should go into files in config/
initializers
# -- all .rb files in that directory are automatically loaded.
# See Rails::Configuration for more options.



But I am getting this error:

(See full trace by running task with --trace)
./script/../config/environment.rb:20:in `requirement': wrong number of
arguments (1 for 0) (ArgumentError)
from ./script/../config/environment.rb:20:in `requirement'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:254:in `activate'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:1204:in `gem'
from ./script/../config/../vendor/rails/railties/lib/rails/
gem_dependency.rb:73:in `add_load_paths'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:
301:in `add_gem_load_paths'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:
301:in `each'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:
301:in `add_gem_load_paths'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:
132:in `process'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:
113:in `send'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:
113:in `run'
from ./script/../config/environment.rb:26
from script/create_admin:2:in `require'
from script/create_admin:2

Anyone have any thoughts on what the problem is?

I am running rubygems 1.5.2

aclysma

unread,
Feb 26, 2011, 12:12:11 PM2/26/11
to Gitorious
I had the same problem; I think there is a typo in the instructions.
Try putting a line break between r = super and (r ==
Gem::Requirement.default) ? nil : r. It should look like a snippet I
found here (which ultimately helped me figure this out.)

http://www.redmine.org/issues/7516

I'm still not done working through the instructions, but this change
did appear to allow the gems::install command to work as intended.

Good luck
Philip

Christian Johansen

unread,
Mar 4, 2011, 5:24:18 AM3/4/11
to gito...@googlegroups.com, aclysma
An alternative approach is to downgrade RubyGems and use 1.4.x.

Cheers,
Christian

--
To post to this group, send email to gito...@googlegroups.com
To unsubscribe from this group, send email to
gitorious+...@googlegroups.com



--
MVH
Christian
Reply all
Reply to author
Forward
0 new messages