Class: Gitlab::SlashCommands::Presenters::Run

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/slash_commands/presenters/run.rb

Instance Method Summary collapse

Methods inherited from Base

#display_errors, #initialize

Methods included from Routing

includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

This class inherits a constructor from Gitlab::SlashCommands::Presenters::Base

Instance Method Details

#failed_to_schedule(command) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/gitlab/slash_commands/presenters/run.rb', line 23

def failed_to_schedule(command)
  ephemeral_response(
    text: 'The command could not be scheduled. Make sure that your ' \
      'project has a .gitlab-ci.yml that defines a job with the ' \
      "name #{command.inspect}"
  )
end

#present(pipeline) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord



8
9
10
11
12
13
14
15
16
# File 'lib/gitlab/slash_commands/presenters/run.rb', line 8

def present(pipeline)
  build = pipeline.builds.take

  if build && (responder = Chat::Responder.responder_for(build))
    in_channel_response(responder.scheduled_output)
  else
    unsupported_chat_service
  end
end

#unsupported_chat_serviceObject

rubocop: enable CodeReuse/ActiveRecord



19
20
21
# File 'lib/gitlab/slash_commands/presenters/run.rb', line 19

def unsupported_chat_service
  ephemeral_response(text: 'Sorry, this chat service is currently not supported by GitLab ChatOps.')
end