From: Tom Hughes Date: Sat, 3 Dec 2022 17:11:08 +0000 (+0000) Subject: Reduce pollution of the Chef namespace X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/f3661da687dc11ec6d0c40a12d43723d71f4503e Reduce pollution of the Chef namespace --- diff --git a/cookbooks/chef/libraries/edit_file.rb b/cookbooks/chef/libraries/edit_file.rb index bfbec455c..f7c23178c 100644 --- a/cookbooks/chef/libraries/edit_file.rb +++ b/cookbooks/chef/libraries/edit_file.rb @@ -1,4 +1,4 @@ -class Chef +module OpenStreetMap module Mixin module EditFile def edit_file(file, &_block) @@ -10,8 +10,6 @@ class Chef end end end - - class Recipe - include Chef::Mixin::EditFile - end end + +Chef::Recipe.include(OpenStreetMap::Mixin::EditFile) diff --git a/cookbooks/chef/libraries/persistent_token.rb b/cookbooks/chef/libraries/persistent_token.rb index 8299e8550..e6f873507 100644 --- a/cookbooks/chef/libraries/persistent_token.rb +++ b/cookbooks/chef/libraries/persistent_token.rb @@ -1,6 +1,6 @@ require "digest" -class Chef +module OpenStreetMap module Mixin module PersistentToken def persistent_token(*args) @@ -13,8 +13,6 @@ class Chef end end end - - class Recipe - include Chef::Mixin::PersistentToken - end end + +Chef::Recipe.include(OpenStreetMap::Mixin::PersistentToken) diff --git a/cookbooks/mediawiki/resources/site.rb b/cookbooks/mediawiki/resources/site.rb index e26b7250e..8be994ee3 100644 --- a/cookbooks/mediawiki/resources/site.rb +++ b/cookbooks/mediawiki/resources/site.rb @@ -577,7 +577,7 @@ action :delete do end action_class do - include Chef::Mixin::PersistentToken + include OpenStreetMap::Mixin::PersistentToken def site_directory new_resource.directory || "/srv/#{new_resource.site}" diff --git a/cookbooks/web/resources/rails_port.rb b/cookbooks/web/resources/rails_port.rb index fbf4aeb0b..27cb3b02f 100644 --- a/cookbooks/web/resources/rails_port.rb +++ b/cookbooks/web/resources/rails_port.rb @@ -484,7 +484,7 @@ action :restart do end action_class do - include Chef::Mixin::EditFile + include OpenStreetMap::Mixin::EditFile def rails_directory new_resource.directory || "/srv/#{new_resource.site}" diff --git a/cookbooks/wordpress/resources/site.rb b/cookbooks/wordpress/resources/site.rb index c3f16ddca..c8a3e3883 100644 --- a/cookbooks/wordpress/resources/site.rb +++ b/cookbooks/wordpress/resources/site.rb @@ -217,8 +217,8 @@ action :delete do end action_class do - include Chef::Mixin::EditFile - include Chef::Mixin::PersistentToken + include OpenStreetMap::Mixin::EditFile + include OpenStreetMap::Mixin::PersistentToken def site_directory new_resource.directory || "/srv/#{new_resource.site}"