Sha256: b4e5f4194ebfffbc22bc5dc81b867726fe9861a2d8f02b10f448be6872d1802c

Contents?: true

Size: 900 Bytes

Versions: 3

Compression:

Stored size: 900 Bytes

Contents

class Version
  def self.list
    Dir.chdir(get_vimorg_dir) do
      list = `hg tags`.split.reverse
      return list.values_at(* list.each_index.select { |i| i.odd? })
    end
  end

  def self.versions
    output   = []
    vims_dir = get_vims_dir
    return output unless File.exist?(vims_dir)
    Dir.glob(File.join(vims_dir, 'v*')).sort.each do |d|
      output << File.basename(d)
    end
    return output
  end

  def self.latest
    return list.select { |v| v =~ /\Av7-.+\z/ }.last
  end

  def self.current
    c = get_current_dir
    return File.exist?(c) ? File.basename(File.readlink(c)) : 'system'
  end

  def self.convert(version)
    return "v#{version.gsub(/\./, '-')}"
  end

  def self.format(version)
    case version
    when /\Alatest\z/
      version = latest
    when /\A(\d\.\d(a|b){0,1}(\.\d+){0,1})\z/
      version = convert(version)
    end
    return version
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vvm-rb-0.2.2 lib/vvm-rb/version.rb
vvm-rb-0.2.1 lib/vvm-rb/version.rb
vvm-rb-0.2.0 lib/vvm-rb/version.rb