Skip to content

Commit

Permalink
Merge pull request #13535 from chrisroberts/gem-activation
Browse files Browse the repository at this point in the history
Update runtime dependency activations
  • Loading branch information
chrisroberts authored Nov 8, 2024
2 parents ff445c2 + 8b06640 commit 280b5d8
Show file tree
Hide file tree
Showing 344 changed files with 823 additions and 804 deletions.
11 changes: 0 additions & 11 deletions bin/vagrant
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ if Thread.respond_to?(:report_on_exception=)
Thread.report_on_exception = false
end

# Activate all the runtime dependencies before
# moving on.
begin
Gem::Specification.find_by_name("vagrant").runtime_dependencies.each do |dep|
gem(dep.name, dep.requirement.as_list)
end
rescue Gem::MissingSpecError
$stderr.puts "WARN: Failed to locate vagrant specification for dependency loading"
end

# Split arguments by "--" if its there, we'll recombine them later
argv = ARGV.dup
argv_extra = []
Expand Down Expand Up @@ -117,7 +107,6 @@ end

env = nil
begin
require 'log4r'
require 'vagrant'
require 'vagrant/bundler'
require 'vagrant/cli'
Expand Down
46 changes: 25 additions & 21 deletions lib/vagrant.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
require "log4r"

# Load the shared helpers first to make the custom
# require helper available.
require "vagrant/shared_helpers"

Vagrant.require "log4r"

# Add patches to log4r to support trace level
require "vagrant/patches/log4r"
require "vagrant/patches/net-ssh"
require "vagrant/patches/rubygems"
Vagrant.require "vagrant/patches/log4r"
Vagrant.require "vagrant/patches/net-ssh"
Vagrant.require "vagrant/patches/rubygems"

# Set our log levels and include trace
require 'log4r/configurator'
Vagrant.require 'log4r/configurator'
Log4r::Configurator.custom_levels(*(["TRACE"] + Log4r::Log4rConfig::LogLevels))

# Update the default formatter within the log4r library to ensure
Expand All @@ -20,7 +25,7 @@ def format_object(obj)
end
end

require "optparse"
Vagrant.require "optparse"

module Vagrant
# This is a customized OptionParser for Vagrant plugins. It
Expand All @@ -45,10 +50,9 @@ module VagrantPlugins
end

# Load in our helpers and utilities
require "vagrant/shared_helpers"
require "rubygems"
require "vagrant/util"
require "vagrant/plugin/manager"
Vagrant.require "rubygems"
Vagrant.require "vagrant/util"
Vagrant.require "vagrant/plugin/manager"

# Enable logging if it is requested. We do this before
# anything else so that we can setup the output before
Expand Down Expand Up @@ -105,19 +109,19 @@ def << msg
end
end

require 'json'
require 'pathname'
require 'stringio'
Vagrant.require 'json'
Vagrant.require 'pathname'
Vagrant.require 'stringio'

require 'childprocess'
require 'i18n'
Vagrant.require 'childprocess'
Vagrant.require 'i18n'

# OpenSSL must be loaded here since when it is loaded via `autoload`
# there are issues with ciphers not being properly loaded.
require 'openssl'
Vagrant.require 'openssl'

# Always make the version available
require 'vagrant/version'
Vagrant.require 'vagrant/version'
global_logger = Log4r::Logger.new("vagrant::global")
Vagrant.global_logger = global_logger
global_logger.info("Vagrant version: #{Vagrant::VERSION}")
Expand All @@ -138,7 +142,7 @@ def << msg
if vagrant_ssl_locations.any? { |f| File.exist?(f) }
global_logger.debug("vagrant ssl helper found for loading ssl providers")
begin
require "vagrant/vagrant_ssl"
Vagrant.require "vagrant/vagrant_ssl"
Vagrant.vagrant_ssl_load
global_logger.debug("ssl providers successfully loaded")
rescue LoadError => err
Expand All @@ -152,8 +156,8 @@ def << msg

# We need these components always so instead of an autoload we
# just require them explicitly here.
require "vagrant/plugin"
require "vagrant/registry"
Vagrant.require "vagrant/plugin"
Vagrant.require "vagrant/registry"

module Vagrant
autoload :Action, 'vagrant/action'
Expand Down Expand Up @@ -230,7 +234,7 @@ def self.has_plugin?(name, version=nil)
end

# Now check the plugin gem names
require "vagrant/plugin/manager"
Vagrant.require "vagrant/plugin/manager"
Plugin::Manager.instance.plugin_installed?(name, version)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require 'vagrant/action/builder'
Vagrant.require 'vagrant/action/builder'

