Class: Rosette::Core::Validators::CommitValidator
- Defined in:
- lib/rosette/core/validators/commit_validator.rb
Overview
Validates the existence of a commit.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Validator
Instance Method Summary collapse
-
#valid?(commit_str, repo_name, configuration) ⇒ Boolean
Returns true if the commit is valid, false otherwise.
Methods inherited from Validator
Constructor Details
This class inherits a constructor from Rosette::Core::Validators::Validator
Instance Method Details
#valid?(commit_str, repo_name, configuration) ⇒ Boolean
Returns true if the commit is valid, false otherwise. Also returns false if repo_name isn’t a valid repo configured in configuration.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rosette/core/validators/commit_validator.rb', line 26 def valid?(commit_str, repo_name, configuration) if repo_config = configuration.get_repo(repo_name) if commit_str commit = repo_config.repo.get_rev_commit(commit_str) validate_commit(commit) else << "Nil commit passed." false end else << "Unable to find repo #{repo_name}." false end rescue Java::OrgEclipseJgitErrors::MissingObjectException, Java::JavaLang::IllegalArgumentException << "Unable to find commit '#{commit_str}'." false end |