Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Use require_relative everywhere for perf boosts #2150

Merged
merged 1 commit into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/chef-dk/builtin_commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

require "chef-dk/dist"
require_relative "dist"

ChefDK.commands do |c|
c.builtin "exec", :Exec, require_path: "chef-dk/command/exec",
Expand Down
8 changes: 4 additions & 4 deletions lib/chef-dk/chef_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
# limitations under the License.
#

require "chef-dk/exceptions"
require "chef-dk/service_exceptions"
require_relative "exceptions"
require_relative "service_exceptions"
require "chef/policy_builder/dynamic"
require "chef"

require "chef-dk/command/generator_commands/chef_exts/quieter_doc_formatter"
require "chef-dk/command/generator_commands/chef_exts/recipe_dsl_ext"
require_relative "command/generator_commands/chef_exts/quieter_doc_formatter"
require_relative "command/generator_commands/chef_exts/recipe_dsl_ext"

module ChefDK

Expand Down
14 changes: 7 additions & 7 deletions lib/chef-dk/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
# limitations under the License.
#

require "mixlib/cli"
require "chef-dk/version"
require "chef-dk/commands_map"
require "chef-dk/builtin_commands"
require "chef-dk/helpers"
require "chef-dk/ui"
require "chef-dk/dist"
require "mixlib/cli" unless defined?(Mixlib::CLI)
require_relative "version"
require_relative "commands_map"
require_relative "builtin_commands"
require_relative "helpers"
require_relative "ui"
require_relative "dist"
require "chef/util/path_helper"
require "chef/mixin/shell_out"
require "bundler"
Expand Down
8 changes: 4 additions & 4 deletions lib/chef-dk/command/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
# limitations under the License.
#

require "mixlib/cli"
require "chef-dk/helpers"
require "chef-dk/version"
require "mixlib/cli" unless defined?(Mixlib::CLI)
require_relative "../helpers"
require_relative "../version"
require "chef/exceptions"
require "license_acceptance/acceptor"
require "license_acceptance/cli_flags/mixlib_cli"
require "chef-dk/dist"
require_relative "../dist"

module ChefDK
module Command
Expand Down
10 changes: 5 additions & 5 deletions lib/chef-dk/command/clean_policy_cookbooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
# limitations under the License.
#

require "chef-dk/command/base"
require "chef-dk/ui"
require "chef-dk/configurable"
require "chef-dk/policyfile_services/clean_policy_cookbooks"
require "chef-dk/dist"
require_relative "base"
require_relative "../ui"
require_relative "../configurable"
require_relative "../policyfile_services/clean_policy_cookbooks"
require_relative "../dist"

module ChefDK
module Command
Expand Down
10 changes: 5 additions & 5 deletions lib/chef-dk/command/clean_policy_revisions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
# limitations under the License.
#

require "chef-dk/command/base"
require "chef-dk/ui"
require "chef-dk/configurable"
require "chef-dk/policyfile_services/clean_policies"
require "chef-dk/dist"
require_relative "base"
require_relative "../ui"
require_relative "../configurable"
require_relative "../policyfile_services/clean_policies"
require_relative "../dist"

module ChefDK
module Command
Expand Down
10 changes: 5 additions & 5 deletions lib/chef-dk/command/delete_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
# limitations under the License.
#

require "chef-dk/command/base"
require "chef-dk/ui"
require "chef-dk/configurable"
require "chef-dk/policyfile_services/rm_policy"
require "chef-dk/dist"
require_relative "base"
require_relative "../ui"
require_relative "../configurable"
require_relative "../policyfile_services/rm_policy"
require_relative "../dist"

module ChefDK
module Command
Expand Down
10 changes: 5 additions & 5 deletions lib/chef-dk/command/delete_policy_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
# limitations under the License.
#

require "chef-dk/command/base"
require "chef-dk/ui"
require "chef-dk/configurable"
require "chef-dk/policyfile_services/rm_policy_group"
require "chef-dk/dist"
require_relative "base"
require_relative "../ui"
require_relative "../configurable"
require_relative "../policyfile_services/rm_policy_group"
require_relative "../dist"

