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_relative "base"
module VagrantPlugins
module Chef
module Config

View File

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

View File

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

View File

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

View File

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