Sha256: 86b10fad6912f5bd7f4b7cf58230ee4e01a28f5e964d40ee2c6562a6b23ea00a

Contents?: true

Size: 817 Bytes

Versions: 1

Compression:

Stored size: 817 Bytes

Contents

module Validator
  module_function

  def check_hg
    unless Kernel.system('which hg > /dev/null')
      abort 'mercurial is required to install.'
    end
    return true
  end

  def check_tag
    unless get_version
      abort 'undefined vim version. please run [ vvm-rb list ].'
    end
    return true
  end

  def new_version?(version = get_version)
    abort "#{version} is already installed." if version_include?(version)
    return true
  end

  def version_exist?(version = get_version)
    abort "#{version} is not installed." unless version_include?(version)
    return true
  end

  private

  def get_version
    return $*.find { |v| v =~ /(^start$|^tip$|^v7-.+$|^system$|^latest$)/ }
  end

  def version_include?(version)
    return Version.versions.include?(version) || version == 'system'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vvm-rb-0.0.11 lib/vvm-rb/validator.rb