Ruby - Digest::Digest is deprecated; Use Digest

前端 未结 3 892
死守一世寂寞
死守一世寂寞 2020-12-09 15:05

I\'ve been getting this warning whenever I run my tests or start rails server.

When I run grep from .rvm folder I see the following:

grep -R \'Digest         


        
3条回答
  •  旧巷少年郎
    2020-12-09 15:26

    If you're using bundler, a good way to find out what is causing the problem is to grep through all the gems defined in your Gemfile:

    # grep (ack or ag) the problem code
    bundle show --paths | xargs grep -r Digest::Digest                             
    
    # here was my output
    ~/.gem/ruby/2.1.0/gems/fog-1.15.0/lib/fog/cloudstack.rb:    @@digest  = OpenSSL::Digest::Digest.new('sha1')
    ~/.gem/ruby/2.1.0/gems/fog-1.15.0/lib/fog/core/hmac.rb:      @digest = OpenSSL::Digest::Digest.new('sha1')
    ~/.gem/ruby/2.1.0/gems/fog-1.15.0/lib/fog/core/hmac.rb:        @digest = OpenSSL::Digest::Digest.new('sha256')
    
    # update appropriate gems (in my case fog)
    gem install fog
    bundle update fog
    

    Also make sure you aren't locked on a gem version in your Gemfile.

    # change
    gem 'fog', '~> 1.15.0'
    # to
    gem 'fog', '~> 1.0'
    # or omit the version if you are a cowboy/girl
    

提交回复
热议问题