Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
34bebde8
Commit
34bebde8
authored
Feb 20, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add base classes to evaluate variables expressions
parent
4efcc061
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
2 deletions
+86
-2
lib/gitlab/ci/pipeline/expression/equality.rb
lib/gitlab/ci/pipeline/expression/equality.rb
+21
-0
lib/gitlab/ci/pipeline/expression/lexer.rb
lib/gitlab/ci/pipeline/expression/lexer.rb
+16
-0
lib/gitlab/ci/pipeline/expression/statement.rb
lib/gitlab/ci/pipeline/expression/statement.rb
+2
-2
lib/gitlab/ci/pipeline/expression/string.rb
lib/gitlab/ci/pipeline/expression/string.rb
+22
-0
lib/gitlab/ci/pipeline/expression/variable.rb
lib/gitlab/ci/pipeline/expression/variable.rb
+21
-0
spec/lib/gitlab/ci/pipeline/expression/equality_spec.rb
spec/lib/gitlab/ci/pipeline/expression/equality_spec.rb
+0
-0
spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb
spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb
+4
-0
No files found.
lib/gitlab/ci/pipeline/expression/equality.rb
0 → 100644
View file @
34bebde8
module
Gitlab
module
Ci
module
Pipeline
module
Expression
class
Equality
PATTERN
=
/==/
.
freeze
def
initialize
(
left
,
right
)
end
def
evaluate
(
**
variables
)
@left
.
evaluate
(
variables
)
==
@right
.
evaluate
(
variables
)
end
def
self
.
build
(
string
)
end
end
end
end
end
end
lib/gitlab/ci/pipeline/expression/lexer.rb
0 → 100644
View file @
34bebde8
module
Gitlab
module
Ci
module
Pipeline
module
Expression
class
Lexer
def
initialize
(
statement
)
@statement
=
statement
end
def
tokenize
end
end
end
end
end
end
lib/gitlab/ci/pipeline/expression/statement.rb
View file @
34bebde8
...
...
@@ -8,10 +8,10 @@ module Gitlab
@statement
=
statement
end
def
error
s
def
variable
s
end
def
matches?
def
evaluate
end
end
end
...
...
lib/gitlab/ci/pipeline/expression/string.rb
0 → 100644
View file @
34bebde8
module
Gitlab
module
Ci
module
Pipeline
module
Expression
class
String
PATTERN
=
/("|')(?<value>.+)('|")/
.
freeze
def
initialize
(
value
)
@value
=
value
end
def
evaluate
(
**
_
)
@value
.
to_s
end
def
self
.
build
(
string
)
end
end
end
end
end
end
lib/gitlab/ci/pipeline/expression/variable.rb
0 → 100644
View file @
34bebde8
module
Gitlab
module
Ci
module
Pipeline
module
Expression
class
Equality
PATTERN
=
/$(?<name>\w+)/
.
freeze
def
initialize
(
value
)
@value
=
value
end
def
evaluate
(
**
variables
)
end
def
self
.
build
(
string
)
end
end
end
end
end
end
spec/lib/gitlab/ci/pipeline/expression/equality_spec.rb
0 → 100644
View file @
34bebde8
spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb
0 → 100644
View file @
34bebde8
require
'spec_helper'
describe
Gitlab
::
Ci
::
Pipeline
::
Expression
::
Statement
do
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment