require "guard_helpers/base_helper" require "ro_core_ext/string" module ::GuardHelpers module FileHelper include ::GuardHelpers::BaseHelper module ClassMethods def select_file(video) Find.find("origin") do |p| if test(?f, p) basename = File.basename(p).gsub(%r{\.\w+$}, "") if basename.match(%r{#{video.implicit}}) return p end end end end def handle_file(dir, video, cmd) ::Find.find(dir) do |p| if test(?f, p) basename = File.basename(p).gsub(%r{\.\w+$}, "") if basename.match(%r{#{video.implicit}}) bash "#{cmd} #{p}" return end end end end end end end