Module: Rosette::Core::CommitLogStatus
- Defined in:
- lib/rosette/core/extractor/commit_log_status.rb
Overview
Provides a state machine for transitioning between the possible states of a commit log.
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rosette/core/extractor/commit_log_status.rb', line 16 def self.included(base) base.class_eval do include AASM aasm do # define states from PhraseStatus constants Rosette::DataStores::PhraseStatus.all.each do |status| state status.to_sym end attribute_name :status initial_state NOT_SEEN event :fetch do transitions from: NOT_SEEN, to: FETCHED end event :extract do transitions from: FETCHED, to: EXTRACTED end event :push do transitions from: [EXTRACTED, PUSHED], to: PUSHED end event :finalize do transitions from: [EXTRACTED, PUSHED, FINALIZED], to: FINALIZED end # called when jgit can't find the commit event :missing do transitions( from: Rosette::DataStores::PhraseStatus.statuses, to: MISSING ) end end end end |