Sha256: a80781109db24e6864a59f4951f177710e4e8f3169c2743a1a096c5e8ce48588

Contents?: true

Size: 677 Bytes

Versions: 5

Compression:

Stored size: 677 Bytes

Contents

default_action :create_if_missing

property :name, String, name_property: true
property :source, String
property :use_helpers, [TrueClass, FalseClass], default: true

action :create do
  template new_resource.name do
    source new_resource.source
    helper(:sanitized_cookbook_name) { cookbook_name.sub(/\Achef-/, "") }
    helpers new_resource.helpers
  end
end

action :create_if_missing do
  template new_resource.name do
    source new_resource.source
    helper(:sanitized_cookbook_name) { cookbook_name.sub(/\Achef-/, "") }
    helpers new_resource.helpers
    action :create_if_missing
  end
end

def helpers
  use_helpers ? ChefDK::Generator::TemplateHelper : []
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chef-flavor-flay-1.0.1 shared/flavor/flay/resources/template.rb
chef-flavor-flay-1.0.0 shared/flavor/flay/resources/template.rb
chef-flavor-flay-0.4.1 shared/flavor/flay/resources/template.rb
chef-flavor-flay-0.4.0 shared/flavor/flay/resources/template.rb
chef-flavor-flay-0.3.2 shared/flavor/flay/resources/template.rb