Sha256: db18cc0c58ebdee85b339f0c9438d0f6ca82f47f0260dc009f666973feac213e

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rrjj-0.0.1 lib/guard_helpers/file_helper.rb