Sha256: 0420c9853ddc5a061fd5618e3a81a769d2950cc49e023a9802fe069ad0128596
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
require "delegate" require "pathname" require "set" require "thor" require_relative "owners/cli" require_relative "owners/config" require_relative "owners/owner" require_relative "owners/search" require_relative "owners/subscription" require_relative "owners/tree" require_relative "owners/version" module Owners class << self # @api public attr_writer :file # The name of the file used to store ownership # subscriptions. Defaults to OWNERS. # # @api public def file @file ||= "OWNERS" end # Accepts a list of file paths and returns an array of # owners that have subscribed to the specified files. # # @api public def for(*files) Search.new(files).results end # Accepts a git ref and an optional base ref and returns # an array of owners that have subscribed to the changes. # # The base ref defaults to "master". # # @api public def for_diff(ref, base = "master") files = `git diff --name-only #{base}...#{ref}`.split("\n") # TODO: why doesn't this work? It works in the command line... # blobs = `git ls-tree -r #{ref} | **/#{file}`.split("\n") blobs = `git ls-tree -r #{ref} | egrep "(^|/)#{file}$"`.split("\n") configs = blobs.reduce({}) do |hash, line| _, _, sha, file = line.split(/\s+/, 4) contents = `git show #{sha}` hash.update(file => contents) end Search.new(files, configs).results end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
owners-0.0.9 | lib/owners.rb |