diff --git a/lib/train.rb b/lib/train.rb index d3fd45a9..3b6b52b8 100644 --- a/lib/train.rb +++ b/lib/train.rb @@ -2,11 +2,11 @@ # # Author:: Dominik Richter () -require "train/version" -require "train/options" -require "train/plugins" -require "train/errors" -require "train/platforms" +require_relative "train/version" +require_relative "train/options" +require_relative "train/plugins" +require_relative "train/errors" +require_relative "train/platforms" require "uri" module Train diff --git a/lib/train/extras.rb b/lib/train/extras.rb index e3c2a819..a5fa9b53 100644 --- a/lib/train/extras.rb +++ b/lib/train/extras.rb @@ -3,8 +3,8 @@ # Author:: Dominik Richter () module Train::Extras - require "train/extras/command_wrapper" - require "train/extras/stat" + require_relative "extras/command_wrapper" + require_relative "extras/stat" CommandResult = Struct.new(:stdout, :stderr, :exit_status) LoginCommand = Struct.new(:command, :arguments) diff --git a/lib/train/extras/command_wrapper.rb b/lib/train/extras/command_wrapper.rb index 0daaf548..d1c7c285 100644 --- a/lib/train/extras/command_wrapper.rb +++ b/lib/train/extras/command_wrapper.rb @@ -3,7 +3,7 @@ # author: Christoph Hartmann require "base64" -require "train/errors" +require_relative "../errors" module Train::Extras # Define the interface of all command wrappers. diff --git a/lib/train/file.rb b/lib/train/file.rb index 70fb4dce..b82aefb9 100644 --- a/lib/train/file.rb +++ b/lib/train/file.rb @@ -3,9 +3,9 @@ # author: Christoph Hartmann # author: Dominik Richter -require "train/file/local" -require "train/file/remote" -require "train/extras/stat" +require_relative "file/local" +require_relative "file/remote" +require_relative "extras/stat" module Train class File # rubocop:disable Metrics/ClassLength diff --git a/lib/train/file/local.rb b/lib/train/file/local.rb index d03d5d28..de763424 100644 --- a/lib/train/file/local.rb +++ b/lib/train/file/local.rb @@ -78,5 +78,5 @@ def linked_to?(dst) # subclass requires are loaded after Train::File::Local is defined # to avoid superclass mismatch errors -require "train/file/local/unix" -require "train/file/local/windows" +require_relative "local/unix" +require_relative "local/windows" diff --git a/lib/train/file/local/unix.rb b/lib/train/file/local/unix.rb index d5c09d80..ec53539d 100644 --- a/lib/train/file/local/unix.rb +++ b/lib/train/file/local/unix.rb @@ -1,7 +1,7 @@ # encoding: utf-8 require "shellwords" -require "train/extras/stat" +require_relative "../../extras/stat" module Train class File diff --git a/lib/train/file/remote.rb b/lib/train/file/remote.rb index 80b8b03c..c08929d8 100644 --- a/lib/train/file/remote.rb +++ b/lib/train/file/remote.rb @@ -33,8 +33,8 @@ def detect_filename(path, sep) # subclass requires are loaded after Train::File::Remote is defined # to avoid superclass mismatch errors -require "train/file/remote/aix" -require "train/file/remote/linux" -require "train/file/remote/qnx" -require "train/file/remote/unix" -require "train/file/remote/windows" +require_relative "remote/aix" +require_relative "remote/linux" +require_relative "remote/qnx" +require_relative "remote/unix" +require_relative "remote/windows" diff --git a/lib/train/file/remote/aix.rb b/lib/train/file/remote/aix.rb index 6c52198c..c475eb8a 100644 --- a/lib/train/file/remote/aix.rb +++ b/lib/train/file/remote/aix.rb @@ -1,6 +1,6 @@ # encoding: utf-8 -require "train/file/remote/unix" +require_relative "unix" module Train class File diff --git a/lib/train/file/remote/linux.rb b/lib/train/file/remote/linux.rb index 74edd758..d0d1b0aa 100644 --- a/lib/train/file/remote/linux.rb +++ b/lib/train/file/remote/linux.rb @@ -1,6 +1,6 @@ # encoding: utf-8 -require "train/file/remote/unix" +require_relative "unix" module Train class File diff --git a/lib/train/file/remote/qnx.rb b/lib/train/file/remote/qnx.rb index 388a99f1..dbd3021d 100644 --- a/lib/train/file/remote/qnx.rb +++ b/lib/train/file/remote/qnx.rb @@ -3,7 +3,7 @@ # author: Christoph Hartmann # author: Dominik Richter -require "train/file/remote/unix" +require_relative "unix" module Train class File diff --git a/lib/train/platforms.rb b/lib/train/platforms.rb index 45990bd3..e4aaac77 100644 --- a/lib/train/platforms.rb +++ b/lib/train/platforms.rb @@ -1,13 +1,13 @@ # encoding: utf-8 -require "train/platforms/common" -require "train/platforms/detect" -require "train/platforms/detect/scanner" -require "train/platforms/detect/specifications/os" -require "train/platforms/detect/specifications/api" -require "train/platforms/detect/uuid" -require "train/platforms/family" -require "train/platforms/platform" +require_relative "platforms/common" +require_relative "platforms/detect" +require_relative "platforms/detect/scanner" +require_relative "platforms/detect/specifications/os" +require_relative "platforms/detect/specifications/api" +require_relative "platforms/detect/uuid" +require_relative "platforms/family" +require_relative "platforms/platform" module Train::Platforms # Retrieve the current platform list diff --git a/lib/train/platforms/detect/helpers/os_common.rb b/lib/train/platforms/detect/helpers/os_common.rb index 2d0ab780..3c05dd5b 100644 --- a/lib/train/platforms/detect/helpers/os_common.rb +++ b/lib/train/platforms/detect/helpers/os_common.rb @@ -1,5 +1,5 @@ -require "train/platforms/detect/helpers/os_linux" -require "train/platforms/detect/helpers/os_windows" +require_relative "os_linux" +require_relative "os_windows" require "rbconfig" module Train::Platforms::Detect::Helpers diff --git a/lib/train/platforms/detect/scanner.rb b/lib/train/platforms/detect/scanner.rb index ec796223..6ac87854 100644 --- a/lib/train/platforms/detect/scanner.rb +++ b/lib/train/platforms/detect/scanner.rb @@ -1,6 +1,6 @@ # encoding: utf-8 -require "train/platforms/detect/helpers/os_common" +require_relative "helpers/os_common" module Train::Platforms::Detect class Scanner diff --git a/lib/train/plugin_test_helper.rb b/lib/train/plugin_test_helper.rb index 8c24edb1..f335e1c2 100644 --- a/lib/train/plugin_test_helper.rb +++ b/lib/train/plugin_test_helper.rb @@ -3,7 +3,7 @@ # Load Train. We certainly need the plugin system, and also several other parts # that are tightly coupled. Train itself is fairly light, and non-invasive. -require "train" +require_relative "../train" # You can select from a number of test harnesses. Since Train is closely related # to InSpec, and InSpec uses Spec-style controls in profile code, you will diff --git a/lib/train/plugins.rb b/lib/train/plugins.rb index 753f1392..f184a54c 100644 --- a/lib/train/plugins.rb +++ b/lib/train/plugins.rb @@ -3,11 +3,11 @@ # Author:: Dominik Richter () # Author:: Christoph Hartmann () -require "train/errors" +require_relative "errors" module Train class Plugins - require "train/plugins/transport" + require_relative "plugins/transport" class << self # Retrieve the current plugin registry, containing all plugin names diff --git a/lib/train/plugins/base_connection.rb b/lib/train/plugins/base_connection.rb index 82651142..00ae48da 100644 --- a/lib/train/plugins/base_connection.rb +++ b/lib/train/plugins/base_connection.rb @@ -1,8 +1,8 @@ # encoding: utf-8 -require "train/errors" -require "train/extras" -require "train/file" +require_relative "../errors" +require_relative "../extras" +require_relative "../file" require "logger" class Train::Plugins::Transport @@ -88,7 +88,7 @@ def to_json end def load_json(j) - require "train/transports/mock" + require_relative "../transports/mock" j["files"].each do |path, jf| @cache[:file][path] = Train::Transports::Mock::Connection::File.from_json(jf) end diff --git a/lib/train/plugins/transport.rb b/lib/train/plugins/transport.rb index c17efd70..9d7b099b 100644 --- a/lib/train/plugins/transport.rb +++ b/lib/train/plugins/transport.rb @@ -4,16 +4,16 @@ # Author:: Christoph Hartmann () require "logger" -require "train/errors" -require "train/extras" -require "train/options" +require_relative "../errors" +require_relative "../extras" +require_relative "../options" class Train::Plugins class Transport include Train::Extras Train::Options.attach(self) - require "train/plugins/base_connection" + require_relative "base_connection" # Initialize a new Transport object # diff --git a/lib/train/transports/azure.rb b/lib/train/transports/azure.rb index a51d24e1..15edd75c 100644 --- a/lib/train/transports/azure.rb +++ b/lib/train/transports/azure.rb @@ -1,15 +1,15 @@ # encoding: utf-8 -require "train/plugins" +require_relative "../plugins" require "ms_rest_azure" require "azure_mgmt_resources" require "azure_graph_rbac" require "azure_mgmt_key_vault" require "socket" require "timeout" -require "train/transports/helpers/azure/file_credentials" -require "train/transports/clients/azure/graph_rbac" -require "train/transports/clients/azure/vault" +require_relative "helpers/azure/file_credentials" +require_relative "clients/azure/graph_rbac" +require_relative "clients/azure/vault" module Train::Transports class Azure < Train.plugin(1) diff --git a/lib/train/transports/gcp.rb b/lib/train/transports/gcp.rb index 3241f150..6074f9fd 100644 --- a/lib/train/transports/gcp.rb +++ b/lib/train/transports/gcp.rb @@ -1,6 +1,6 @@ # encoding: utf-8 -require "train/plugins" +require_relative "../plugins" require "google/apis" require "google/apis/cloudresourcemanager_v1" require "google/apis/compute_v1" diff --git a/lib/train/transports/helpers/azure/file_credentials.rb b/lib/train/transports/helpers/azure/file_credentials.rb index ff75b194..775f7729 100644 --- a/lib/train/transports/helpers/azure/file_credentials.rb +++ b/lib/train/transports/helpers/azure/file_credentials.rb @@ -1,9 +1,9 @@ # encoding: utf-8 require "inifile" -require "train/transports/helpers/azure/file_parser" -require "train/transports/helpers/azure/subscription_number_file_parser" -require "train/transports/helpers/azure/subscription_id_file_parser" +require_relative "file_parser" +require_relative "subscription_number_file_parser" +require_relative "subscription_id_file_parser" module Train::Transports module Helpers diff --git a/lib/train/transports/local.rb b/lib/train/transports/local.rb index 91559226..2a66b0b8 100644 --- a/lib/train/transports/local.rb +++ b/lib/train/transports/local.rb @@ -3,8 +3,8 @@ # author: Dominik Richter # author: Christoph Hartmann -require "train/plugins" -require "train/errors" +require_relative "../plugins" +require_relative "../errors" require "mixlib/shellout" module Train::Transports diff --git a/lib/train/transports/mock.rb b/lib/train/transports/mock.rb index 7b0a5ded..cf268fd5 100644 --- a/lib/train/transports/mock.rb +++ b/lib/train/transports/mock.rb @@ -1,4 +1,4 @@ -require "train/plugins" +require_relative "../plugins" require "digest" module Train::Transports diff --git a/lib/train/transports/ssh.rb b/lib/train/transports/ssh.rb index 0fe52a73..871c7f3b 100644 --- a/lib/train/transports/ssh.rb +++ b/lib/train/transports/ssh.rb @@ -20,7 +20,7 @@ require "net/ssh" require "net/scp" -require "train/errors" +require_relative "../errors" module Train::Transports # Wrapped exception for any internally raised SSH-related errors. @@ -36,8 +36,8 @@ class SSHPTYFailed < Train::TransportError; end class SSH < Train.plugin(1) # rubocop:disable Metrics/ClassLength name "ssh" - require "train/transports/ssh_connection" - require "train/transports/cisco_ios_connection" + require_relative "ssh_connection" + require_relative "cisco_ios_connection" # add options for submodules include_options Train::Extras::CommandWrapper diff --git a/lib/train/transports/vmware.rb b/lib/train/transports/vmware.rb index ea93de96..6b02721b 100644 --- a/lib/train/transports/vmware.rb +++ b/lib/train/transports/vmware.rb @@ -1,5 +1,5 @@ # encoding: utf-8 -require "train/plugins" +require_relative "../plugins" require "open3" require "ostruct" require "json" @@ -35,7 +35,7 @@ def initialize(options) @powershell_binary = detect_powershell_binary if @powershell_binary == :powershell - require "train/transports/local" + require_relative "local" @powershell = Train::Transports::Local::Connection.new(options) end