Class: Bunup::Services::ValidateGitVersion
- Inherits:
-
Object
- Object
- Bunup::Services::ValidateGitVersion
- Defined in:
- lib/bunup/services/validate_git_version.rb
Overview
Validate that version of gem installed from a git source is valid
Constant Summary collapse
- SHA_REGEX =
/\b[0-9a-f]{5,40}\b/.freeze
Instance Method Summary collapse
-
#initialize(version_string) ⇒ ValidateGitVersion
constructor
A new instance of ValidateGitVersion.
- #perform ⇒ Object
Constructor Details
#initialize(version_string) ⇒ ValidateGitVersion
Returns a new instance of ValidateGitVersion.
8 9 10 |
# File 'lib/bunup/services/validate_git_version.rb', line 8 def initialize(version_string) @version_string = version_string end |
Instance Method Details
#perform ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/bunup/services/validate_git_version.rb', line 12 def perform version, sha = @version_string.split(' ') return false if sha.nil? ::Gem::Version.correct?(version) && sha.match?(SHA_REGEX) end |