class Dep::Lib

Public Class Methods

[](line) click to toggle source
# File bin/dep, line 40
def self.[](line)
  if line.strip =~ /^(\S+) -v (\S+)$/
    return new($1, $2)
  elsif line.strip =~ /^(\S+) --git '?([^']+)'?$/
    return GitLib.new($1, $2)
  elsif line.strip =~ /^(\S+) --github '?([^']+)'?$/
    return GitHubLib.new($1, $2)
  elsif line.strip =~ /^(\S+) -v (\S+) --source '?([^']+)'?$/
    return SourceLib.new($1, $2, $3)
  else
    abort("Invalid requirement found: #{line}")
  end
end

Public Instance Methods

==(other) click to toggle source
# File bin/dep, line 64
def ==(other)
  to_s == other.to_s
end
available?() click to toggle source
# File bin/dep, line 54
def available?
  Gem::Specification.find_by_name(name, version)
rescue Gem::LoadError
  return false
end
install() click to toggle source
# File bin/dep, line 68
def install
  "gem install #{to_s}"
end
to_s() click to toggle source
# File bin/dep, line 60
def to_s
  "#{name} -v #{version}"
end