我正在尝试在 CentOS 6.6 机器上安装 Snorby,但 ruby 和 Gemfile 一直出现问题。我认为我要么必须编辑我的 Gemfile,要么它与安装路径有关。任何帮助都将不胜感激。
bundle exec rake snorby:setup
错误信息
gemspec/var/www/html/snorby/vendor/bundle/ruby/1.9.1/bundler/gems/snorby_cas_authenticatable-/devise_cas_authenticatable.gemspec
无效。验证错误为
duplicate dependency on devise (>= 1.0.6), (>= 0) use:
add_runtime_dependency 'devise', '>= 1.0.6', '>= 0'
答案1
我通过在 devise_case_authenticable gemspec 文件 /usr/local/rvm/gems/ruby-1.9.3-p551/bundler/gems/snorby_cas_authenticatable-281a58b36368/devise_cas_authenticatable.gemspec 中添加 1.0.6 依赖项来使其工作:
if s.respond_to? :specification_version then
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<devise>, [">= 0"])
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
s.add_development_dependency(%q<jeweler>, [">= 0"])
**s.add_runtime_dependency(%q<devise>, [">= 1.0.6"])**
s.add_runtime_dependency(%q<rubycas-client>, [">= 2.2.1"])
else
s.add_dependency(%q<devise>, [">= 0"])
s.add_dependency(%q<ruby-debug>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
**s.add_dependency(%q<devise>, [">= 1.0.6"])**
s.add_dependency(%q<rubycas-client>, [">= 2.2.1"])
end
else
s.add_dependency(%q<devise>, [">= 0"])
s.add_dependency(%q<ruby-debug>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
**s.add_dependency(%q<devise>, [">= 1.0.6"])**
s.add_dependency(%q<rubycas-client>, [">= 2.2.1"])
end
end
然后改变
gem 'devise_cas_authenticatable', :git => 'https://github.com/Snorby/snorby_cas_authenticatable.git'
在 snorby gemfile 中的 snorby www 根目录中
gem 'devise_cas_authenticatable'
我的猜测是,这只有在失败一次后才会起作用,以便安装 devise_cas_authenticable gem
答案2
这对我不起作用,相反我转到了你提到的文件:
/usr/local/rvm/gems/ruby-1.9.3-p551/bundler/gems/snorby_cas_authenticatable-281a58b36368/devise_cas_authenticatable.gemspec
但在这里我评论了这三行:
if s.respond_to? :specification_version then
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
#####s.add_runtime_dependency(%q<devise>, [">= 0"])
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
s.add_development_dependency(%q<jeweler>, [">= 0"])
s.add_runtime_dependency(%q<devise>, [">= 1.0.6"])
s.add_runtime_dependency(%q<rubycas-client>, [">= 2.2.1"])
else
#####s.add_dependency(%q<devise>, [">= 0"])
s.add_dependency(%q<ruby-debug>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
s.add_dependency(%q<devise>, [">= 1.0.6"])
s.add_dependency(%q<rubycas-client>, [">= 2.2.1"])
end
else
#####s.add_dependency(%q<devise>, [">= 0"])
s.add_dependency(%q<ruby-debug>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
s.add_dependency(%q<devise>, [">= 1.0.6"])
s.add_dependency(%q<rubycas-client>, [">= 2.2.1"])
end
end
之后工作顺利。