Use require_relative for faster loading

require_relative is an order of magnitude faster on Windows
This commit is contained in:
Seth Vargo 2014-10-30 11:21:56 -04:00
parent 2d78f1a816
commit 1169c80a72
5 changed files with 13 additions and 14 deletions

View File

@ -1,7 +1,7 @@
require File.expand_path("../base", __FILE__)
require "vagrant/util/which" require "vagrant/util/which"
require_relative "base"
module VagrantPlugins module VagrantPlugins
module Chef module Chef
module Config module Config

View File

@ -1,4 +1,4 @@
require File.expand_path("../base", __FILE__) require_relative "base"
module VagrantPlugins module VagrantPlugins
module Chef module Chef

View File

@ -2,11 +2,10 @@ require "pathname"
require "vagrant" require "vagrant"
require_relative "command_builder"
module VagrantPlugins module VagrantPlugins
module Chef module Chef
root = Pathname.new(File.expand_path("../", __FILE__))
autoload :CommandBuilder, root.join("command_builder")
class Plugin < Vagrant.plugin("2") class Plugin < Vagrant.plugin("2")
name "chef" name "chef"
description <<-DESC description <<-DESC
@ -15,32 +14,32 @@ module VagrantPlugins
DESC DESC
config(:chef_solo, :provisioner) do config(:chef_solo, :provisioner) do
require File.expand_path("../config/chef_solo", __FILE__) require_relative "config/chef_solo"
Config::ChefSolo Config::ChefSolo
end end
config(:chef_client, :provisioner) do config(:chef_client, :provisioner) do
require File.expand_path("../config/chef_client", __FILE__) require_relative "config/chef_client"
Config::ChefClient Config::ChefClient
end end
config(:chef_zero, :provisioner) do config(:chef_zero, :provisioner) do
require File.expand_path("../config/chef_zero", __FILE__) require_relative "config/chef_zero"
Config::ChefZero Config::ChefZero
end end
provisioner(:chef_solo) do provisioner(:chef_solo) do
require File.expand_path("../provisioner/chef_solo", __FILE__) require_relative "provisioner/chef_solo"
Provisioner::ChefSolo Provisioner::ChefSolo
end end
provisioner(:chef_client) do provisioner(:chef_client) do
require File.expand_path("../provisioner/chef_client", __FILE__) require_relative "provisioner/chef_client"
Provisioner::ChefClient Provisioner::ChefClient
end end
provisioner(:chef_zero) do provisioner(:chef_zero) do
require File.expand_path("../provisioner/chef_zero", __FILE__) require_relative "provisioner/chef_zero"
Provisioner::ChefZero Provisioner::ChefZero
end end
end end

View File

@ -3,7 +3,7 @@ require 'pathname'
require 'vagrant' require 'vagrant'
require 'vagrant/util/subprocess' require 'vagrant/util/subprocess'
require File.expand_path("../base", __FILE__) require_relative "base"
module VagrantPlugins module VagrantPlugins
module Chef module Chef

View File

@ -2,7 +2,7 @@ require "log4r"
require "vagrant/util/counter" require "vagrant/util/counter"
require File.expand_path("../base", __FILE__) require_relative "base"
module VagrantPlugins module VagrantPlugins
module Chef module Chef