mirror of
https://github.com/inspec/inspec
synced 2024-11-22 04:33:09 +00:00
use bundler to call install_from_remote_gems
method
Signed-off-by: Sathish <sbabu@progress.com>
This commit is contained in:
parent
81aa1ff5d4
commit
d3d1292ba2
1 changed files with 29 additions and 0 deletions
|
@ -316,6 +316,35 @@ module Inspec::Plugin::V2
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def install_from_remote_gems(plugin_name, opts)
|
||||
require 'bundler'
|
||||
gemfile_path = ::Bundler.default_gemfile
|
||||
|
||||
File.open(gemfile_path, 'a') do |file|
|
||||
file.puts <<-GEM
|
||||
source 'http://4d7c88175115126e2264b3cc6b709a9a@localhost:9292/private' do
|
||||
gem '#{plugin_name}'
|
||||
end
|
||||
GEM
|
||||
end
|
||||
|
||||
# Bundler.with_unbundled_env do
|
||||
# require 'bundler/rubygems_gem_installer'
|
||||
# installer = Bundler::RubyGemsGemInstaller.at(gemfile_path)
|
||||
# installer.install(plugin_name)
|
||||
# end
|
||||
|
||||
::Bundler.with_unbundled_env do
|
||||
::Bundler::CLI.start(['install'])
|
||||
end
|
||||
|
||||
plugin_spec = ::Bundler.load.specs.find { |spec| spec.name == plugin_name }
|
||||
require 'byebug'; byebug
|
||||
raise "Plugin #{plugin_name} installation failed!" unless plugin_spec
|
||||
plugin_spec.version
|
||||
end
|
||||
|
||||
def install_gem_to_plugins_dir(new_plugin_dependency, # rubocop: disable Metrics/AbcSize
|
||||
extra_request_sets = [],
|
||||
update_mode = false)
|
||||
|
|
Loading…
Reference in a new issue