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
Jérome Perrin
gitlab-ce
Commits
3acf4323
Commit
3acf4323
authored
Dec 08, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor ci status factories to DRY code a little
parent
65f32060
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
29 deletions
+28
-29
lib/gitlab/ci/status/build/factory.rb
lib/gitlab/ci/status/build/factory.rb
+5
-6
lib/gitlab/ci/status/extended.rb
lib/gitlab/ci/status/extended.rb
+1
-1
lib/gitlab/ci/status/factory.rb
lib/gitlab/ci/status/factory.rb
+17
-13
lib/gitlab/ci/status/pipeline/factory.rb
lib/gitlab/ci/status/pipeline/factory.rb
+3
-5
lib/gitlab/ci/status/stage/factory.rb
lib/gitlab/ci/status/stage/factory.rb
+2
-4
No files found.
lib/gitlab/ci/status/build/factory.rb
View file @
3acf4323
...
...
@@ -3,14 +3,13 @@ module Gitlab
module
Status
module
Build
class
Factory
<
Status
::
Factory
private
def
extended_statuses
[
Stop
,
Play
,
Cancelable
,
Retryable
]
def
self
.
extended_statuses
[
Status
::
Build
::
Stop
,
Status
::
Build
::
Play
,
Status
::
Build
::
Cancelable
,
Status
::
Build
::
Retryable
]
end
def
core_statu
s
super
.
extend
(
Status
::
Build
::
Common
)
def
self
.
common_helper
s
Status
::
Build
::
Common
end
end
end
...
...
lib/gitlab/ci/status/extended.rb
View file @
3acf4323
...
...
@@ -2,7 +2,7 @@ module Gitlab
module
Ci
module
Status
module
Extended
def
matches?
(
_subject
)
def
matches?
(
_subject
,
_user
)
raise
NotImplementedError
end
end
...
...
lib/gitlab/ci/status/factory.rb
View file @
3acf4323
...
...
@@ -2,10 +2,9 @@ module Gitlab
module
Ci
module
Status
class
Factory
attr_reader
:subject
def
initialize
(
subject
)
def
initialize
(
subject
,
user
=
nil
)
@subject
=
subject
@user
=
user
end
def
fabricate!
...
...
@@ -16,26 +15,31 @@ module Gitlab
end
end
def
self
.
extended_statuses
[]
end
def
self
.
common_helpers
Module
.
new
end
private
def
s
ubject
_status
@s
ubject_status
||=
subject
.
status
def
s
imple
_status
@s
imple_status
||=
@subject
.
status
||
:created
end
def
core_status
Gitlab
::
Ci
::
Status
.
const_get
(
subject_status
.
capitalize
)
.
new
(
subject
)
.
const_get
(
simple_status
.
capitalize
)
.
new
(
@subject
)
.
extend
(
self
.
class
.
common_helpers
)
end
def
extended_status
@extended
||=
extended_statuses
.
find
do
|
status
|
status
.
matches?
(
subject
)
end
@extended
||=
self
.
class
.
extended_statuses
.
find
do
|
status
|
status
.
matches?
(
@subject
,
@user
)
end
def
extended_statuses
[]
end
end
end
...
...
lib/gitlab/ci/status/pipeline/factory.rb
View file @
3acf4323
...
...
@@ -3,14 +3,12 @@ module Gitlab
module
Status
module
Pipeline
class
Factory
<
Status
::
Factory
private
def
extended_statuses
def
self
.
extended_statuses
[
Pipeline
::
SuccessWithWarnings
]
end
def
core_statu
s
super
.
extend
(
Status
::
Pipeline
::
Common
)
def
self
.
common_helper
s
Status
::
Pipeline
::
Common
end
end
end
...
...
lib/gitlab/ci/status/stage/factory.rb
View file @
3acf4323
...
...
@@ -3,10 +3,8 @@ module Gitlab
module
Status
module
Stage
class
Factory
<
Status
::
Factory
private
def
core_status
super
.
extend
(
Status
::
Stage
::
Common
)
def
self
.
common_helpers
Status
::
Stage
::
Common
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