Module: FPM::Fry::Source

Defined in:
lib/fpm/fry/source.rb,
lib/fpm/fry/source/dir.rb,
lib/fpm/fry/source/git.rb,
lib/fpm/fry/source/archive.rb,
lib/fpm/fry/source/patched.rb

Defined Under Namespace

Modules: Null Classes: Archive, CacheFailed, Dir, Git, Patched

Class Method Summary collapse

Class Method Details

.guess_regex(rx, url) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



47
48
49
50
51
# 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) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns prefix.

Parameters:

  • dir (String)

    directory

Returns:

  • (String)

    prefix



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 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