Sha256: 08a636d48c1ba7a5c0829cbc1d43f30c58981ba8ca66ad3ba7de1a33a4e29f7d
Contents?: true
Size: 925 Bytes
Versions: 2
Compression:
Stored size: 925 Bytes
Contents
# frozen_string_literal: true module Pbmenv class UseVersionService class VersionNotFoundError < StandardError; end attr_accessor :version def initialize(version: ) self.version = version end def execute! throw_error_if_has_not_version relink_current_path end private def throw_error_if_has_not_version version_pathname = VersionPathname.new(version) if !File.exists?(version_pathname.version_path_without_v) && !File.exists?(version_pathname.version_path) raise UseVersionService::VersionNotFoundError end end def relink_current_path version_pathname = VersionPathname.new(version) if File.symlink?(VersionPathname.current) Helper.system_and_puts "unlink #{VersionPathname.current}" end Helper.system_and_puts "ln -s #{version_pathname.version_path} #{VersionPathname.current}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pbmenv-0.1.11 | lib/pbmenv/services/use_version_service.rb |
pbmenv-0.1.10 | lib/pbmenv/use_version_service.rb |