lib/owners.rb in owners-0.0.9 vs lib/owners.rb in owners-0.1.0
- old
+ new
@@ -1,9 +1,10 @@
require "delegate"
require "pathname"
require "set"
require "thor"
+require "timeout"
require_relative "owners/cli"
require_relative "owners/config"
require_relative "owners/owner"
require_relative "owners/search"
require_relative "owners/subscription"
@@ -26,11 +27,11 @@
# 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
+ Search.new(files).owners
end
# Accepts a git ref and an optional base ref and returns
# an array of owners that have subscribed to the changes.
#
@@ -48,9 +49,18 @@
_, _, sha, file = line.split(/\s+/, 4)
contents = `git show #{sha}`
hash.update(file => contents)
end
- Search.new(files, configs).results
+ Search.new(files, configs).owners
+ end
+
+ # Accepts a list of file paths and returns an array of
+ # the ones that do not have subscribed owners.
+ #
+ # @api public
+ def missing_for(*files)
+ paths = Search.new(files, shallow: true).paths
+ files - paths
end
end
end