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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
097550f0
Commit
097550f0
authored
Jul 13, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fabricate CI entry with value, set attributes later
parent
de4c9a27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
lib/gitlab/ci/config/node/factory.rb
lib/gitlab/ci/config/node/factory.rb
+20
-8
No files found.
lib/gitlab/ci/config/node/factory.rb
View file @
097550f0
...
@@ -32,27 +32,39 @@ module Gitlab
...
@@ -32,27 +32,39 @@ module Gitlab
raise
InvalidFactory
unless
defined?
(
@value
)
raise
InvalidFactory
unless
defined?
(
@value
)
raise
InvalidFactory
unless
defined?
(
@parent
)
raise
InvalidFactory
unless
defined?
(
@parent
)
attributes
=
{
parent:
@parent
,
global:
@parent
.
global
}
attributes
.
merge!
(
@attributes
)
##
##
# We assume that unspecified entry is undefined.
# We assume that unspecified entry is undefined.
# See issue #18775.
# See issue #18775.
#
#
if
@value
.
nil?
if
@value
.
nil?
Node
::
Undefined
.
new
(
fabricate_undefined
(
attributes
))
Node
::
Undefined
.
new
(
fabricate_undefined
)
else
else
@node
.
new
(
@value
,
attributes
)
fabricate
(
@node
,
@value
)
end
end
end
end
private
private
def
fabricate_undefined
(
attributes
)
def
fabricate_undefined
##
# If node has a default value we fabricate concrete node
# with default value.
#
if
@node
.
default
.
nil?
if
@node
.
default
.
nil?
Node
::
Null
.
new
(
nil
,
attributes
)
fabricate
(
Node
::
Null
)
else
else
@node
.
new
(
@node
.
default
,
attributes
)
fabricate
(
@node
,
@node
.
default
)
end
end
def
fabricate
(
node
,
value
=
nil
)
node
.
new
(
value
).
tap
do
|
entry
|
entry
.
key
=
@attributes
[
:key
]
entry
.
parent
=
@attributes
[
:parent
]
||
@parent
entry
.
global
=
@attributes
[
:global
]
||
@parent
.
global
entry
.
description
=
@attributes
[
:description
]
end
end
end
end
end
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