Sha256: a19ae0b49de3aad308260935832b207fb948af05d99f0c2f90d7a326d54721d8

Contents?: true

Size: 759 Bytes

Versions: 6

Compression:

Stored size: 759 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Packwerk
  # This class handles loading extensions to packwerk using the `require` directive
  # in the `packwerk.yml` configuration.
  module ExtensionLoader
    class << self
      extend T::Sig
      sig { params(require_directive: String, config_dir_path: String).void }
      def load(require_directive, config_dir_path)
        # We want to transform the require directive to behave differently
        # if it's a specific local file being required versus a gem
        if require_directive.start_with?(".")
          require File.join(config_dir_path, require_directive)
        else
          require require_directive
        end
      end
    end
  end

  private_constant :ExtensionLoader
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
packwerk-3.2.2 lib/packwerk/extension_loader.rb
packwerk-3.2.1 lib/packwerk/extension_loader.rb
packwerk-3.2.0 lib/packwerk/extension_loader.rb
packwerk-3.1.0 lib/packwerk/extension_loader.rb
packwerk-3.0.1 lib/packwerk/extension_loader.rb
packwerk-3.0.0 lib/packwerk/extension_loader.rb