开发者

Why does Rails not like this gem specification?

I've copied my Rails 2 site over to my production server, and when I run script/server on the production server, I get the following:

-bash-3.2$ script/server
=> Booting Mongrel
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
/home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:50:in `refresh!': undefined method `full_name' for #<String:0x2aca6af0b4a0> (NoMethodError)
    from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:45:in `each'
    from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:45:in `refresh!'
    from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:29:in `initialize'
    from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21:in `new'
    from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path'
    from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/initializer.rb:298:in `add_gem_load_paths'
    from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/initializer.rb:132:in `process'
    from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
    from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
    from /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/spree/lib/spree/initializer.rb:90:in `run'
    from /home/nwa36a/vhosts/aromapersona.localhost/config/environment.rb:13
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /home/nwa36a/vhosts/aromapersona.localhost/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
    from /home/nwa36a/vhosts/aromapersona.localhost/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /home/nwa36a/vhosts/aromapersona.localhost/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
    from /home/nwa36a/vhosts/aromapersona.localhost/vendor/rails/railties/lib/commands/server.rb:84
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from script/server:3

I froze all my gems, including dependencies, into my code base.

I did have to freeze rack-1.0.1 into the code base and modify vendor/rails/actionpack/lib/action_controller.rb as described here. When I did so, I copied rack-1.0.1/rack.gemspec to rack-1.0.1/.specification. I noticed that that specification file is in a bit different format than the other .specification files for other gems I've frozen. Here's a sample of a normal one:

--- !ruby/object:Gem::Specification
name: hoe
version: !ruby/object:Gem::Version
  prerelease: false
  segments:
  - 2
  - 6
  - 1
  version: 2.6.1
platform: ruby
authors:
- Ryan Davis
autorequire:
bindir: bin
cert_chain:

and the one for rack-1.0.1:

# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
  s.name = %q{rack}
  s.version = "1.0.1"

  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
  s.authors = ["Christian Neukirchen"]
  s.date = %q{2009-10-18}
  s.default_executable = %q{rackup}
  s.description = %q{Rack provides minimal, modular and adaptable interface for developing web applications in Ruby.  By wrapping HTTP requests and responses in the simplest way $
  s.email = %q{chneukirchen@gmail.com}
  s.executables = ["rackup"]
  s.extra_rdoc_files = ["README", "SPEC", "RDOX", "KNOWN-ISSUES"]
  s.files = ["COPYING", "KNOWN-ISSUES", "README", "Rakefile", "bin/rackup", "contrib/rack_logo.svg", "example/lobster.ru", "example/protectedlobster.rb", "example/protectedlobste$
  s.has_rdoc = true
  s.homepage = %q{http://ra开发者_StackOverflowck.rubyforge.org}
  s.require_paths = ["lib"]
  s.rubyforge_project = %q{rack}
  s.rubygems_version = %q{1.3.1}
  s.summary = %q{a modular Ruby webserver interface}
  s.test_files = ["test/spec_rack_auth_basic.rb", "test/spec_rack_auth_digest.rb", "test/spec_rack_auth_openid.rb", "test/spec_rack_builder.rb", "test/spec_rack_camping.rb", "tes$

  if s.respond_to? :specification_version then
    current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION


I found a solution. I did not realize I had root access to the machine, so, after logging in as root, I found that gem-1.0.1 was installed on the machine. I removed that and installed 1.1.0, and then the server started just fine. I then removed rack-1.0.1 from my project.

The real problem was that I was getting

RubyGem version error: rack(1.0.0 not ~> 1.0.1) (RuntimeError)

and needed rack-1.1.0. My limited user account had 1.1.0 installed, but for some reason the system was trying to use whatever was installed globally. How annoying.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