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
b3ff48c9
Commit
b3ff48c9
authored
Feb 22, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move up delegate calls
parent
0a5b670a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
25 additions
and
29 deletions
+25
-29
build.rb
app/models/ci/build.rb
+2
-2
pipeline.rb
app/models/ci/pipeline.rb
+2
-2
commit_status.rb
app/models/commit_status.rb
+1
-2
issuable.rb
app/models/concerns/issuable.rb
+11
-11
member.rb
app/models/member.rb
+2
-2
project.rb
app/models/project.rb
+2
-4
project_wiki.rb
app/models/project_wiki.rb
+3
-4
commit.rb
lib/gitlab/git/commit.rb
+2
-2
No files found.
app/models/ci/build.rb
View file @
b3ff48c9
...
@@ -22,6 +22,8 @@ module Ci
...
@@ -22,6 +22,8 @@ module Ci
serialize
:options
serialize
:options
serialize
:yaml_variables
,
Gitlab
::
Serializer
::
Ci
::
Variables
serialize
:yaml_variables
,
Gitlab
::
Serializer
::
Ci
::
Variables
delegate
:name
,
to: :project
,
prefix:
true
validates
:coverage
,
numericality:
true
,
allow_blank:
true
validates
:coverage
,
numericality:
true
,
allow_blank:
true
validates
:ref
,
presence:
true
validates
:ref
,
presence:
true
...
@@ -233,8 +235,6 @@ module Ci
...
@@ -233,8 +235,6 @@ module Ci
gl_project_id
gl_project_id
end
end
delegate
:name
,
to: :project
,
prefix:
true
def
repo_url
def
repo_url
auth
=
"gitlab-ci-token:
#{
ensure_token!
}
@"
auth
=
"gitlab-ci-token:
#{
ensure_token!
}
@"
project
.
http_url_to_repo
.
sub
(
/^https?:\/\//
)
do
|
prefix
|
project
.
http_url_to_repo
.
sub
(
/^https?:\/\//
)
do
|
prefix
|
...
...
app/models/ci/pipeline.rb
View file @
b3ff48c9
...
@@ -14,6 +14,8 @@ module Ci
...
@@ -14,6 +14,8 @@ module Ci
has_many
:builds
,
foreign_key: :commit_id
has_many
:builds
,
foreign_key: :commit_id
has_many
:trigger_requests
,
dependent: :destroy
,
foreign_key: :commit_id
has_many
:trigger_requests
,
dependent: :destroy
,
foreign_key: :commit_id
delegate
:id
,
to: :project
,
prefix:
true
validates
:sha
,
presence:
{
unless: :importing?
}
validates
:sha
,
presence:
{
unless: :importing?
}
validates
:ref
,
presence:
{
unless: :importing?
}
validates
:ref
,
presence:
{
unless: :importing?
}
validates
:status
,
presence:
{
unless: :importing?
}
validates
:status
,
presence:
{
unless: :importing?
}
...
@@ -153,8 +155,6 @@ module Ci
...
@@ -153,8 +155,6 @@ module Ci
builds
.
latest
.
with_artifacts_not_expired
.
includes
(
project:
[
:namespace
])
builds
.
latest
.
with_artifacts_not_expired
.
includes
(
project:
[
:namespace
])
end
end
delegate
:id
,
to: :project
,
prefix:
true
# For now the only user who participates is the user who triggered
# For now the only user who participates is the user who triggered
def
participants
(
_current_user
=
nil
)
def
participants
(
_current_user
=
nil
)
Array
(
user
)
Array
(
user
)
...
...
app/models/commit_status.rb
View file @
b3ff48c9
...
@@ -10,6 +10,7 @@ class CommitStatus < ActiveRecord::Base
...
@@ -10,6 +10,7 @@ class CommitStatus < ActiveRecord::Base
belongs_to
:user
belongs_to
:user
delegate
:commit
,
to: :pipeline
delegate
:commit
,
to: :pipeline
delegate
:sha
,
:short_sha
,
to: :pipeline
validates
:pipeline
,
presence:
true
,
unless: :importing?
validates
:pipeline
,
presence:
true
,
unless: :importing?
...
@@ -102,8 +103,6 @@ class CommitStatus < ActiveRecord::Base
...
@@ -102,8 +103,6 @@ class CommitStatus < ActiveRecord::Base
end
end
end
end
delegate
:sha
,
:short_sha
,
to: :pipeline
def
before_sha
def
before_sha
pipeline
.
before_sha
||
Gitlab
::
Git
::
BLANK_SHA
pipeline
.
before_sha
||
Gitlab
::
Git
::
BLANK_SHA
end
end
...
...
app/models/concerns/issuable.rb
View file @
b3ff48c9
...
@@ -46,6 +46,17 @@ module Issuable
...
@@ -46,6 +46,17 @@ module Issuable
has_one
:metrics
has_one
:metrics
delegate
:name
,
:email
,
to: :author
,
prefix:
true
delegate
:name
,
:email
,
to: :assignee
,
allow_nil:
true
,
prefix:
true
validates
:author
,
presence:
true
validates
:author
,
presence:
true
validates
:title
,
presence:
true
,
length:
{
maximum:
255
}
validates
:title
,
presence:
true
,
length:
{
maximum:
255
}
...
@@ -72,17 +83,6 @@ module Issuable
...
@@ -72,17 +83,6 @@ module Issuable
scope
:references_project
,
->
{
references
(
:project
)
}
scope
:references_project
,
->
{
references
(
:project
)
}
scope
:non_archived
,
->
{
join_project
.
where
(
projects:
{
archived:
false
})
}
scope
:non_archived
,
->
{
join_project
.
where
(
projects:
{
archived:
false
})
}
delegate
:name
,
:email
,
to: :author
,
prefix:
true
delegate
:name
,
:email
,
to: :assignee
,
allow_nil:
true
,
prefix:
true
attr_mentionable
:title
,
pipeline: :single_line
attr_mentionable
:title
,
pipeline: :single_line
attr_mentionable
:description
attr_mentionable
:description
...
...
app/models/member.rb
View file @
b3ff48c9
...
@@ -10,6 +10,8 @@ class Member < ActiveRecord::Base
...
@@ -10,6 +10,8 @@ class Member < ActiveRecord::Base
belongs_to
:user
belongs_to
:user
belongs_to
:source
,
polymorphic:
true
belongs_to
:source
,
polymorphic:
true
delegate
:name
,
:username
,
:email
,
to: :user
,
prefix:
true
validates
:user
,
presence:
true
,
unless: :invite?
validates
:user
,
presence:
true
,
unless: :invite?
validates
:source
,
presence:
true
validates
:source
,
presence:
true
validates
:user_id
,
uniqueness:
{
scope:
[
:source_type
,
:source_id
],
validates
:user_id
,
uniqueness:
{
scope:
[
:source_type
,
:source_id
],
...
@@ -73,8 +75,6 @@ class Member < ActiveRecord::Base
...
@@ -73,8 +75,6 @@ class Member < ActiveRecord::Base
after_destroy
:post_destroy_hook
,
unless: :pending?
after_destroy
:post_destroy_hook
,
unless: :pending?
after_commit
:refresh_member_authorized_projects
after_commit
:refresh_member_authorized_projects
delegate
:name
,
:username
,
:email
,
to: :user
,
prefix:
true
default_value_for
:notification_level
,
NotificationSetting
.
levels
[
:global
]
default_value_for
:notification_level
,
NotificationSetting
.
levels
[
:global
]
class
<<
self
class
<<
self
...
...
app/models/project.rb
View file @
b3ff48c9
...
@@ -172,9 +172,11 @@ class Project < ActiveRecord::Base
...
@@ -172,9 +172,11 @@ class Project < ActiveRecord::Base
accepts_nested_attributes_for
:project_feature
accepts_nested_attributes_for
:project_feature
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
delegate
:count
,
to: :forks
,
prefix:
true
delegate
:members
,
to: :team
,
prefix:
true
delegate
:members
,
to: :team
,
prefix:
true
delegate
:add_user
,
to: :team
delegate
:add_user
,
to: :team
delegate
:add_guest
,
:add_reporter
,
:add_developer
,
:add_master
,
to: :team
delegate
:add_guest
,
:add_reporter
,
:add_developer
,
:add_master
,
to: :team
delegate
:empty_repo?
,
to: :repository
# Validations
# Validations
validates
:creator
,
presence:
true
,
on: :create
validates
:creator
,
presence:
true
,
on: :create
...
@@ -838,8 +840,6 @@ class Project < ActiveRecord::Base
...
@@ -838,8 +840,6 @@ class Project < ActiveRecord::Base
false
false
end
end
delegate
:empty_repo?
,
to: :repository
def
repo
def
repo
repository
.
raw
repository
.
raw
end
end
...
@@ -1027,8 +1027,6 @@ class Project < ActiveRecord::Base
...
@@ -1027,8 +1027,6 @@ class Project < ActiveRecord::Base
forked?
&&
project
==
forked_from_project
forked?
&&
project
==
forked_from_project
end
end
delegate
:count
,
to: :forks
,
prefix:
true
def
origin_merge_requests
def
origin_merge_requests
merge_requests
.
where
(
source_project_id:
self
.
id
)
merge_requests
.
where
(
source_project_id:
self
.
id
)
end
end
...
...
app/models/project_wiki.rb
View file @
b3ff48c9
...
@@ -19,6 +19,9 @@ class ProjectWiki
...
@@ -19,6 +19,9 @@ class ProjectWiki
@user
=
user
@user
=
user
end
end
delegate
:empty?
,
to: :pages
delegate
:repository_storage_path
,
to: :project
def
path
def
path
@project
.
path
+
'.wiki'
@project
.
path
+
'.wiki'
end
end
...
@@ -60,8 +63,6 @@ class ProjectWiki
...
@@ -60,8 +63,6 @@ class ProjectWiki
!!
repository
.
exists?
!!
repository
.
exists?
end
end
delegate
:empty?
,
to: :pages
# Returns an Array of Gitlab WikiPage instances or an
# Returns an Array of Gitlab WikiPage instances or an
# empty Array if this Wiki has no pages.
# empty Array if this Wiki has no pages.
def
pages
def
pages
...
@@ -158,8 +159,6 @@ class ProjectWiki
...
@@ -158,8 +159,6 @@ class ProjectWiki
}
}
end
end
delegate
:repository_storage_path
,
to: :project
private
private
def
init_repo
(
path_with_namespace
)
def
init_repo
(
path_with_namespace
)
...
...
lib/gitlab/git/commit.rb
View file @
b3ff48c9
...
@@ -14,6 +14,8 @@ module Gitlab
...
@@ -14,6 +14,8 @@ module Gitlab
attr_accessor
*
SERIALIZE_KEYS
# rubocop:disable Lint/AmbiguousOperator
attr_accessor
*
SERIALIZE_KEYS
# rubocop:disable Lint/AmbiguousOperator
delegate
:tree
,
to: :raw_commit
def
==
(
other
)
def
==
(
other
)
return
false
unless
other
.
is_a?
(
Gitlab
::
Git
::
Commit
)
return
false
unless
other
.
is_a?
(
Gitlab
::
Git
::
Commit
)
...
@@ -218,8 +220,6 @@ module Gitlab
...
@@ -218,8 +220,6 @@ module Gitlab
raw_commit
.
parents
.
map
{
|
c
|
Gitlab
::
Git
::
Commit
.
new
(
c
)
}
raw_commit
.
parents
.
map
{
|
c
|
Gitlab
::
Git
::
Commit
.
new
(
c
)
}
end
end
delegate
:tree
,
to: :raw_commit
def
stats
def
stats
Gitlab
::
Git
::
CommitStats
.
new
(
self
)
Gitlab
::
Git
::
CommitStats
.
new
(
self
)
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