module ChefDK
module Command
Expand Down
8 changes: 4 additions & 4 deletions lib/chef-dk/command/describe_cookbook.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "chef-dk/command/base"
require "chef-dk/ui"
require "chef-dk/cookbook_profiler/identifiers"
require "chef-dk/dist"
require_relative "base"
require_relative "../ui"
require_relative "../cookbook_profiler/identifiers"
require_relative "../dist"

module ChefDK
class IdDumper
Expand Down
16 changes: 8 additions & 8 deletions lib/chef-dk/command/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
# limitations under the License.
#

require "chef-dk/command/base"
require "chef-dk/ui"
require "chef-dk/pager"
require "chef-dk/policyfile/differ"
require "chef-dk/policyfile/comparison_base"
require "chef-dk/policyfile/storage_config"
require "chef-dk/configurable"
require "chef-dk/dist"
require_relative "base"
require_relative "../ui"
require_relative "../pager"
require_relative "../policyfile/differ"
require_relative "../policyfile/comparison_base"
require_relative "../policyfile/storage_config"
require_relative "../configurable"
require_relative "../dist"
require "chef/server_api"

module ChefDK
Expand Down
12 changes: 6 additions & 6 deletions lib/chef-dk/command/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
# limitations under the License.
#

require "chef-dk/command/base"
require "chef-dk/cookbook_omnifetch"
require "chef-dk/ui"
require "chef-dk/version"
require "chef-dk/dist"
require "mixlib/shellout"
require_relative "base"
require_relative "../cookbook_omnifetch"
require_relative "../ui"
require_relative "../version"
require_relative "../dist"
require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
require "yaml"

module ChefDK
Expand Down
6 changes: 3 additions & 3 deletions lib/chef-dk/command/exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# limitations under the License.
#

require "chef-dk/command/base"
require "chef-dk/dist"
require "mixlib/shellout"
require_relative "base"
require_relative "../dist"
require "mixlib/shellout" unless defined?(Mixlib::ShellOut)

module ChefDK
module Command
Expand Down
10 changes: 5 additions & 5 deletions lib/chef-dk/command/export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
# limitations under the License.
#

require "chef-dk/command/base"
require "chef-dk/ui"
require "chef-dk/policyfile_services/export_repo"
require "chef-dk/configurable"
require "chef-dk/dist"
require_relative "base"
require_relative "../ui"
require_relative "../policyfile_services/export_repo"
require_relative "../configurable"
require_relative "../dist"

module ChefDK
module Command
Expand Down
8 changes: 4 additions & 4 deletions lib/chef-dk/command/gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
# limitations under the License.
#

require "chef-dk/command/base"
require "chef-dk/dist"
require "rubygems"
require_relative "base"
require_relative "../dist"
require "rubygems" unless defined?(Gem)
require "rubygems/gem_runner"
require "rubygems/exceptions"
require "pp"
require "pp" unless defined?(PP)

module ChefDK
module Command
Expand Down
32 changes: 16 additions & 16 deletions lib/chef-dk/command/generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
# limitations under the License.
#

require "chef-dk/command/base"
require "chef-dk/command/generator_commands"
require "chef-dk/command/generator_commands/base"
require "chef-dk/command/generator_commands/cookbook_code_file"
require "chef-dk/command/generator_commands/cookbook"
require "chef-dk/command/generator_commands/attribute"
require "chef-dk/command/generator_commands/cookbook_file"
require "chef-dk/command/generator_commands/helpers"
require "chef-dk/command/generator_commands/resource"
require "chef-dk/command/generator_commands/recipe"
require "chef-dk/command/generator_commands/template"
require "chef-dk/command/generator_commands/repo"
require "chef-dk/command/generator_commands/policyfile"
require "chef-dk/command/generator_commands/generator_generator"
require "chef-dk/command/generator_commands/build_cookbook"
require "chef-dk/dist"
require_relative "base"
require_relative "generator_commands"
require_relative "generator_commands/base"
require_relative "generator_commands/cookbook_code_file"
require_relative "generator_commands/cookbook"
require_relative "generator_commands/attribute"
require_relative "generator_commands/cookbook_file"
require_relative "generator_commands/helpers"
require_relative "generator_commands/resource"
require_relative "generator_commands/recipe"
require_relative "generator_commands/template"
require_relative "generator_commands/repo"
require_relative "generator_commands/policyfile"
require_relative "generator_commands/generator_generator"
require_relative "generator_commands/build_cookbook"
require_relative "../dist"

