diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-15 06:09:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-15 06:09:11 +0000 |
commit | a7d1525878904f2f8326baf1c8108f2204ac50cb (patch) | |
tree | da855edafb086adebe33c5eed462d753b58e2836 /lib | |
parent | b69f406585ff64b1c5140ebba775cc754fabb358 (diff) | |
download | gitlab-ce-a7d1525878904f2f8326baf1c8108f2204ac50cb.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 30 | ||||
-rw-r--r-- | lib/api/entities/feature.rb | 22 | ||||
-rw-r--r-- | lib/api/entities/feature_gate.rb | 10 | ||||
-rw-r--r-- | lib/api/entities/impersonation_token.rb | 9 | ||||
-rw-r--r-- | lib/api/entities/impersonation_token_with_token.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/runtime.rb | 5 |
6 files changed, 55 insertions, 30 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 3435d1d6f11..c0970b4cd6c 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -169,36 +169,6 @@ module API expose :last_pipeline, using: Entities::PipelineBasic expose :variables, using: Entities::Variable end - - class ImpersonationToken < PersonalAccessToken - expose :impersonation - end - - class ImpersonationTokenWithToken < PersonalAccessTokenWithToken - expose :impersonation - end - - class FeatureGate < Grape::Entity - expose :key - expose :value - end - - class Feature < Grape::Entity - expose :name - expose :state - expose :gates, using: FeatureGate do |model| - model.gates.map do |gate| - value = model.gate_values[gate.key] - - # By default all gate values are populated. Only show relevant ones. - if (value.is_a?(Integer) && value.zero?) || (value.is_a?(Set) && value.empty?) - next - end - - { key: gate.key, value: value } - end.compact - end - end end end diff --git a/lib/api/entities/feature.rb b/lib/api/entities/feature.rb new file mode 100644 index 00000000000..3c9182340ea --- /dev/null +++ b/lib/api/entities/feature.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module API + module Entities + class Feature < Grape::Entity + expose :name + expose :state + expose :gates, using: Entities::FeatureGate do |model| + model.gates.map do |gate| + value = model.gate_values[gate.key] + + # By default all gate values are populated. Only show relevant ones. + if (value.is_a?(Integer) && value.zero?) || (value.is_a?(Set) && value.empty?) + next + end + + { key: gate.key, value: value } + end.compact + end + end + end +end diff --git a/lib/api/entities/feature_gate.rb b/lib/api/entities/feature_gate.rb new file mode 100644 index 00000000000..bea9c9474b3 --- /dev/null +++ b/lib/api/entities/feature_gate.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module API + module Entities + class FeatureGate < Grape::Entity + expose :key + expose :value + end + end +end diff --git a/lib/api/entities/impersonation_token.rb b/lib/api/entities/impersonation_token.rb new file mode 100644 index 00000000000..9ee8f8bf77b --- /dev/null +++ b/lib/api/entities/impersonation_token.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module API + module Entities + class ImpersonationToken < Entities::PersonalAccessToken + expose :impersonation + end + end +end diff --git a/lib/api/entities/impersonation_token_with_token.rb b/lib/api/entities/impersonation_token_with_token.rb new file mode 100644 index 00000000000..4904f107628 --- /dev/null +++ b/lib/api/entities/impersonation_token_with_token.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module API + module Entities + class ImpersonationTokenWithToken < Entities::PersonalAccessTokenWithToken + expose :impersonation + end + end +end diff --git a/lib/gitlab/runtime.rb b/lib/gitlab/runtime.rb index 182c13980e6..3f6361c7276 100644 --- a/lib/gitlab/runtime.rb +++ b/lib/gitlab/runtime.rb @@ -12,6 +12,7 @@ module Gitlab :console, :geo_log_cursor, :puma, + :rails_runner, :rake, :sidekiq, :test_suite, @@ -64,6 +65,10 @@ module Gitlab !!defined?(::GeoLogCursorOptionParser) end + def rails_runner? + !!defined?(::Rails::Command::RunnerCommand) + end + def web_server? puma? || unicorn? end |