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
0b1655e7
Commit
0b1655e7
authored
Apr 16, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename CiStatus to Statusable
parent
065e0c0f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
9 deletions
+21
-9
app/models/ci/commit.rb
app/models/ci/commit.rb
+1
-1
app/models/commit_status.rb
app/models/commit_status.rb
+6
-2
app/models/concerns/statuseable.rb
app/models/concerns/statuseable.rb
+2
-2
app/models/project.rb
app/models/project.rb
+1
-1
app/views/projects/commit/_ci_commit.html.haml
app/views/projects/commit/_ci_commit.html.haml
+1
-1
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+8
-0
spec/models/concerns/statuseable_spec.rb
spec/models/concerns/statuseable_spec.rb
+2
-2
No files found.
app/models/ci/commit.rb
View file @
0b1655e7
...
...
@@ -19,7 +19,7 @@
module
Ci
class
Commit
<
ActiveRecord
::
Base
extend
Ci
::
Model
include
CiStatus
include
Statuseable
belongs_to
:project
,
class_name:
'::Project'
,
foreign_key: :gl_project_id
has_many
:statuses
,
class_name:
'CommitStatus'
...
...
app/models/commit_status.rb
View file @
0b1655e7
...
...
@@ -33,7 +33,7 @@
#
class
CommitStatus
<
ActiveRecord
::
Base
include
CiStatus
include
Statuseable
self
.
table_name
=
'ci_builds'
...
...
@@ -81,7 +81,11 @@ class CommitStatus < ActiveRecord::Base
end
end
delegate
:before_sha
,
:sha
,
:short_sha
,
to: :commit
,
prefix:
false
delegate
:sha
,
:short_sha
,
to: :commit
def
before_sha
commit
.
before_sha
||
Gitlab
::
Git
::
BLANK_SHA
end
def
self
.
stages
order_by
=
'max(stage_idx)'
...
...
app/models/concerns/
ci_status
.rb
→
app/models/concerns/
statuseable
.rb
View file @
0b1655e7
module
CiStatus
module
Statuseable
extend
ActiveSupport
::
Concern
AVAILABLE_STATUSES
=
%w(pending running success failed canceled skipped)
...
...
@@ -41,7 +41,7 @@ module CiStatus
end
def
finished_at
all
.
m
in
imum
(
:finished_at
)
all
.
m
ax
imum
(
:finished_at
)
end
end
...
...
app/models/project.rb
View file @
0b1655e7
...
...
@@ -958,7 +958,7 @@ class Project < ActiveRecord::Base
end
def
ci_commit
(
sha
,
ref
)
ci_commits
.
find_by
(
sha:
sha
,
ref:
ref
)
ci_commits
.
order
(
id: :desc
).
find_by
(
sha:
sha
,
ref:
ref
)
end
def
ensure_ci_commit
(
sha
,
ref
)
...
...
app/views/projects/commit/_ci_commit.html.haml
View file @
0b1655e7
.gray-content-block.middle-block
.pull-right
-
if
can?
(
current_user
,
:update_build
,
@project
)
-
if
can?
(
current_user
,
:update_build
,
@
ci_commit
.
project
)
-
if
ci_commit
.
builds
.
latest
.
failed
.
any?
(
&
:retryable?
)
=
link_to
"Retry failed"
,
retry_builds_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
ci_commit
.
sha
),
class:
'btn btn-grouped btn-primary'
,
method: :post
...
...
spec/models/commit_spec.rb
View file @
0b1655e7
...
...
@@ -163,4 +163,12 @@ eos
it
{
expect
(
commit
.
reverts_commit?
(
another_commit
)).
to
be_truthy
}
end
end
describe
'#ci_commits'
do
# TODO: kamil
end
describe
'#status'
do
# TODO: kamil
end
end
spec/
lib/ci/status
_spec.rb
→
spec/
models/concerns/statuseable
_spec.rb
View file @
0b1655e7
require
'spec_helper'
describe
CiStatus
do
describe
Statuseable
do
before
do
@object
=
Object
.
new
@object
.
extend
(
CiStatus
::
ClassMethods
)
@object
.
extend
(
Statuseable
::
ClassMethods
)
end
describe
'.status'
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