module ChefDK
module Command
Expand Down
10 changes: 5 additions & 5 deletions lib/chef-dk/command/generator_commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
# limitations under the License.
#

require "mixlib/cli"
require "mixlib/cli" unless defined?(Mixlib::CLI)
require "rbconfig"
require "pathname"
require "chef-dk/command/base"
require "chef-dk/chef_runner"
require "chef-dk/generator"
require "pathname" unless defined?(Pathname)
require_relative "base"
require_relative "../chef_runner"
require_relative "../generator"

module ChefDK
module Command
Expand Down
4 changes: 2 additions & 2 deletions lib/chef-dk/command/generator_commands/attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# limitations under the License.
#

require "chef-dk/command/generator_commands/cookbook_code_file"
require "chef-dk/dist"
require_relative "cookbook_code_file"
require_relative "../../dist"

module ChefDK
module Command
Expand Down
8 changes: 4 additions & 4 deletions lib/chef-dk/command/generator_commands/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
# limitations under the License.
#

require "chef-dk/configurable"
require "chef-dk/command/generator_commands"
require_relative "../../configurable"
require_relative "../generator_commands"

require "chef-dk/command/generator_commands/chef_exts/recipe_dsl_ext"
require "chef-dk/command/generator_commands/chef_exts/generator_desc_resource"
require_relative "chef_exts/recipe_dsl_ext"
require_relative "chef_exts/generator_desc_resource"

module ChefDK
module Command
Expand Down
4 changes: 2 additions & 2 deletions lib/chef-dk/command/generator_commands/build_cookbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# limitations under the License.
#

require "chef-dk/command/generator_commands/base"
require "chef-dk/dist"
require_relative "base"
require_relative "../../dist"

module ChefDK
module Command
Expand Down
4 changes: 2 additions & 2 deletions lib/chef-dk/command/generator_commands/cookbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# limitations under the License.
#

require "chef-dk/command/generator_commands/base"
require "chef-dk/dist"
require_relative "base"
require_relative "../../dist"

module ChefDK
module Command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

require "chef-dk/command/generator_commands/base"
require_relative "base"

module ChefDK
module Command
Expand Down
4 changes: 2 additions & 2 deletions lib/chef-dk/command/generator_commands/cookbook_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# limitations under the License.
#

require "chef-dk/command/generator_commands/cookbook_code_file"
require "chef-dk/dist"
require_relative "cookbook_code_file"
require_relative "../../dist"

module ChefDK
module Command
Expand Down
10 changes: 5 additions & 5 deletions lib/chef-dk/command/generator_commands/generator_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
# limitations under the License.
#

require "fileutils"
require "fileutils" unless defined?(FileUtils)

require "chef-dk/configurable"
require "chef-dk/ui"
require "chef-dk/command/generator_commands/base"
require "chef-dk/dist"
require_relative "../../configurable"
require_relative "../../ui"
require_relative "base"
require_relative "../../dist"

module ChefDK
module Command
Expand Down
4 changes: 2 additions & 2 deletions lib/chef-dk/command/generator_commands/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# limitations under the License.
#

require "chef-dk/command/generator_commands/cookbook_code_file"
require "chef-dk/dist"
require_relative "cookbook_code_file"
require_relative "../../dist"

module ChefDK
module Command
Expand Down
Loading