Class: RosettAi::Thor::Tasks::Tooling
- Inherits:
-
Thor
- Object
- Thor
- RosettAi::Thor::Tasks::Tooling
- Defined in:
- lib/rosett_ai/thor/tasks/tooling.rb
Overview
Thor tasks for CI/CD tooling validation
Instance Method Summary collapse
Instance Method Details
#check_versions ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/rosett_ai/thor/tasks/tooling.rb', line 120 def check_versions project_dir = [:project_dir] || ENV.fetch('RAI_ORIGINAL_PWD', Dir.pwd) all_consistent = check_ruby_versions(project_dir) if [:gems] gem_consistent = check_gem_versions(project_dir) all_consistent &&= gem_consistent end raise ::Thor::Error, t('version_check_failed') unless all_consistent end |
#validate(name = nil) ⇒ Object
77 78 79 80 81 82 83 84 |
# File 'lib/rosett_ai/thor/tasks/tooling.rb', line 77 def validate(name = nil) name = RosettAi::TextSanitizer.normalize_nfc(name) if name files = files_to_validate(name) return puts Rainbow(t('no_tooling_files')).yellow if files.empty? all_valid = validate_tooling_files(files) raise ::Thor::Error, t('validation_failed') unless all_valid end |
#validate_ci_yaml ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rosett_ai/thor/tasks/tooling.rb', line 45 def validate_ci_yaml validator = RosettAi::Gitlab::Validators::SupplementaryGitlabCiYamlValidator.new( project_dir: [:project_dir] || ENV.fetch('RAI_ORIGINAL_PWD', Dir.pwd) ) results = validator.validate if results[:valid].empty? && results[:invalid].empty? puts Rainbow(t('no_ci_files')).yellow return end print_ci_results(results) raise ::Thor::Error, t('ci_validation_failed') unless results[:invalid].empty? end |