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
33cd090b
Commit
33cd090b
authored
Jun 09, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move new Ci config configurable DSL to concern
parent
48a59c1a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
26 deletions
+49
-26
configurable.rb
lib/gitlab/ci/config/node/configurable.rb
+39
-0
entry.rb
lib/gitlab/ci/config/node/entry.rb
+8
-26
global.rb
lib/gitlab/ci/config/node/global.rb
+2
-0
No files found.
lib/gitlab/ci/config/node/configurable.rb
0 → 100644
View file @
33cd090b
module
Gitlab
module
Ci
class
Config
module
Node
module
Configurable
extend
ActiveSupport
::
Concern
def
keys
self
.
class
.
nodes
||
{}
end
private
def
add_node
(
key
,
entry_class
)
if
@value
.
has_key?
(
key
)
entry
=
entry_class
.
new
(
@value
[
key
],
@root
,
self
)
else
entry
=
Node
::
Null
.
new
(
nil
,
@root
,
self
)
end
@nodes
[
key
]
=
entry
end
class_methods
do
attr_reader
:nodes
private
def
add_node
(
symbol
,
entry_class
)
node
=
{
symbol
.
to_sym
=>
entry_class
}
(
@nodes
||=
{}).
merge!
(
node
)
end
end
end
end
end
end
end
lib/gitlab/ci/config/node/entry.rb
View file @
33cd090b
...
@@ -20,8 +20,8 @@ module Gitlab
...
@@ -20,8 +20,8 @@ module Gitlab
def
process!
def
process!
return
if
leaf?
||
invalid?
return
if
leaf?
||
invalid?
keys
.
each
do
|
key
,
entry
_class
|
keys
.
each
do
|
key
,
entry
|
add_node
(
key
,
entry
_class
)
add_node
(
key
,
entry
)
end
end
nodes
.
each
(
&
:process!
)
nodes
.
each
(
&
:process!
)
...
@@ -49,7 +49,7 @@ module Gitlab
...
@@ -49,7 +49,7 @@ module Gitlab
end
end
def
keys
def
keys
self
.
class
.
nodes
||
{}
{}
end
end
def
errors
def
errors
...
@@ -60,7 +60,11 @@ module Gitlab
...
@@ -60,7 +60,11 @@ module Gitlab
super
unless
keys
.
has_key?
(
name
)
super
unless
keys
.
has_key?
(
name
)
raise
InvalidError
unless
valid?
raise
InvalidError
unless
valid?
@nodes
[
name
].
value
@nodes
[
name
].
try
(
:value
)
end
def
add_node
(
key
,
entry
)
raise
NotImplementedError
end
end
def
value
def
value
...
@@ -74,28 +78,6 @@ module Gitlab
...
@@ -74,28 +78,6 @@ module Gitlab
def
description
def
description
raise
NotImplementedError
raise
NotImplementedError
end
end
private
def
add_node
(
key
,
entry_class
)
if
@value
.
has_key?
(
key
)
entry
=
entry_class
.
new
(
@value
[
key
],
@root
,
self
)
else
entry
=
Node
::
Null
.
new
(
nil
,
@root
,
self
)
end
@nodes
[
key
]
=
entry
end
class
<<
self
attr_reader
:nodes
private
def
add_node
(
symbol
,
entry_class
)
(
@nodes
||=
{}).
merge!
(
symbol
.
to_sym
=>
entry_class
)
end
end
end
end
end
end
end
end
...
...
lib/gitlab/ci/config/node/global.rb
View file @
33cd090b
...
@@ -3,6 +3,8 @@ module Gitlab
...
@@ -3,6 +3,8 @@ module Gitlab
class
Config
class
Config
module
Node
module
Node
class
Global
<
Entry
class
Global
<
Entry
include
Configurable
add_node
:before_script
,
Script
add_node
:before_script
,
Script
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