ruby - Should this Chef recipe be refactored? -


i've written recipe installs windows desktop apps databag:

workstation_apps = data_bag_item('winapps','desktop_apps')  package in workstation_apps['apps']         chocolatey_package "#{package}"         action :install         end end 

running foodcritic error:

fc002: avoid string interpolation not required: ./recipes/default.rb:23 

as can see, added double quotes around #{package} expands variable , not function comment.

is there better way this?

two things: first use of for loops in ruby discouraged in favor of each loops. second, chocolatey package provider support multi-package operations can rewrite recipe this:

workstation_apps = data_bag_item('winapps','desktop_apps') chocolatey_package workstation_apps['apps'] 

(remember :install default action don't need write out)


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -