Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-21 16:09:43 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-21 16:09:43 +0300
commit890df1b1f09e6ce080fdf9d792882ed133e28882 (patch)
treee63693bb399113be7ef79b436ce01cdc4bd6e0dc /lib/gitlab/ci/pipeline/expression
parent2c4aa50463ed411b14003f9d929c1e03518953bf (diff)
Add code that evaluates pipelines expressions
Diffstat (limited to 'lib/gitlab/ci/pipeline/expression')
-rw-r--r--lib/gitlab/ci/pipeline/expression/statement.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/gitlab/ci/pipeline/expression/statement.rb b/lib/gitlab/ci/pipeline/expression/statement.rb
index 417b3f806b1..5d37d3ff0b0 100644
--- a/lib/gitlab/ci/pipeline/expression/statement.rb
+++ b/lib/gitlab/ci/pipeline/expression/statement.rb
@@ -31,8 +31,8 @@ module Gitlab
end
##
- # Our syntax is very simple, so we don't need yet to implement a
- # recurisive parser, we can use the most simple approach to create
+ # Our syntax is very simple, so we don't yet need to implement a
+ # recursive parser, we can use the most simple approach to create
# a reverse descent parse tree "by hand".
#
def parse_tree
@@ -42,7 +42,7 @@ module Gitlab
raise ParserError, 'Unknown pipeline expression!'
end
- if lexemes.many?
+ if tokens.many?
Expression::Equals.new(tokens.first.build, tokens.last.build)
else
tokens.first.build
@@ -50,6 +50,11 @@ module Gitlab
end
def evaluate
+ if tokens.many?
+ parse_tree.evaluate
+ else
+ parse_tree.evaluate.present?
+ end
end
end
end