Sha256: a42d9e5609b82ee407ad9f18d73ec0a52f186d5569666c7da76a91924c3d15d6
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
module Validator module_function def has_hg? unless Kernel.system('which hg > /dev/null') abort 'mercurial is required to install.' end return true end def version? if get_version.nil? 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 has_version?(version = get_version) abort "#{version} is not installed." unless version_include?(version) return true end private def get_version version_regex = /\Av7-.+\z|\A(\d\.\d(a|b){0,1}(\.\d+){0,1})\z/ regex = /(\Astart\z|\Atip\z|\Asystem\z|\Alatest\z|#{version_regex})/ version = $*.find { |v| v =~ regex } return Version.format(version) end def version_include?(version) return Version.versions.include?(version) || use_system?(version) end def use_system?(version) return version == 'system' && $*.include?('use') end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vvm-rb-0.2.2 | lib/vvm-rb/validator.rb |
vvm-rb-0.2.1 | lib/vvm-rb/validator.rb |
vvm-rb-0.2.0 | lib/vvm-rb/validator.rb |