Class: Rosette::Queuing::Commits::ExtractStage

Inherits:
Stage
  • Object
show all
Defined in:
lib/rosette/queuing/commits/extract_stage.rb

Overview

Extracts phrases from the given commit and stores them in the datastore.

See Also:

  • RepoConfig

Constant Summary

Constants inherited from Stage

Stage::PhraseStatus

Instance Attribute Summary

Attributes inherited from Stage

#commit_log, #logger, #repo_config, #rosette_config

Instance Method Summary collapse

Methods inherited from Stage

accepts, accepts?, for_commit_log, #initialize, #to_job

Constructor Details

This class inherits a constructor from Rosette::Queuing::Commits::Stage

Instance Method Details

#execute!void

This method returns an undefined value.

Executes this stage and updates the commit log with an EXTRACTED status. Uses [Rosette::Core::Commands::CommitCommand] under the hood. If the commit no longer exists in the git repository, the commit log will be updated with a status of MISSING.


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rosette/queuing/commits/extract_stage.rb', line 19

def execute!
  logger.info("Extracting phrases for #{commit_log.commit_id}")

  Rosette::Core::Commands::CommitCommand.new(rosette_config)
    .set_repo_name(repo_config.name)
    .set_ref(commit_log.commit_id)
    .execute

  commit_log.extract
  commit_log.commit_datetime = Time.at(rev_commit.getCommitTime)

  logger.info("Finished extracting phrases for #{commit_log.commit_id}")
rescue Java::OrgEclipseJgitErrors::MissingObjectException => e
  commit_log.missing
ensure
  save_commit_log
end