class ChefConfig::PackageTask
def update_gemfile_lock # rubocop:disable Lint/NestedMethodDefinition
def update_gemfile_lock # rubocop:disable Lint/NestedMethodDefinition if File.exist?(gemfile_lock_path) puts "Updating #{gemfile_lock_path} to include version #{version} ..." contents = IO.read(gemfile_lock_path) contents.gsub!(/^\s*(chef|chef-config)\s*\((= )?\S+\)\s*$/) do |line| line.gsub(/\((= )?\d+(\.\d+)+/) { "(#{$1}#{version}" } end IO.write(gemfile_lock_path, contents) end end