Sha256: d652e6671d82182e9e879b3166420ad1e24c4a380375e553df95646319d05c7d
Contents?: true
Size: 930 Bytes
Versions: 1
Compression:
Stored size: 930 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 match unless block_given? 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! end return paths unless block_given? paths.each do |path| 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hobo-inviqa-0.0.15 | lib/hobo/helper/file_locator.rb |