26 lines
929 B
Ruby
26 lines
929 B
Ruby
module Backlog
|
|
# Filesystem-only detection helpers for the `inspect` subcommand: does the
|
|
# repo already have in-repo issue files. Deliberately narrow — network
|
|
# checks (Planka, tea, gh) stay in bin/os-backlog where the rest of the
|
|
# CLI's IO lives; this class exists so that piece is unit-testable without
|
|
# touching the network or shelling out.
|
|
class Inspector
|
|
CANDIDATE_DIRS = ["docs/issues"].freeze
|
|
CANDIDATE_FILES = ["ISSUES.md"].freeze
|
|
|
|
# @param repo_path [String] absolute path to the repo
|
|
# @return [Array<String>] repo-relative paths of in-repo issue tracking
|
|
# found (empty if none)
|
|
def self.issue_files(repo_path)
|
|
found = []
|
|
CANDIDATE_DIRS.each do |rel|
|
|
found << rel if Dir.exist?(File.join(repo_path, rel))
|
|
end
|
|
CANDIDATE_FILES.each do |rel|
|
|
found << rel if File.exist?(File.join(repo_path, rel))
|
|
end
|
|
found
|
|
end
|
|
end
|
|
end
|