Class: Rosette::Queuing::Commits::PushStage

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

Overview

Saves (or “pushes”) a set of phrases from the given commit to the configured translation management system (TMS).

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. If the commit queue phrase storage granularity is set to COMMIT, only the phrases added or modified in the given commit will get pushed to the TMS. If the granularity is instead set to BRANCH, the full phrase diff between the commit's branch and the configured diff point (usually master) will get pushed to the TMS. If the commit or diff contains no phrases, this method doesn't push anything but will still update the commit log with a FINALIZED status. If the commit no longer exists in the git repository, the commit log will be updated with a status of MISSING.


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rosette/queuing/commits/push_stage.rb', line 25

def execute!
  logger.info("Pushing commit #{commit_log.commit_id}")

  if phrases.size > 0
    commit_log.phrase_count = phrases.size
    repo_config.tms.store_phrases(phrases, commit_log.commit_id)
    commit_log.push
  else
    commit_log.finalize!
  end

  logger.info("Finished pushing commit #{commit_log.commit_id}")
rescue Java::OrgEclipseJgitErrors::MissingObjectException => ex
  commit_log.missing
ensure
  save_commit_log
end