Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-01-20 14:25:53 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2017-01-20 14:25:53 +0300
commitb7f4553e3e4681d5a4a53af35650bcbb1c83b390 (patch)
tree281f19e15f9c06e978382fbaffb42ddb1ad705eb /lib
parent491f1375fc055805c623a3079a383de988689f3d (diff)
Backport changes introduced by https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1083
Diffstat (limited to 'lib')
-rw-r--r--lib/ci/api/builds.rb4
-rw-r--r--lib/gitlab/visibility_level.rb1
-rw-r--r--lib/prependable.rb24
3 files changed, 27 insertions, 2 deletions
diff --git a/lib/ci/api/builds.rb b/lib/ci/api/builds.rb
index c4bdef781f7..6c869cde515 100644
--- a/lib/ci/api/builds.rb
+++ b/lib/ci/api/builds.rb
@@ -23,8 +23,8 @@ module Ci
new_update = current_runner.ensure_runner_queue_value
- build = Ci::RegisterBuildService.new.execute(current_runner)
-
+ build = Ci::RegisterBuildService.new(current_runner).execute
+
if build
Gitlab::Metrics.add_event(:build_found,
project: build.project.path_with_namespace)
diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb
index 9462f3368e6..c7953af29dd 100644
--- a/lib/gitlab/visibility_level.rb
+++ b/lib/gitlab/visibility_level.rb
@@ -11,6 +11,7 @@ module Gitlab
included do
scope :public_only, -> { where(visibility_level: PUBLIC) }
scope :public_and_internal_only, -> { where(visibility_level: [PUBLIC, INTERNAL] ) }
+ scope :non_public_only, -> { where.not(visibility_level: PUBLIC) }
scope :public_to_user, -> (user) { user && !user.external ? public_and_internal_only : public_only }
end
diff --git a/lib/prependable.rb b/lib/prependable.rb
new file mode 100644
index 00000000000..ff0630d9da3
--- /dev/null
+++ b/lib/prependable.rb
@@ -0,0 +1,24 @@
+# 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