Class: RuboCop::Cop::Chef::Modernize::OsxConfigProfileResource

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Defined in:
lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb

Overview

The osx_config_profile resource was renamed to osx_profile. The new resource name should be used.

Examples:


### incorrect
osx_config_profile 'Install screensaver profile' do
  profile 'screensaver/com.company.screensaver.mobileconfig'
end

### correct
osx_profile 'Install screensaver profile' do
  profile 'screensaver/com.company.screensaver.mobileconfig'
end

Constant Summary collapse

MSG =
'The osx_config_profile resource was renamed to osx_profile. The new resource name should be used.'
RESTRICT_ON_SEND =
[:osx_config_profile].freeze

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



42
43
44
45
46
# File 'lib/rubocop/cop/chef/modernize/osx_config_profile_resource.rb', line 42

def on_send(node)
  add_offense(node, severity: :refactor) do |corrector|
    corrector.replace(node, node.source.gsub(/^osx_config_profile/, 'osx_profile'))
  end
end