diff options
author | Katarzyna Kobierska <kkobierska@gmail.com> | 2016-08-29 16:07:19 +0300 |
---|---|---|
committer | Katarzyna Kobierska <kkobierska@gmail.com> | 2016-09-07 13:10:49 +0300 |
commit | 2c8b830fdbf749e8bb7461d5c3ce4699b77ce3ca (patch) | |
tree | 10e0c44ca36349acf1378d3191267c9d1493b321 /lib/ci | |
parent | bbba62fa51419b14be4f39873afdd45b5b248764 (diff) |
Code refactoring
Diffstat (limited to 'lib/ci')
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index 40c84b93799..c547193ce4c 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -78,12 +78,16 @@ module Ci } end - def self.errors(content) - begin - Ci::GitlabCiYamlProcessor.new(content) - nil - rescue ValidationError, Psych::SyntaxError => e - e.message + def self.validation_message(content) + if content.blank? + 'Please provide content of .gitlab-ci.yml' + else + begin + Ci::GitlabCiYamlProcessor.new(content) + nil + rescue ValidationError, Psych::SyntaxError => e + e.message + end end end |