2014-01-10 44 views
0

由于升级我的Rails(2.3.17)应用程序到Ruby 1.9.3我丢失ssh.sftp.upload!方法,所以我试图利用net-scp库,但是我似乎无法在Rails中使用它。在irb我可以要求文件很好,只是不在轨道控制台。MissingSourceFile:无法加载这样的文件 - 网络/ scp

[email protected]:~/myapp$ script/console myapp 
Loading myapp environment (Rails 2.3.17) 
>> require 'net/scp' 
MissingSourceFile: cannot load such file -- net/scp 
    from /path/to/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:184:in `require' 
    from /path/to/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:184:in `require' 
    from (irb):1 
    from /home/me/.rvm/rubies/ruby-1.9.3-p448/bin/irb:16:in `<main>' 

这似乎但是工作:

>> require 'net/ssh' 
=> false 

这里是我的相关Gemfile.lock

$ cat Gemfile.lock | grep "net-scp" -n5 
30-  nokogiri (>= 1.4.4) 
31-  uuidtools (~> 2.1) 
32- builder (2.1.2) 
33- capistrano (2.14.2) 
34-  highline 
35:  net-scp (>= 1.0.0) 
36-  net-sftp (>= 2.0.0) 
37-  net-ssh (>= 2.0.14) 
38-  net-ssh-gateway (>= 1.1.0) 
39- capistrano-ext (1.2.1) 
40-  capistrano (>= 1.0.0) 
-- 
106- multi_xml (0.5.3) 
107- mysql (2.9.0) 
108- net-http-digest_auth (1.2.1) 
109- net-http-persistent (2.8) 
110- net-ldap (0.3.1) 
111: net-scp (1.1.0) 
112-  net-ssh (>= 2.6.5) 
113- net-sftp (2.1.1) 
114-  net-ssh (>= 2.6.5) 
115- net-ssh (2.7.0) 
116- net-ssh-gateway (1.2.0) 

我怎样才能解决或规避呢?

回答

4

显然它是那么简单,包括在该Gemfilenet-scp,即使它包含net-sshcapistrano

+0

我已经有类似的问题几天了。这也适用于我。我不太明白它为什么起作用,但谢谢! – dspencer

+0

很高兴帮助别人。我的猜测是命名空间不可用于轨道,除非它包含在Gemfile中作为它自己的gem。作为另一个gem(capistrano)的依赖项不会将依赖关系浮出到控制台的范围,以便能够导入它,否则gem可能不兼容。 – yekta

+0

我不知道如何使用这个anwser。我有一个厨师食谱,没有Gemfile。唯一的版本控制文件是metadata.rb或Berksfile.lock。将它添加到Berksfile.lock没有帮助。 –

相关问题