Sha256: c1d772484435a9734e1485387a98bd03df80b3ded93dcd04229c5b9c494ed812

Contents?: true

Size: 529 Bytes

Versions: 2

Compression:

Stored size: 529 Bytes

Contents

module Bait
  class Project
    def initialize root_path
      unless Dir.exists? root_path
        raise "Expected a valid directory"
      end
      @path = Pathname.new(root_path)
    end

    def glob pattern
      cache ||= {}
      if value = cache[pattern]
        value
      else
        cache[pattern] = Dir.glob @path.join("**/#{pattern}")
      end
    end

    def ordered_dependencies file_pattern, klass
      orderer = klass.new(glob(file_pattern), self)
      orderer.start
      orderer.order
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bait-0.3.2 lib/bait/project.rb
bait-0.3.1 lib/bait/project.rb