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
1
Merge Requests
1
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
nexedi
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
Show 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
...
@@ -18,7 +18,7 @@ module Ci
initial_parsing
initial_parsing
validate!
validate!
rescue
Gitlab
::
Ci
::
Config
::
Pars
erError
=>
e
rescue
Gitlab
::
Ci
::
Config
::
Load
erError
=>
e
raise
ValidationError
,
e
.
message
raise
ValidationError
,
e
.
message
end
end
...
...
lib/gitlab/ci/config.rb
View file @
23030439
module
Gitlab
module
Gitlab
module
Ci
module
Ci
class
Config
class
Config
class
Pars
erError
<
StandardError
;
end
class
Load
erError
<
StandardError
;
end
def
initialize
(
config
)
def
initialize
(
config
)
parser
=
Pars
er
.
new
(
config
)
loader
=
Load
er
.
new
(
config
)
unless
pars
er
.
valid?
unless
load
er
.
valid?
raise
Pars
erError
,
'Invalid configuration format!'
raise
Load
erError
,
'Invalid configuration format!'
end
end
@config
=
parser
.
parse
@config
=
loader
.
load
end
end
def
to_hash
def
to_hash
...
...
lib/gitlab/ci/config/
pars
er.rb
→
lib/gitlab/ci/config/
load
er.rb
View file @
23030439
module
Gitlab
module
Gitlab
module
Ci
module
Ci
class
Config
class
Config
class
Pars
er
class
Load
er
class
FormatError
<
StandardError
;
end
class
FormatError
<
StandardError
;
end
def
initialize
(
config
)
def
initialize
(
config
)
...
@@ -12,7 +12,7 @@ module Gitlab
...
@@ -12,7 +12,7 @@ module Gitlab
@config
.
is_a?
(
Hash
)
@config
.
is_a?
(
Hash
)
end
end
def
parse
def
load
unless
valid?
unless
valid?
raise
FormatError
,
'Invalid configuration format'
raise
FormatError
,
'Invalid configuration format'
end
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'
require
'spec_helper'
describe
Gitlab
::
Ci
::
Config
::
Pars
er
do
describe
Gitlab
::
Ci
::
Config
::
Load
er
do
let
(
:
pars
er
)
{
described_class
.
new
(
yml
)
}
let
(
:
load
er
)
{
described_class
.
new
(
yml
)
}
context
'when yaml syntax is correct'
do
context
'when yaml syntax is correct'
do
let
(
:yml
)
{
'image: ruby:2.2'
}
let
(
:yml
)
{
'image: ruby:2.2'
}
describe
'#valid?'
do
describe
'#valid?'
do
it
'returns true'
do
it
'returns true'
do
expect
(
pars
er
.
valid?
).
to
be
true
expect
(
load
er
.
valid?
).
to
be
true
end
end
end
end
describe
'#parse'
do
describe
'#load'
do
it
'returns a hash'
do
expect
(
parser
.
parse
).
to
be_a
Hash
end
it
'returns a valid hash'
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
end
end
end
...
@@ -28,14 +24,14 @@ describe Gitlab::Ci::Config::Parser do
...
@@ -28,14 +24,14 @@ describe Gitlab::Ci::Config::Parser do
describe
'#valid?'
do
describe
'#valid?'
do
it
'returns false'
do
it
'returns false'
do
expect
(
pars
er
.
valid?
).
to
be
false
expect
(
load
er
.
valid?
).
to
be
false
end
end
end
end
describe
'#
parse
'
do
describe
'#
load
'
do
it
'raises error'
do
it
'raises error'
do
expect
{
parser
.
parse
}.
to
raise_error
(
expect
{
loader
.
load
}.
to
raise_error
(
Gitlab
::
Ci
::
Config
::
Pars
er
::
FormatError
,
Gitlab
::
Ci
::
Config
::
Load
er
::
FormatError
,
'Invalid configuration format'
'Invalid configuration format'
)
)
end
end
...
@@ -47,7 +43,7 @@ describe Gitlab::Ci::Config::Parser do
...
@@ -47,7 +43,7 @@ describe Gitlab::Ci::Config::Parser do
describe
'#valid?'
do
describe
'#valid?'
do
it
'returns false'
do
it
'returns false'
do
expect
(
pars
er
.
valid?
).
to
be
false
expect
(
load
er
.
valid?
).
to
be
false
end
end
end
end
end
end
...
...
spec/lib/gitlab/ci/config_spec.rb
View file @
23030439
...
@@ -37,7 +37,7 @@ describe Gitlab::Ci::Config do
...
@@ -37,7 +37,7 @@ describe Gitlab::Ci::Config do
describe
'.new'
do
describe
'.new'
do
it
'raises error'
do
it
'raises error'
do
expect
{
config
}.
to
raise_error
(
expect
{
config
}.
to
raise_error
(
Gitlab
::
Ci
::
Config
::
Pars
erError
,
/Invalid configuration format/
Gitlab
::
Ci
::
Config
::
Load
erError
,
/Invalid configuration format/
)
)
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