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
23030439
Commit
23030439
authored
Jun 06, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename class that loads CI configuration to Loader
parent
d2b708ac
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
23 deletions
+19
-23
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+1
-1
lib/gitlab/ci/config.rb
lib/gitlab/ci/config.rb
+5
-5
lib/gitlab/ci/config/loader.rb
lib/gitlab/ci/config/loader.rb
+2
-2
spec/lib/gitlab/ci/config/loader_spec.rb
spec/lib/gitlab/ci/config/loader_spec.rb
+10
-14
spec/lib/gitlab/ci/config_spec.rb
spec/lib/gitlab/ci/config_spec.rb
+1
-1
No files found.
lib/ci/gitlab_ci_yaml_processor.rb
View file @
23030439
...
...
@@ -18,7 +18,7 @@ module Ci
initial_parsing
validate!
rescue
Gitlab
::
Ci
::
Config
::
Pars
erError
=>
e
rescue
Gitlab
::
Ci
::
Config
::
Load
erError
=>
e
raise
ValidationError
,
e
.
message
end
...
...
lib/gitlab/ci/config.rb
View file @
23030439
module
Gitlab
module
Ci
class
Config
class
Pars
erError
<
StandardError
;
end
class
Load
erError
<
StandardError
;
end
def
initialize
(
config
)
parser
=
Pars
er
.
new
(
config
)
loader
=
Load
er
.
new
(
config
)
unless
pars
er
.
valid?
raise
Pars
erError
,
'Invalid configuration format!'
unless
load
er
.
valid?
raise
Load
erError
,
'Invalid configuration format!'
end
@config
=
parser
.
parse
@config
=
loader
.
load
end
def
to_hash
...
...
lib/gitlab/ci/config/
pars
er.rb
→
lib/gitlab/ci/config/
load
er.rb
View file @
23030439
module
Gitlab
module
Ci
class
Config
class
Pars
er
class
Load
er
class
FormatError
<
StandardError
;
end
def
initialize
(
config
)
...
...
@@ -12,7 +12,7 @@ module Gitlab
@config
.
is_a?
(
Hash
)
end
def
parse
def
load
unless
valid?
raise
FormatError
,
'Invalid configuration format'
end
...
...
spec/lib/gitlab/ci/config/
pars
er_spec.rb
→
spec/lib/gitlab/ci/config/
load
er_spec.rb
View file @
23030439
require
'spec_helper'
describe
Gitlab
::
Ci
::
Config
::
Pars
er
do
let
(
:
pars
er
)
{
described_class
.
new
(
yml
)
}
describe
Gitlab
::
Ci
::
Config
::
Load
er
do
let
(
:
load
er
)
{
described_class
.
new
(
yml
)
}
context
'when yaml syntax is correct'
do
let
(
:yml
)
{
'image: ruby:2.2'
}
describe
'#valid?'
do
it
'returns true'
do
expect
(
pars
er
.
valid?
).
to
be
true
expect
(
load
er
.
valid?
).
to
be
true
end
end
describe
'#parse'
do
it
'returns a hash'
do
expect
(
parser
.
parse
).
to
be_a
Hash
end
describe
'#load'
do
it
'returns a valid hash'
do
expect
(
parser
.
parse
).
to
eq
(
image:
'ruby:2.2'
)
expect
(
loader
.
load
).
to
eq
(
image:
'ruby:2.2'
)
end
end
end
...
...
@@ -28,14 +24,14 @@ describe Gitlab::Ci::Config::Parser do
describe
'#valid?'
do
it
'returns false'
do
expect
(
pars
er
.
valid?
).
to
be
false
expect
(
load
er
.
valid?
).
to
be
false
end
end
describe
'#
parse
'
do
describe
'#
load
'
do
it
'raises error'
do
expect
{
parser
.
parse
}.
to
raise_error
(
Gitlab
::
Ci
::
Config
::
Pars
er
::
FormatError
,
expect
{
loader
.
load
}.
to
raise_error
(
Gitlab
::
Ci
::
Config
::
Load
er
::
FormatError
,
'Invalid configuration format'
)
end
...
...
@@ -47,7 +43,7 @@ describe Gitlab::Ci::Config::Parser do
describe
'#valid?'
do
it
'returns false'
do
expect
(
pars
er
.
valid?
).
to
be
false
expect
(
load
er
.
valid?
).
to
be
false
end
end
end
...
...
spec/lib/gitlab/ci/config_spec.rb
View file @
23030439
...
...
@@ -37,7 +37,7 @@ describe Gitlab::Ci::Config do
describe
'.new'
do
it
'raises error'
do
expect
{
config
}.
to
raise_error
(
Gitlab
::
Ci
::
Config
::
Pars
erError
,
/Invalid configuration format/
Gitlab
::
Ci
::
Config
::
Load
erError
,
/Invalid configuration format/
)
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