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
Boxiang Sun
gitlab-ce
Commits
c2d6d61d
Commit
c2d6d61d
authored
Jun 07, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add DSL for adding nodes in Ci config interface
parent
df25c196
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
12 deletions
+16
-12
lib/gitlab/ci/config/node/before_script.rb
lib/gitlab/ci/config/node/before_script.rb
+0
-4
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+11
-1
lib/gitlab/ci/config/node/global.rb
lib/gitlab/ci/config/node/global.rb
+1
-3
lib/gitlab/ci/config/node/null.rb
lib/gitlab/ci/config/node/null.rb
+0
-4
spec/lib/gitlab/ci/config/node/global_spec.rb
spec/lib/gitlab/ci/config/node/global_spec.rb
+4
-0
No files found.
lib/gitlab/ci/config/node/before_script.rb
View file @
c2d6d61d
...
...
@@ -5,10 +5,6 @@ module Gitlab
class
BeforeScript
<
Entry
include
ValidationHelpers
def
keys
{}
end
def
validate!
unless
validate_array_of_strings
(
@value
)
@errors
<<
'before_script should be an array of strings'
...
...
lib/gitlab/ci/config/node/entry.rb
View file @
c2d6d61d
...
...
@@ -48,12 +48,22 @@ module Gitlab
end
def
keys
raise
NotImplementedError
self
.
class
.
nodes
||
{}
end
def
validate!
raise
NotImplementedError
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
...
...
lib/gitlab/ci/config/node/global.rb
View file @
c2d6d61d
...
...
@@ -3,9 +3,7 @@ module Gitlab
class
Config
module
Node
class
Global
<
Entry
def
keys
{
before_script:
BeforeScript
}
end
add_node
:before_script
,
BeforeScript
end
end
end
...
...
lib/gitlab/ci/config/node/null.rb
View file @
c2d6d61d
...
...
@@ -3,10 +3,6 @@ module Gitlab
class
Config
module
Node
class
Null
<
Entry
def
keys
{}
end
def
method_missing
(
*
)
nil
end
...
...
spec/lib/gitlab/ci/config/node/global_spec.rb
View file @
c2d6d61d
...
...
@@ -7,6 +7,10 @@ describe Gitlab::Ci::Config::Node::Global do
it
'can contain global config keys'
do
expect
(
global
.
keys
).
to
include
:before_script
end
it
'returns a hash'
do
expect
(
global
.
keys
).
to
be_a
Hash
end
end
context
'when hash is valid'
do
...
...
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