Skip to content

Commit 280b5d8

Browse files
authored
Merge pull request #13535 from chrisroberts/gem-activation
Update runtime dependency activations
2 parents ff445c2 + 8b06640 commit 280b5d8

File tree

344 files changed

+823
-804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

344 files changed

+823
-804
lines changed

bin/vagrant

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ if Thread.respond_to?(:report_on_exception=)
1010
Thread.report_on_exception = false
1111
end
1212

13-
# Activate all the runtime dependencies before
14-
# moving on.
15-
begin
16-
Gem::Specification.find_by_name("vagrant").runtime_dependencies.each do |dep|
17-
gem(dep.name, dep.requirement.as_list)
18-
end
19-
rescue Gem::MissingSpecError
20-
$stderr.puts "WARN: Failed to locate vagrant specification for dependency loading"
21-
end
22-
2313
# Split arguments by "--" if its there, we'll recombine them later
2414
argv = ARGV.dup
2515
argv_extra = []
@@ -117,7 +107,6 @@ end
117107

118108
env = nil
119109
begin
120-
require 'log4r'
121110
require 'vagrant'
122111
require 'vagrant/bundler'
123112
require 'vagrant/cli'

lib/vagrant.rb

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
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'
1217
Log4r::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
2126
end
2227

23-
require "optparse"
28+
Vagrant.require "optparse"
2429

2530
module Vagrant
2631
# This is a customized OptionParser for Vagrant plugins. It
@@ -45,10 +50,9 @@ module VagrantPlugins
4550
end
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
106110
end
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'
121125
global_logger = Log4r::Logger.new("vagrant::global")
122126
Vagrant.global_logger = global_logger
123127
global_logger.info("Vagrant version: #{Vagrant::VERSION}")
@@ -138,7 +142,7 @@ def << msg
138142
if 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

158162
module 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

lib/vagrant/action.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: BUSL-1.1
33

4-
require 'vagrant/action/builder'
4+
Vagrant.require 'vagrant/action/builder'
55

66
module Vagrant
77
module Action

lib/vagrant/action/builtin/box_add.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: BUSL-1.1
33

4-
require "digest/sha1"
5-
require "log4r"
6-
require "pathname"
7-
require "uri"
8-
9-
require "vagrant/box_metadata"
10-
require "vagrant/util/downloader"
11-
require "vagrant/util/file_checksum"
12-
require "vagrant/util/file_mutex"
13-
require "vagrant/util/platform"
4+
Vagrant.require "digest/sha1"
5+
Vagrant.require "log4r"
6+
Vagrant.require "pathname"
7+
Vagrant.require "uri"
8+
9+
Vagrant.require "vagrant/box_metadata"
10+
Vagrant.require "vagrant/util/downloader"
11+
Vagrant.require "vagrant/util/file_checksum"
12+
Vagrant.require "vagrant/util/file_mutex"
13+
Vagrant.require "vagrant/util/platform"
1414

1515
module Vagrant
1616
module Action

lib/vagrant/action/builtin/box_check_outdated.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: BUSL-1.1
33

4-
require "log4r"
4+
Vagrant.require "log4r"
55

66
module Vagrant
77
module Action

lib/vagrant/action/builtin/box_remove.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: BUSL-1.1
33

4-
require "log4r"
4+
Vagrant.require "log4r"
55

66
module Vagrant
77
module Action

lib/vagrant/action/builtin/box_update.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: BUSL-1.1
33

4-
require "log4r"
4+
Vagrant.require "log4r"
55

66
module Vagrant
77
module Action

lib/vagrant/action/builtin/cleanup_disks.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: BUSL-1.1
33

4-
require "json"
4+
Vagrant.require "json"
55

66
module Vagrant
77
module Action

lib/vagrant/action/builtin/cloud_init_setup.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: BUSL-1.1
33

4-
require 'vagrant/util/mime'
5-
require 'tmpdir'
4+
Vagrant.require 'vagrant/util/mime'
5+
Vagrant.require 'tmpdir'
66

77
module Vagrant
88
module Action

lib/vagrant/action/builtin/cloud_init_wait.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: BUSL-1.1
33

4+
Vagrant.require "log4r"
5+
46
module Vagrant
57
module Action
68
module Builtin

0 commit comments

Comments
 (0)