examples/kafka-jvm/chef/cookbooks/runit/libraries/provider_runit_service.rb
# refactor this whole thing into a Chef11 LWRP
refactor this whole thing into a Chef11 LWRP
refactor this whole thing into a Chef11 LWRP
def env_files
          return @env_files unless @env_files.nil?
          create_files = new_resource.env.map do |var, value|
            env_file = Chef::Resource::File.new(::File.join(sv_dir_name, 'env', var), run_context)
            env_file.owner(new_resource.owner)
            env_file.group(new_resource.group)
            env_file.content(value)
            env_file.action(:create)
            env_file
          end
          extra_env = @current_resource.env.reject { |k,_| new_resource.env.key?(k) }
          delete_files = extra_env.map do |k,_|
            env_file = Chef::Resource::File.new(::File.join(sv_dir_name, 'env', k), run_context)
            env_file.action(:delete)
            env_file
          end
          @env_files = create_files + delete_files
          @env_files
        end
def env_files return @env_files unless @env_files . nil? create_files = new_resource . env . map do | var , value | env_file = Chef :: Resource :: File . new ( :: File . join ( sv_dir_name , 'env' , var ) , run_context ) env_file . owner ( new_resource . owner ) env_file . group ( new_resource . group ) env_file . content ( value ) env_file . action ( :create ) env_file end extra_env = @current_resource . env . reject { | k , _ | new_resource . env . key? ( k ) } delete_files = extra_env . map do | k , _ | env_file = Chef :: Resource :: File . new ( :: File . join ( sv_dir_name , 'env' , k ) , run_context ) env_file . action ( :delete ) env_file end @env_files = create_files + delete_files @env_files end
refactor this whole thing into a Chef11 LWRP
refactor this whole thing into a Chef11 LWRP