module Vagrant
module Action
Expand Down
20 changes: 10 additions & 10 deletions lib/vagrant/action/builtin/box_add.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "digest/sha1"
require "log4r"
require "pathname"
require "uri"

require "vagrant/box_metadata"
require "vagrant/util/downloader"
require "vagrant/util/file_checksum"
require "vagrant/util/file_mutex"
require "vagrant/util/platform"
Vagrant.require "digest/sha1"
Vagrant.require "log4r"
Vagrant.require "pathname"
Vagrant.require "uri"

Vagrant.require "vagrant/box_metadata"
Vagrant.require "vagrant/util/downloader"
Vagrant.require "vagrant/util/file_checksum"
Vagrant.require "vagrant/util/file_mutex"
Vagrant.require "vagrant/util/platform"

module Vagrant
module Action
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/box_check_outdated.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
Vagrant.require "log4r"

module Vagrant
module Action
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/box_remove.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
Vagrant.require "log4r"

module Vagrant
module Action
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/box_update.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
Vagrant.require "log4r"

module Vagrant
module Action
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/cleanup_disks.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "json"
Vagrant.require "json"

module Vagrant
module Action
Expand Down
4 changes: 2 additions & 2 deletions lib/vagrant/action/builtin/cloud_init_setup.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require 'vagrant/util/mime'
require 'tmpdir'
Vagrant.require 'vagrant/util/mime'
Vagrant.require 'tmpdir'

module Vagrant
module Action
Expand Down
2 changes: 2 additions & 0 deletions lib/vagrant/action/builtin/cloud_init_wait.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Vagrant.require "log4r"

module Vagrant
module Action
module Builtin
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/config_validate.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "vagrant/util/template_renderer"
Vagrant.require "vagrant/util/template_renderer"

module Vagrant
module Action
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/disk.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "json"
Vagrant.require "json"

module Vagrant
module Action
Expand Down
4 changes: 2 additions & 2 deletions lib/vagrant/action/builtin/graceful_halt.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
require "timeout"
Vagrant.require "log4r"
Vagrant.require "timeout"

module Vagrant
module Action
Expand Down
5 changes: 2 additions & 3 deletions lib/vagrant/action/builtin/handle_box.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "thread"

require "log4r"
Vagrant.require "thread"
Vagrant.require "log4r"

module Vagrant
module Action
Expand Down
11 changes: 5 additions & 6 deletions lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "set"
Vagrant.require "set"
Vagrant.require "log4r"
Vagrant.require "socket"

require "log4r"
require "socket"

require "vagrant/util/is_port_open"
require "vagrant/util/ipv4_interfaces"
Vagrant.require "vagrant/util/is_port_open"
Vagrant.require "vagrant/util/ipv4_interfaces"

module Vagrant
module Action
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/lock.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
Vagrant.require "log4r"

module Vagrant
module Action
Expand Down
7 changes: 3 additions & 4 deletions lib/vagrant/action/builtin/mixin_synced_folders.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "json"
require "set"

require 'vagrant/util/scoped_hash_override'
Vagrant.require "json"
Vagrant.require "set"
Vagrant.require 'vagrant/util/scoped_hash_override'

module Vagrant
module Action
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/prepare_clone.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
Vagrant.require "log4r"

module Vagrant
module Action
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/provision.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
Vagrant.require "log4r"

require_relative "mixin_provisioners"

Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/provisioner_cleanup.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
Vagrant.require "log4r"

require_relative "mixin_provisioners"

Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/set_hostname.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
Vagrant.require "log4r"

module Vagrant
module Action
Expand Down
4 changes: 2 additions & 2 deletions lib/vagrant/action/builtin/ssh_exec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "pathname"
Vagrant.require "pathname"

require "vagrant/util/ssh"
Vagrant.require "vagrant/util/ssh"

module Vagrant
module Action
Expand Down
8 changes: 4 additions & 4 deletions lib/vagrant/action/builtin/ssh_run.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
Vagrant.require "log4r"

require "vagrant/util/platform"
require "vagrant/util/ssh"
require "vagrant/util/shell_quote"
Vagrant.require "vagrant/util/platform"
Vagrant.require "vagrant/util/ssh"
Vagrant.require "vagrant/util/shell_quote"

module Vagrant
module Action
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/synced_folder_cleanup.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
Vagrant.require "log4r"

require_relative "mixin_synced_folders"

Expand Down
4 changes: 2 additions & 2 deletions lib/vagrant/action/builtin/synced_folders.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

require "log4r"
Vagrant.require "log4r"

require 'vagrant/util/platform'
Vagrant.require 'vagrant/util/platform'

require_relative "mixin_synced_folders"

Expand Down
Loading

0 comments on commit 280b5d8

Please sign in to comment.