尝试使用备份RubyGem,但无法找到已安装的gem

时间:2012-08-13 22:08:29

标签: ruby amazon-s3 gem backup fog

我正在尝试让备份RubyGem(https://github.com/meskyanichi/backup)正常工作。当我尝试触发备份时,我得到:

bill:~/Backup$ backup perform --trigger bidkat_backup
[2012/08/13 16:58:37][error] Dependency::LoadError: Dependency missing
[2012/08/13 16:58:37][error]   Dependency required for:
[2012/08/13 16:58:37][error]   Amazon S3, Rackspace Cloud Files (S3, CloudFiles Storages)
[2012/08/13 16:58:37][error]   To install the gem, issue the following command:
[2012/08/13 16:58:37][error]   > gem install fog -v '~> 1.4.0'
[2012/08/13 16:58:37][error]   Please try again after installing the missing dependency.

但是检查依赖关系我得到了这个:

bill:~/Backup$ gem query

*** LOCAL GEMS ***

builder (3.0.0)
excon (0.14.3)
fog (1.4.0)
formatador (0.2.3)
mime-types (1.19)
multi_json (1.3.6)
net-scp (1.0.4)
net-ssh (2.5.2)
nokogiri (1.5.5)
ruby-hmac (0.4.0)

bill:~/Backup$ which fog
/usr/local/bin/fog

检查我的ruby版本给了我:

bill:~/Backup$ which ruby
/usr/bin/ruby

bill:~/Backup$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

查看备份来源,他们正试图像这样加载gem:

def self.all
  {
    'fog' => {
      :require => 'fog',
      :version => '~> 1.4.0',
      :for     => 'Amazon S3, Rackspace Cloud Files (S3, CloudFiles Storages)'
    },
  ....
  }

def self.load(name)
  begin
    gem(name, all[name][:version])
    require(all[name][:require])
  rescue LoadError
    Logger.error Errors::Dependency::LoadError.new(<<-EOS)
      Dependency missing
      Dependency required for:
      #{all[name][:for]}
      To install the gem, issue the following command:
      > gem install #{name} -v '#{all[name][:version]}'
      Please try again after installing the missing dependency.
    EOS
    exit 1
  end
end

我不使用红宝石,所以我不知道发生了什么。有人知道问题是什么以及我如何解决它?或者是否有更好的方法将mongodb备份推送到S3?

谢谢!

1 个答案:

答案 0 :(得分:1)

您的备份目录中是否有Gemfile?我知道这在过去给我带来了麻烦。还可以尝试从备份目录外部运行备份并引用配置文件的位置。似乎有些东西正在改变你的环境。你使用rvm或rbenv或类似的东西?但是,你试试这个:

cd # to get back to user dir
gem install backup
gem install fog -v=1.4.0
backup perform --trigger bidkat_backup --config-file path_to_config/config.rb