11# Copyright (c) HashiCorp, Inc.
22# SPDX-License-Identifier: BUSL-1.1
3- require "log4r"
3+
4+ # Load the shared helpers first to make the custom
5+ # require helper available.
6+ require "vagrant/shared_helpers"
7+
8+ Vagrant . require "log4r"
49
510# Add patches to log4r to support trace level
6- require "vagrant/patches/log4r"
7- require "vagrant/patches/net-ssh"
8- require "vagrant/patches/rubygems"
11+ Vagrant . require "vagrant/patches/log4r"
12+ Vagrant . require "vagrant/patches/net-ssh"
13+ Vagrant . require "vagrant/patches/rubygems"
914
1015# Set our log levels and include trace
11- require 'log4r/configurator'
16+ Vagrant . require 'log4r/configurator'
1217Log4r ::Configurator . custom_levels ( *( [ "TRACE" ] + Log4r ::Log4rConfig ::LogLevels ) )
1318
1419# Update the default formatter within the log4r library to ensure
@@ -20,7 +25,7 @@ def format_object(obj)
2025 end
2126end
2227
23- require "optparse"
28+ Vagrant . require "optparse"
2429
2530module Vagrant
2631 # This is a customized OptionParser for Vagrant plugins. It
@@ -45,10 +50,9 @@ module VagrantPlugins
4550end
4651
4752# Load in our helpers and utilities
48- require "vagrant/shared_helpers"
49- require "rubygems"
50- require "vagrant/util"
51- require "vagrant/plugin/manager"
53+ Vagrant . require "rubygems"
54+ Vagrant . require "vagrant/util"
55+ Vagrant . require "vagrant/plugin/manager"
5256
5357# Enable logging if it is requested. We do this before
5458# anything else so that we can setup the output before
@@ -105,19 +109,19 @@ def << msg
105109 end
106110end
107111
108- require 'json'
109- require 'pathname'
110- require 'stringio'
112+ Vagrant . require 'json'
113+ Vagrant . require 'pathname'
114+ Vagrant . require 'stringio'
111115
112- require 'childprocess'
113- require 'i18n'
116+ Vagrant . require 'childprocess'
117+ Vagrant . require 'i18n'
114118
115119# OpenSSL must be loaded here since when it is loaded via `autoload`
116120# there are issues with ciphers not being properly loaded.
117- require 'openssl'
121+ Vagrant . require 'openssl'
118122
119123# Always make the version available
120- require 'vagrant/version'
124+ Vagrant . require 'vagrant/version'
121125global_logger = Log4r ::Logger . new ( "vagrant::global" )
122126Vagrant . global_logger = global_logger
123127global_logger . info ( "Vagrant version: #{ Vagrant ::VERSION } " )
@@ -138,7 +142,7 @@ def << msg
138142if vagrant_ssl_locations . any? { |f | File . exist? ( f ) }
139143 global_logger . debug ( "vagrant ssl helper found for loading ssl providers" )
140144 begin
141- require "vagrant/vagrant_ssl"
145+ Vagrant . require "vagrant/vagrant_ssl"
142146 Vagrant . vagrant_ssl_load
143147 global_logger . debug ( "ssl providers successfully loaded" )
144148 rescue LoadError => err
@@ -152,8 +156,8 @@ def << msg
152156
153157# We need these components always so instead of an autoload we
154158# just require them explicitly here.
155- require "vagrant/plugin"
156- require "vagrant/registry"
159+ Vagrant . require "vagrant/plugin"
160+ Vagrant . require "vagrant/registry"
157161
158162module Vagrant
159163 autoload :Action , 'vagrant/action'
@@ -230,7 +234,7 @@ def self.has_plugin?(name, version=nil)
230234 end
231235
232236 # Now check the plugin gem names
233- require "vagrant/plugin/manager"
237+ Vagrant . require "vagrant/plugin/manager"
234238 Plugin ::Manager . instance . plugin_installed? ( name , version )
235239 end
236240
0 commit comments