Sha256: eef0837310aa2a019c3f4de788a47cfb494af83ce54b5faffae20f6bc5deb1f8

Contents?: true

Size: 764 Bytes

Versions: 21

Compression:

Stored size: 764 Bytes

Contents

module Vagrant
  module Util
    # Eases the processes of loading specific files then globbing
    # the rest from a specified directory.
    module GlobLoader
      # Glob requires all ruby files in a directory, optionally loading select
      # files initially (since others may depend on them).
      #
      # @param [String] dir The directory to glob
      # @param [Array<String>] initial_files Initial files (relative to `dir`)
      #   to load
      def self.glob_require(dir, initial_files=[])
        initial_files.each do |file|
          require File.expand_path(file, dir)
        end

        # Glob require the rest
        Dir[File.join(dir, "**", "*.rb")].each do |f|
          require File.expand_path(f)
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
vagrant-0.6.0 lib/vagrant/util/glob_loader.rb