Class: Rosette::Core::Commands::RequeueCommitCommand

Inherits:
GitCommand show all
Includes:
WithRef, WithRepoName
Defined in:
lib/rosette/core/commands/queuing/requeue_commit_command.rb

Overview

Sets the commit's status to NOT_FOUND, then enqueues it for processing on Rosette's configured queue. In other words, this command will re-process the commit, which should be an idempotent operation.

Examples:

RequeueCommitCommand.new(configuration)
  .set_repo_name('my_repo')
  .set_ref('master')
  .execute
RequeueCommitCommand.new(configuration)
  .set_repo_name('my_repo')
  .set_commit_id('67f0e9a60dfe39430b346086f965e6c94a8ddd24')
  .execute

See Also:

Instance Attribute Summary

Attributes included from WithRef

#commit_str

Attributes included from WithRepoName

#repo_name

Attributes inherited from Command

#configuration

Instance Method Summary collapse

Methods included from WithRef

#commit_id, #set_commit_id, #set_ref

Methods included from WithRepoName

#set_repo_name

Methods inherited from GitCommand

#valid?

Methods inherited from Command

#initialize, #messages, #valid?, validate, validators

Constructor Details

This class inherits a constructor from Rosette::Core::Commands::Command

Instance Method Details

#executeObject


28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rosette/core/commands/queuing/requeue_commit_command.rb', line 28

def execute
  commit_log = datastore.lookup_commit_log(repo_name, commit_id)

  datastore.add_or_update_commit_log(
    commit_log.repo_name, commit_log.commit_id,
    commit_log.commit_datetime, PhraseStatus::NOT_FOUND,
    commit_log.phrase_count, commit_log.branch_name
  )

  EnqueueCommitCommand.new(configuration)
    .set_repo_name(repo_name)
    .set_commit_id(commit_id)
    .execute
end