chef/cookbooks/ark/libraries/resource_deprecations.rb
Greg Karékinian a32f34b408 Vendor the external cookbooks
Knife-Zero doesn't include Berkshelf support, so vendoring everything in
the repo is convenient again
2019-10-13 19:17:42 +02:00

34 lines
728 B
Ruby

module Ark
class ResourceDeprecations
def self.on(resource)
new(resource).warnings
end
def initialize(resource)
@resource = resource
end
attr_reader :resource
def warnings
applicable_deprecrations.map { |_, message| message }
end
def applicable_deprecrations
deprecations.select { |condition, _| send(condition) }
end
def deprecations
{ strip_leading_dir_feature: strip_leading_dir_feature_message }
end
def strip_leading_dir_feature
[true, false].include?(resource.strip_leading_dir)
end
def strip_leading_dir_feature_message
'strip_leading_dir attribute was deprecated. Use strip_components instead.'
end
end
end