Class: SafeDb::Commit

Inherits:
Controller show all
Defined in:
lib/controller/book/commit.rb

Overview

The commit use case commits any changes made to the safe book into master. This is straightforward if the master’s state has not been forwarded by a ckeckin from another (shell) branch.

The mechanics of a simple in-sync commit is to

  • sync the master crypts to exactly mimic the branch crypts

  • tell master the content id of the book index file

  • tell master what the current random iv (initialization vector) is

  • create a new commit ID and set it on both master and branch

  • set the master’s last updated date and time

Instance Method Summary collapse

Methods inherited from Controller

#check_post_conditions, #check_pre_conditions, #flow, #initialize, #open_remote_backend_location, #post_validation, #pre_validation, #read_verse, #set_verse, #update_verse

Constructor Details

This class inherits a constructor from SafeDb::Controller

Instance Method Details

#executeObject

The commit use case commits any changes made to the safe book into master. This is straightforward if the master’s state has not been forwarded by a ckeckin from another (shell) branch.



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
# File 'lib/controller/book/commit.rb', line 23

def execute

  @book.print_book_mark()

  unless @book.can_commit?()

    puts "Cannot commit as master has moved forward."
    puts "First see the difference, then refresh, and then commit."
    puts ""
    puts "   safe diff"
    puts "   safe refresh"
    puts "   safe commit"
    puts ""

    return

  end

  EvolveState.commit( @book )

  puts "Commit at #{TimeStamp.readable()} successful."
  puts ""


end