Class: Braid::Operations::Proxy
- Inherits:
-
Object
- Object
- Braid::Operations::Proxy
- Extended by:
- T::Sig
- Includes:
- Singleton
- Defined in:
- lib/braid/operations.rb
Overview
The command proxy is meant to encapsulate commands such as git, that work with subcommands.
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
Methods included from T::Sig
Class Method Details
.command ⇒ Object
76 77 78 |
# File 'lib/braid/operations.rb', line 76 def self.command raise InternalError, 'Proxy.command not overridden' end |
Instance Method Details
#require_version(required) ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/braid/operations.rb', line 88 def require_version(required) # Gem::Version is intended for Ruby gem versions, but various web sites # suggest it as a convenient way of comparing version strings in # general. None of the fine points of its semantics compared to those # of Git version numbers seem likely to cause a problem for Braid. Gem::Version.new(version) >= Gem::Version.new(required) end |
#require_version!(required) ⇒ Object
97 98 99 |
# File 'lib/braid/operations.rb', line 97 def require_version!(required) require_version(required) || raise(VersionTooLow.new(self.class.command, version, required)) end |
#version ⇒ Object
82 83 84 85 |
# File 'lib/braid/operations.rb', line 82 def version _, out, _ = exec!([self.class.command, '--version']) out.sub(/^.* version/, '').strip.sub(/ .*$/, '').strip end |