Sha256: 6085c26928a6e098b561598a8a025ecbab01cf68e146a256475c62c5670b19ec
Contents?: true
Size: 813 Bytes
Versions: 12
Compression:
Stored size: 813 Bytes
Contents
module Hobo module Helper def locate(pattern, opts = {}, &block) match = nil Dir.chdir Hobo.project_path do match = locate_git(pattern, &block) end return true if match Hobo.ui.warning opts[:missing] if opts[:missing] return false end private def locate_git pattern, &block args = [ 'git', 'ls-files', pattern ] output = Hobo::Helper.shell *args, :capture => true paths = output.split("\n") found = false paths.each do |path| path.strip! Dir.chdir File.dirname(path) do Hobo::Logging.logger.debug "helper.locator: Found #{path} for #{pattern}" yield File.basename(path), path end found = true end return found end end end include Hobo::Helper
Version data entries
12 entries across 12 versions & 1 rubygems