mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
Merge pull request #4670 from inspec/zenspider/gem-resource
Pre-load the gem resource to override the global gem method.
This commit is contained in:
commit
4ed9305535
2 changed files with 5 additions and 2 deletions
|
@ -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"
|
||||
|
|
|
@ -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."
|
||||
|
@ -17,11 +17,12 @@ module Inspec::Resources
|
|||
|
||||
def initialize(package_name, gem_binary = nil)
|
||||
@package_name = package_name
|
||||
@gem_binary = case gem_binary
|
||||
@gem_binary = case gem_binary # TODO: no. this is not right
|
||||
when nil
|
||||
"gem"
|
||||
when :chef
|
||||
if inspec.os.windows?
|
||||
# TODO: what about chef-dk or other installs?
|
||||
'c:\opscode\chef\embedded\bin\gem.bat'
|
||||
else
|
||||
"/opt/chef/embedded/bin/gem"
|
||||
|
|
Loading…
Reference in a new issue