BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
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
raise
InvalidFactory
unless
defined?
(
@value
)
raise
InvalidFactory
unless
defined?
(
@parent
)
attributes
=
{
parent:
@parent
,
global:
@parent
.
global
}
attributes
.
merge!
(
@attributes
)
##
# We assume that unspecified entry is undefined.
# See issue #18775.
#
if
@value
.
nil?
Node
::
Undefined
.
new
(
fabricate_undefined
(
attributes
))
Node
::
Undefined
.
new
(
fabricate_undefined
)
else
@node
.
new
(
@value
,
attributes
)
fabricate
(
@node
,
@value
)
end
end
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?
Node
::
Null
.
new
(
nil
,
attributes
)
fabricate
(
Node
::
Null
)
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
...
...
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