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
b368447c
Commit
b368447c
authored
Jan 25, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unneeded code and fix offenses
parent
ac92554d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
73 deletions
+11
-73
app/models/project.rb
app/models/project.rb
+10
-1
lib/ci/api/builds.rb
lib/ci/api/builds.rb
+1
-1
lib/prependable.rb
lib/prependable.rb
+0
-24
spec/lib/prependable_spec.rb
spec/lib/prependable_spec.rb
+0
-47
No files found.
app/models/project.rb
View file @
b368447c
...
...
@@ -224,6 +224,7 @@ class Project < ActiveRecord::Base
scope
:with_project_feature
,
->
{
joins
(
'LEFT JOIN project_features ON projects.id = project_features.project_id'
)
}
scope
:with_statistics
,
->
{
includes
(
:statistics
)
}
scope
:with_shared_runners
,
->
{
where
(
shared_runners_enabled:
true
)
}
# "enabled" here means "not disabled". It includes private features!
scope
:with_feature_enabled
,
->
(
feature
)
{
...
...
@@ -1096,12 +1097,20 @@ class Project < ActiveRecord::Base
project_feature
.
update_attribute
(
:builds_access_level
,
ProjectFeature
::
ENABLED
)
end
def
shared_runners_available?
shared_runners_enabled?
end
def
shared_runners
shared_runners_available?
?
Ci
::
Runner
.
shared
:
Ci
::
Runner
.
none
end
def
any_runners?
(
&
block
)
if
runners
.
active
.
any?
(
&
block
)
return
true
end
shared_runners
_enabled?
&&
Ci
::
Runner
.
shared
.
active
.
any?
(
&
block
)
shared_runners
.
active
.
any?
(
&
block
)
end
def
valid_runners_token?
(
token
)
...
...
lib/ci/api/builds.rb
View file @
b368447c
...
...
@@ -24,7 +24,7 @@ module Ci
new_update
=
current_runner
.
ensure_runner_queue_value
build
=
Ci
::
RegisterBuildService
.
new
(
current_runner
).
execute
if
build
Gitlab
::
Metrics
.
add_event
(
:build_found
,
project:
build
.
project
.
path_with_namespace
)
...
...
lib/prependable.rb
deleted
100644 → 0
View file @
ac92554d
# This module is based on: https://gist.github.com/bcardarella/5735987
module
Prependable
include
ActiveSupport
::
Concern
def
self
.
extended
(
base
)
#:nodoc:
base
.
instance_variable_set
(
:@_dependencies
,
[])
end
def
prepend_features
(
base
)
if
base
.
instance_variable_defined?
(
:@_dependencies
)
base
.
instance_variable_get
(
:@_dependencies
)
<<
self
return
false
else
return
false
if
base
<
self
super
base
.
singleton_class
.
send
(
:prepend
,
const_get
(
'ClassMethods'
))
if
const_defined?
(
:ClassMethods
)
@_dependencies
.
each
{
|
dep
|
base
.
send
(
:include
,
dep
)
}
base
.
class_eval
(
&
@_included_block
)
if
instance_variable_defined?
(
:@_included_block
)
end
end
alias_method
:prepended
,
:included
end
spec/lib/prependable_spec.rb
deleted
100644 → 0
View file @
ac92554d
require
'spec_helper'
describe
Prependable
do
subject
{
FooObject
}
context
'class methods'
do
it
"has a method"
do
expect
(
subject
).
to
respond_to
(
:class_value
)
end
it
'can execute a method'
do
expect
(
subject
.
class_value
).
to
eq
(
20
)
end
end
context
'instance methods'
do
it
"has a method"
do
expect
(
subject
.
new
).
to
respond_to
(
:value
)
end
it
'chains a method execution'
do
expect
(
subject
.
new
.
value
).
to
eq
(
100
)
end
end
module
Foo
extend
Prependable
prepended
do
def
self
.
class_value
20
end
end
def
value
super
*
10
end
end
class
FooObject
prepend
Foo
def
value
10
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