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