class RuboCop::Cop::Chef::Modernize::LegacyBerksfileSource
There have been many different valid community site / Supermarket URLs to use in a cookbook’s Berksfile. These old URLs continue to function via redirects, but should be updated to point to the latest Supermarket URL.
@example
### incorrect source 'http://community.opscode.com/api/v3' source 'https://supermarket.getchef.com' source 'https://api.berkshelf.com' site :opscode ### correct source 'https://supermarket.chef.io'
Constants
- MSG
- RESTRICT_ON_SEND
Public Instance Methods
Source
# File lib/rubocop/cop/chef/modernize/berksfile_source.rb, line 49 def old_berkshelf_url?(url) %w(http://community.opscode.com/api/v3 https://supermarket.getchef.com https://api.berkshelf.com).include?(url) end
Source
# File lib/rubocop/cop/chef/modernize/berksfile_source.rb, line 53 def on_send(node) berksfile_source?(node) do add_offense(node, severity: :refactor) do |corrector| corrector.replace(node, "source 'https://supermarket.chef.io'") end end berksfile_site?(node) do add_offense(node, severity: :refactor) do |corrector| corrector.replace(node, "source 'https://supermarket.chef.io'") end end end