module FPM::Fry::Source

Public Class Methods

guess_regex(rx, url) click to toggle source

@api private

# File lib/fpm/fry/source.rb, line 47
def guess_regex(rx, url)
  if m = rx.match(url.to_s)
    return m[0].size
  end
end
prefix(dir) click to toggle source

@api private @param dir [String] directory @return [String] prefix

# File lib/fpm/fry/source.rb, line 56
def prefix(dir)
  e = ::Dir.entries(dir)
  if e.size != 3
    return ""
  end
  other = (e - ['.','..']).first
  path = File.join(dir, other)
  if File.directory?( path )
    pf = prefix(path)
    if pf == ""
      return other
    else
      return File.join(other, pf)
    end
  else
    return ""
  end
end