Pre-load the gem resource to override the global gem method.

This seems problematic to me in general. We should probably not
override global methods. Renaming this to rubygem and providing a
deprecated alias seems like the right thing to do.

Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
Ryan Davis 2019-11-04 13:24:02 -08:00
parent 1ca94760ef
commit 5b6fdf9a98
2 changed files with 3 additions and 1 deletions

View file

@ -110,3 +110,5 @@ end
# Many resources use FilterTable.
require "inspec/utils/filter"
# conflicts with global `gem` method so we need to pre-load this.
require "inspec/resources/gem"

View file

@ -2,7 +2,7 @@ require "inspec/resources/command"
module Inspec::Resources
class GemPackage < Inspec.resource(1)
name "gem"
name "gem" # TODO: rename to "rubygem" and provide alias
supports platform: "unix"
supports platform: "windows"
desc "Use the gem InSpec audit resource to test if a global gem package is installed."