BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
9 deletions
+21
-9
commit.rb
app/models/ci/commit.rb
+1
-1
commit_status.rb
app/models/commit_status.rb
+6
-2
statuseable.rb
app/models/concerns/statuseable.rb
+2
-2
project.rb
app/models/project.rb
+1
-1
_ci_commit.html.haml
app/views/projects/commit/_ci_commit.html.haml
+1
-1
commit_spec.rb
spec/models/commit_spec.rb
+8
-0
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