safedb 0.4.1002 → 0.5.1001

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +35 -23
  3. data/README.md +69 -29
  4. data/lib/cli.rb +28 -22
  5. data/lib/controller/admin/access.rb +1 -1
  6. data/lib/controller/admin/commit.rb +53 -0
  7. data/lib/controller/admin/diff.rb +23 -25
  8. data/lib/controller/admin/export.rb +9 -11
  9. data/lib/controller/admin/goto.rb +2 -3
  10. data/lib/controller/admin/import.rb +5 -7
  11. data/lib/controller/admin/login.rb +16 -2
  12. data/lib/controller/admin/logout.rb +1 -1
  13. data/lib/controller/admin/open.rb +4 -5
  14. data/lib/controller/admin/refresh.rb +55 -0
  15. data/lib/controller/admin/token.rb +1 -1
  16. data/lib/controller/admin/use.rb +1 -1
  17. data/lib/controller/admin/view.rb +8 -10
  18. data/lib/controller/api/docker/docker.rb +1 -1
  19. data/lib/controller/api/jenkins/jenkins.rb +1 -1
  20. data/lib/controller/api/terraform/terraform.rb +7 -34
  21. data/lib/controller/api/vpn/vpn.rb +1 -1
  22. data/lib/controller/{usecase.rb → controller.rb} +15 -8
  23. data/lib/controller/edit/editverse.rb +2 -2
  24. data/lib/controller/id.rb +1 -1
  25. data/lib/controller/query/copy.rb +127 -0
  26. data/lib/controller/query/queryverse.rb +2 -2
  27. data/lib/controller/requirer.rb +1 -1
  28. data/lib/controller/set.rb +1 -1
  29. data/lib/controller/verse.rb +1 -1
  30. data/lib/controller/visit/visit.rb +1 -1
  31. data/lib/manual/copy-paste.md +13 -0
  32. data/lib/{controller/admin/tree.md → manual/dir-structure.md} +0 -0
  33. data/lib/manual/drag-drop.md +77 -0
  34. data/lib/manual/login-logout.md +46 -0
  35. data/lib/model/README.md +2 -2
  36. data/lib/model/book.rb +11 -6
  37. data/lib/model/indices.rb +1 -1
  38. data/lib/model/state.inspect.rb +67 -53
  39. data/lib/model/state.migrate.rb +19 -19
  40. data/lib/model/text_chunk.rb +35 -15
  41. data/lib/utils/clipboard/clip.rb +92 -0
  42. data/lib/utils/key.pass.rb +3 -1
  43. data/lib/version.rb +1 -1
  44. metadata +11 -7
  45. data/lib/controller/admin/checkin.rb +0 -83
  46. data/lib/controller/admin/checkout.rb +0 -57
  47. data/lib/modules/cryptology/collect.rb +0 -138
data/lib/model/book.rb CHANGED
@@ -68,6 +68,7 @@ module SafeDb
68
68
  return @master_verse_count
69
69
  end
70
70
 
71
+
71
72
  # Get the hash data structure representing the branch's state. This state
72
73
  # may or may not be equivalent to the current master state as gettable by
73
74
  # the {to_master_data} method.
@@ -88,6 +89,7 @@ module SafeDb
88
89
 
89
90
  end
90
91
 
92
+
91
93
  # Get the number of verses in the branch's data structure.
92
94
  # @return [Number] the number of verses in the branch's data.
93
95
  def get_branch_verse_count()
@@ -170,16 +172,19 @@ module SafeDb
170
172
  end
171
173
 
172
174
 
173
- # Return true if this book has been opened at a chapter and verse location.
175
+ # Return true if this book has NOT been opened at a chapter and verse location.
174
176
  # This method uses {TextChunk.not_open_message} to print out a helpful message
175
177
  # detailing how to open a chapter and verse.
176
178
  #
177
179
  # Note that an open chapter need not contain any data. The same goes for an
178
180
  # open verse. In these cases the {open_chapter} and {open_verse} methods both
179
181
  # return empty data structures.
180
- def unopened_chapter_verse()
181
- return if has_open_chapter_name?() and has_open_verse_name?()
182
+ #
183
+ # @return [Boolean] true if no chapter and verse for this book is open
184
+ def unopened_chapter_verse?()
185
+ return false if( has_open_chapter_name?() and has_open_verse_name?() )
182
186
  TextChunk.not_open_message()
187
+ return true
183
188
  end
184
189
 
185
190
 
@@ -372,9 +377,9 @@ module SafeDb
372
377
 
373
378
 
374
379
  # Return true if the commit identifiers for the master and the branch match
375
- # meaning that we can commit (checkin).
376
- # @return [Boolean] true if can checkin, false otherwise
377
- def can_checkin?()
380
+ # meaning that we can commit (commit).
381
+ # @return [Boolean] true if can commit, false otherwise
382
+ def can_commit?()
378
383
  return @branch_keys.get( Indices::COMMIT_IDENTIFIER ).eql?( @master_keys.get( Indices::COMMIT_IDENTIFIER ) )
379
384
  end
380
385
 
data/lib/model/indices.rb CHANGED
@@ -46,7 +46,7 @@ module SafeDb
46
46
  # The AES symmetric encryption initialization vector
47
47
  CONTENT_RANDOM_IV = "content.iv"
48
48
 
49
- # The commit identifiers of the master and branch are compared to ascertain eligibility for checkins
49
+ # The commit identifiers of the master and branch are compared to ascertain eligibility for commits
50
50
  COMMIT_IDENTIFIER = "commit.identifier"
51
51
 
52
52
  # The bootup id is set on machine boot and lasts until the reboot or shutdown.
@@ -7,64 +7,21 @@ module SafeDb
7
7
  #
8
8
  class StateInspect
9
9
 
10
+ # Return true if this book has been logged in during this session.
11
+ # @return [Boolean] true if not logged into this book
12
+ def self.not_logged_in?()
10
13
 
11
- # A checkout is effectively an incoming merge of the master's data
12
- # structure into the working branch. With checkouts nothing ever gets
13
- # deleted.
14
- #
15
- # No delete is self-evident in this list of only <tt>4 prophetic</tt>
16
- # outcomes
17
- #
18
- # - this chapter will be added
19
- # - this verse will be added
20
- # - this line will be added
21
- # - this branch's line value will be overwritten with the value from master
22
- #
23
- # Examine the sister method {checkin_diff} that prophesizes on the
24
- # state changes a checkin will invoke.
25
- #
26
- # @param master_data [Hash] data structure from the master line of the book
27
- # @param branch_data [Hash] data structure from the current working branch
28
- def self.checkout_prophecies( master_data, branch_data )
29
-
30
- puts " = safe diff --checkout"
31
- puts " = incoming from master to working branch"
32
- puts ""
33
-
34
- data_differences( master_data, branch_data )
35
-
36
- end
37
-
38
-
39
- # A checkout merges whilst a checkin is effectively a hard copy that destroys
40
- # whatever is on the master making it exactly reflect the branch's current state.
41
- #
42
- # The three addition state changes prophesized by a checkout can also occur on
43
- # checkins. However checkins can also prophesize that
44
- #
45
- # - this master's line value will be overwritten with the branch's value
46
- # - this chapter will be removed
47
- # - this verse will be removed
48
- # - this line will be removed
49
- #
50
- # Examine the sister method {checkin_diff} that prophesizes on the
51
- # state changes a checkin will invoke.
52
- #
53
- # @param master_data [Hash] data structure from the master line of the book
54
- # @param branch_data [Hash] data structure from the current working branch
55
- def self.checkin_prophecies( master_data, branch_data )
56
-
57
- puts " = safe diff --checkin"
58
- puts " = outgoing from working branch to master"
59
- puts ""
60
-
61
- data_differences( branch_data, master_data )
62
- drop_differences( master_data, branch_data )
14
+ branch_id = Identifier.derive_branch_id( Branch.to_token() )
15
+ return true unless File.exists?( FileTree.branch_indices_filepath( branch_id ) )
16
+ branch_keys = DataMap.new( FileTree.branch_indices_filepath( branch_id ) )
17
+ return true unless branch_keys.has_section?( Indices::BRANCH_DATA )
18
+ book_id = branch_keys.read( Indices::BRANCH_DATA, Indices::CURRENT_BRANCH_BOOK_ID )
19
+ return true unless branch_keys.has_section?( book_id )
20
+ return !is_logged_in?( book_id )
63
21
 
64
22
  end
65
23
 
66
24
 
67
-
68
25
  # Returns true if valid credentials have been provided earlier on in this
69
26
  # session against the book specified in the parameter.
70
27
  #
@@ -120,6 +77,63 @@ module SafeDb
120
77
  end
121
78
 
122
79
 
80
+ # A refresh is effectively an incoming merge of the master's data
81
+ # structure into the working branch. With refreshs nothing ever gets
82
+ # deleted.
83
+ #
84
+ # No delete is self-evident in this list of only <tt>4 prophetic</tt>
85
+ # outcomes
86
+ #
87
+ # - this chapter will be added
88
+ # - this verse will be added
89
+ # - this line will be added
90
+ # - this branch's line value will be overwritten with the value from master
91
+ #
92
+ # Examine the sister method {commit_diff} that prophesizes on the
93
+ # state changes a commit will invoke.
94
+ #
95
+ # @param master_data [Hash] data structure from the master line of the book
96
+ # @param branch_data [Hash] data structure from the current working branch
97
+ def self.refresh_prophecies( master_data, branch_data )
98
+
99
+ puts " = safe diff --refresh"
100
+ puts " = incoming from master to working branch"
101
+ puts ""
102
+
103
+ data_differences( master_data, branch_data )
104
+
105
+ end
106
+
107
+
108
+ # A refresh merges whilst a commit is effectively a hard copy that destroys
109
+ # whatever is on the master making it exactly reflect the branch's current state.
110
+ #
111
+ # The three addition state changes prophesized by a refresh can also occur on
112
+ # commits. However commits can also prophesize that
113
+ #
114
+ # - this master's line value will be overwritten with the branch's value
115
+ # - this chapter will be removed
116
+ # - this verse will be removed
117
+ # - this line will be removed
118
+ #
119
+ # Examine the sister method {commit_diff} that prophesizes on the
120
+ # state changes a commit will invoke.
121
+ #
122
+ # @param master_data [Hash] data structure from the master line of the book
123
+ # @param branch_data [Hash] data structure from the current working branch
124
+ def self.commit_prophecies( master_data, branch_data )
125
+
126
+ puts " = safe diff --commit"
127
+ puts " = outgoing from working branch to master"
128
+ puts ""
129
+
130
+ data_differences( branch_data, master_data )
131
+ drop_differences( master_data, branch_data )
132
+
133
+ end
134
+
135
+
136
+
123
137
  private
124
138
 
125
139
 
@@ -7,8 +7,8 @@ module SafeDb
7
7
  #
8
8
  # - <tt>initialization</tt> - a new master state box is created
9
9
  # - <tt>login</tt> - branch state is created that mirrors master
10
- # - <tt>checkin</tt> - transfers state from branch to master
11
- # - <tt>checkout</tt> - transfers state from master to branch
10
+ # - <tt>commit</tt> - transfers state from branch to master
11
+ # - <tt>refresh</tt> - transfers state from master to branch
12
12
  #
13
13
  class StateMigrate
14
14
 
@@ -30,7 +30,7 @@ module SafeDb
30
30
  # The high entropy key is recycled only on the first login into a book since the
31
31
  # machine reboot. This is because subsequent branch logins that protect the
32
32
  # random key will need to check back with the master branch when performing either
33
- # a diff or checkout operations. Also the checkin operation must maintain the
33
+ # a diff or refresh operations. Also the commit operation must maintain the
34
34
  # same content encryption key for readability by validated agents.
35
35
  #
36
36
  # @param book_keys [DataMap]
@@ -120,12 +120,12 @@ module SafeDb
120
120
  end
121
121
 
122
122
 
123
- # In the main, the <tt>checkin use case</tt> changes the master so that it mirrors
124
- # the branch's state. A check-in syncs the master's state to mirror the branch.
123
+ # In the main, the <tt>commit use case</tt> changes the master so that it mirrors
124
+ # the branch's state. A commit syncs the master's state to mirror the branch.
125
125
  #
126
126
  # == The Simple Check In
127
127
  #
128
- # The simplest case is when no other branch has issued a check-in since this branch
128
+ # The simplest case is when no other branch has issued a commit since this branch
129
129
  #
130
130
  # - <tt>logged in</tt>
131
131
  # - <tt>checked in</tt> or
@@ -142,16 +142,16 @@ module SafeDb
142
142
  # A new commit ID is only created during
143
143
  #
144
144
  # - <tt>either the first login</tt> since the machine booted up
145
- # - <tt>or a branch checkin</tt>
145
+ # - <tt>or a branch commit</tt>
146
146
  #
147
147
  # The commit ID is copied from master to branch during
148
148
  #
149
149
  # - <tt>either subsequent logins</tt>
150
- # - <tt>or a branch checkout</tt>
150
+ # - <tt>or a branch refresh</tt>
151
151
  #
152
- def self.checkin( book )
152
+ def self.commit( book )
153
153
 
154
- # @todo => If mismatch in commit IDs then print message instructing to first do safe checkout
154
+ # @todo => If mismatch in commit IDs then print message instructing to first do safe refresh
155
155
 
156
156
  FileUtils.remove_entry( FileTree.master_crypts_folder( book.book_id() ) )
157
157
  FileUtils.mkdir_p( FileTree.master_crypts_folder( book.book_id() ) )
@@ -162,9 +162,9 @@ module SafeDb
162
162
  branch_keys = DataMap.new( FileTree.branch_indices_filepath( book.branch_id() ) )
163
163
  branch_keys.use( book.book_id() )
164
164
 
165
- checkin_commit_id = Identifier.get_random_identifier( 16 )
166
- branch_keys.set( Indices::COMMIT_IDENTIFIER, checkin_commit_id )
167
- master_keys.set( Indices::COMMIT_IDENTIFIER, checkin_commit_id )
165
+ commit_id = Identifier.get_random_identifier( 16 )
166
+ branch_keys.set( Indices::COMMIT_IDENTIFIER, commit_id )
167
+ master_keys.set( Indices::COMMIT_IDENTIFIER, commit_id )
168
168
 
169
169
  master_keys.set( Indices::CONTENT_IDENTIFIER, branch_keys.get( Indices::CONTENT_IDENTIFIER ) )
170
170
  master_keys.set( Indices::CONTENT_RANDOM_IV, branch_keys.get( Indices::CONTENT_RANDOM_IV ) )
@@ -173,13 +173,13 @@ module SafeDb
173
173
 
174
174
 
175
175
 
176
- # A checkout merges down the master's data into the data of this working branch.
177
- # The <tt>commit ID</tt> of the working branch after the checkout is made to be
178
- # equivalent with that of the master. This act signifies that a checkin is now
179
- # allowed (as long as another branch doesn't checkin in the meantime).
176
+ # A refresh merges down the master's data into the data of this working branch.
177
+ # The <tt>commit ID</tt> of the working branch after the refresh is made to be
178
+ # equivalent with that of the master. This act signifies that a commit is now
179
+ # allowed (as long as another branch doesn't commit in the meantime).
180
180
  #
181
181
  # @param book [Book] the book whose master data will be merged down into the branch.
182
- def self.checkout( book )
182
+ def self.refresh( book )
183
183
 
184
184
  master_data = book.to_master_data()
185
185
  branch_data = book.to_branch_data()
@@ -200,7 +200,7 @@ module SafeDb
200
200
 
201
201
 
202
202
  # Copy the master commit identifier to the branch. This signifies that the branch
203
- # is aligned (and ready) to checkin its changes into the master.
203
+ # is aligned (and ready) to commit its changes into the master.
204
204
  # @param book [Book] the book whose commit IDs will be manipulated
205
205
  def self.copy_commit_id_to_branch( book )
206
206
 
@@ -29,35 +29,55 @@ CRYPT_HEADER
29
29
  end
30
30
 
31
31
 
32
+ # Print a message stating that the book cannot be accessed until
33
+ # a successful login has occured.
34
+ def self.not_logged_in_message()
35
+
36
+ <<-NOT_LOGGED_IN_MESSAGE
37
+
38
+ Please login to access the credentials in this book.
39
+ Suppose you initialized a book called websites.
40
+
41
+ #{Indices::COMMANDER} login websites
42
+ #{Indices::COMMANDER} login websites --password=secret123
43
+ #{Indices::COMMANDER} login websites --clip
44
+
45
+ A space before the command skips history logging.
46
+
47
+ NOT_LOGGED_IN_MESSAGE
48
+
49
+ end
50
+
51
+
32
52
  # Print a message stating that the book has not been opened at any
33
53
  # chapter and verse location.
34
54
  def self.not_open_message()
35
55
 
36
56
  <<-UNOPENED_MESSAGE
37
57
 
38
- Please open a chapter and verse to put, edit or query data.
58
+ Please open a chapter and verse to put, edit or query data.
39
59
 
40
- #{Indices::COMMANDER} open contacts monica
60
+ #{Indices::COMMANDER} open contacts monica
41
61
 
42
- then add monica's contact details
62
+ then add monica's contact details
43
63
 
44
- #{Indices::COMMANDER} put email monica.lewinsky@gmail.com
45
- #{Indices::COMMANDER} put phone +1-357-246-8901
46
- #{Indices::COMMANDER} put twitter @monica_x
47
- #{Indices::COMMANDER} put skype.id 6363430539
48
- #{Indices::COMMANDER} put birthday \"1st April 1978\"
64
+ #{Indices::COMMANDER} put email monica.lewinsky@gmail.com
65
+ #{Indices::COMMANDER} put phone +1-357-246-8901
66
+ #{Indices::COMMANDER} put twitter @monica_x
67
+ #{Indices::COMMANDER} put skype.id 6363430539
68
+ #{Indices::COMMANDER} put birthday \"1st April 1978\"
49
69
 
50
- also hilary's
70
+ also hilary's
51
71
 
52
- #{Indices::COMMANDER} open contacts hilary
53
- #{Indices::COMMANDER} put email hilary@whitehouse.gov
72
+ #{Indices::COMMANDER} open contacts hilary
73
+ #{Indices::COMMANDER} put email hilary@whitehouse.gov
54
74
 
55
- then save the changes to your book and logout."
75
+ then save the changes to your book and logout."
56
76
 
57
- #{Indices::COMMANDER} commit"
58
- #{Indices::COMMANDER} logout"
77
+ #{Indices::COMMANDER} commit"
78
+ #{Indices::COMMANDER} logout"
59
79
 
60
- UNOPENED_MESSAGE
80
+ UNOPENED_MESSAGE
61
81
 
62
82
  end
63
83
 
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/ruby
2
+ # coding: utf-8
3
+
4
+ module SafeDb
5
+
6
+ # This Clip class reads, writes and overwrites text that either has been
7
+ # placed in, or will be placed in the clipboard.
8
+ #
9
+ # == xclip pre-condition
10
+ #
11
+ # xclip must be installed using `sudo apt install --assume-yes xclip`
12
+ class Clipboard
13
+
14
+
15
+ # Get the first line of text from the clipboard. Raise an exception
16
+ # if the clipboard either has no text, or the text is empy, or the
17
+ # text consists solely of whitespace.
18
+ #
19
+ # The text will be trimmed before being returned so any leading or
20
+ # trailing whitespace will be removed.
21
+ #
22
+ # For **multiple line** text, the first line that is non-empty and
23
+ # non whitespace only is returned.
24
+ #
25
+ # Due to the sensitive nature of the text the clipboards contents will
26
+ # be immediately overwritten once the pertinent textual content has
27
+ # been consumed.
28
+ #
29
+ # @raise [RuntimeError] if text is nil, empty or consists solely of whitespace
30
+ # @return [String] trimmed version of the clipboard's contents
31
+ def self.read_password()
32
+
33
+ log.info(x) { "About to read a sensitive password from the clipboard." }
34
+ password_text = read_line()
35
+ put( "safe has overwritten clipboard contents." )
36
+ return password_text
37
+
38
+ end
39
+
40
+
41
+ # Put the parameter text into the clipboard thus overwriting whatever
42
+ # content may or may not exist there.
43
+ #
44
+ # @param text_line [String] the text line to put in the clipboard
45
+ def self.put( text_line )
46
+
47
+ log.info(x) { "Putting text into the clipboard thus overwriting existing content." }
48
+ clipboard_put_command = "printf #{text_line} | xclip -selection c"
49
+ system clipboard_put_command
50
+
51
+ end
52
+
53
+
54
+ # Get the first line of text from the clipboard. Raise an exception
55
+ # if the clipboard either has no text, or the text is empy, or the
56
+ # text consists solely of whitespace.
57
+ #
58
+ # The text will be trimmed before being returned so any leading or
59
+ # trailing whitespace will be removed.
60
+ #
61
+ # For **multiple line** text, the first line that is non-empty and
62
+ # non whitespace only is returned.
63
+ #
64
+ # @raise [RuntimeError] if text is nil, empty or consists solely of whitespace
65
+ # @return [String] trimmed version of the clipboard's contents
66
+ def self.read_line()
67
+
68
+ log.info(x) { "About to read and process a text line from the clipboard." }
69
+ xclip_command = "xclip -o"
70
+ textual_content = %x[ #{xclip_command} ]
71
+ no_content = textual_content.nil?() || textual_content.chomp().strip().empty?()
72
+ raise RuntimeError, "The clipboard does not contain any text." if no_content
73
+ clipboard_text = textual_content.chomp().strip()
74
+ num_lines = clipboard_text.lines.count()
75
+ return clipboard_text if num_lines == 1
76
+
77
+ log.info(x) { "Clipboard text has #{num_lines} lines - will return first viable line." }
78
+
79
+ clipboard_text.each_line do |text_line|
80
+ candidate_line = text_line.chomp.gsub("\\n","").strip()
81
+ return candidate_line unless candidate_line.empty()
82
+ end
83
+
84
+ raise RuntimeError, "The multi-line clipboard text contained no printable characters."
85
+
86
+ end
87
+
88
+
89
+ end
90
+
91
+
92
+ end
@@ -40,6 +40,8 @@ module SafeDb
40
40
  # @raise [ArgumentError] if the minimum size is less than one
41
41
  def self.password_from_shell prompt_twice
42
42
 
43
+ require "io/console"
44
+
43
45
  assert_min_size MINIMUM_PASSWORD_SIZE
44
46
 
45
47
  sleep(1)
@@ -100,7 +102,7 @@ module SafeDb
100
102
  unless( first_text.eql? second_text )
101
103
 
102
104
  puts
103
- puts "Those two bits of text are not the same (in my book)!"
105
+ puts "Those two passwords are not the same (in my book)!"
104
106
  puts
105
107
 
106
108
  exit
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SafeDb
2
- VERSION = "0.4.1002"
2
+ VERSION = "0.5.1001"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safedb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1002
4
+ version: 0.5.1001
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apollo Akora
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-19 00:00:00.000000000 Z
11
+ date: 2019-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt
@@ -130,8 +130,7 @@ files:
130
130
  - lib/cli.rb
131
131
  - lib/controller/admin/README.md
132
132
  - lib/controller/admin/access.rb
133
- - lib/controller/admin/checkin.rb
134
- - lib/controller/admin/checkout.rb
133
+ - lib/controller/admin/commit.rb
135
134
  - lib/controller/admin/diff.rb
136
135
  - lib/controller/admin/export.rb
137
136
  - lib/controller/admin/goto.rb
@@ -140,8 +139,8 @@ files:
140
139
  - lib/controller/admin/login.rb
141
140
  - lib/controller/admin/logout.rb
142
141
  - lib/controller/admin/open.rb
142
+ - lib/controller/admin/refresh.rb
143
143
  - lib/controller/admin/token.rb
144
- - lib/controller/admin/tree.md
145
144
  - lib/controller/admin/use.rb
146
145
  - lib/controller/admin/view.rb
147
146
  - lib/controller/api/docker/README.md
@@ -154,6 +153,7 @@ files:
154
153
  - lib/controller/api/vpn/vpn.ini
155
154
  - lib/controller/api/vpn/vpn.rb
156
155
  - lib/controller/config/README.md
156
+ - lib/controller/controller.rb
157
157
  - lib/controller/edit/README.md
158
158
  - lib/controller/edit/editverse.rb
159
159
  - lib/controller/edit/put.rb
@@ -163,16 +163,20 @@ files:
163
163
  - lib/controller/files/read.rb
164
164
  - lib/controller/files/write.rb
165
165
  - lib/controller/id.rb
166
+ - lib/controller/query/copy.rb
166
167
  - lib/controller/query/print.rb
167
168
  - lib/controller/query/queryverse.rb
168
169
  - lib/controller/query/show.rb
169
170
  - lib/controller/requirer.rb
170
171
  - lib/controller/set.rb
171
- - lib/controller/usecase.rb
172
172
  - lib/controller/verse.rb
173
173
  - lib/controller/visit/README.md
174
174
  - lib/controller/visit/visit.rb
175
175
  - lib/factbase/facts.safedb.net.ini
176
+ - lib/manual/copy-paste.md
177
+ - lib/manual/dir-structure.md
178
+ - lib/manual/drag-drop.md
179
+ - lib/manual/login-logout.md
176
180
  - lib/model/README.md
177
181
  - lib/model/book.rb
178
182
  - lib/model/branch.rb
@@ -188,10 +192,10 @@ files:
188
192
  - lib/modules/cryptology/aes-256.rb
189
193
  - lib/modules/cryptology/blowfish.rb
190
194
  - lib/modules/cryptology/cipher.rb
191
- - lib/modules/cryptology/collect.rb
192
195
  - lib/modules/cryptology/crypt.io.rb
193
196
  - lib/modules/storage/coldstore.rb
194
197
  - lib/modules/storage/git.store.rb
198
+ - lib/utils/clipboard/clip.rb
195
199
  - lib/utils/extend/array.rb
196
200
  - lib/utils/extend/dir.rb
197
201
  - lib/utils/extend/file.rb
@@ -1,83 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- module SafeDb
4
-
5
- # The <b>checkin use case</b> commits any changes made to the safe book into
6
- # master. This is straightforward if the master's state has not been forwarded
7
- # by a ckeckin from another (shell) branch.
8
- #
9
- # == master and branch not in sync
10
- #
11
- # The checkin and checkout use cases will be evolved to provide more options
12
- # if the master state is out of sync.
13
- #
14
- # Six options present when the master state is ahead.
15
- #
16
- # == first checkout and then checkin
17
- #
18
- # The preferred manner of dealing with an out of sync state is to checkout
19
- # first and then to checkin.
20
- #
21
- # - <tt>safe checkout --merge --branch</tt> | merge down (into branch) and branch wins on duplicates
22
- # - <tt>safe checkout --merge --master</tt> | merge down (into branch) but master wins on duplicates
23
- # - <tt>safe checkout --clobber</tt> | force branch to exactly mimic the master's state
24
- #
25
- # Once you chosent one of the above you can then <tt>safe checkin</tt> in a safe way.
26
- #
27
- # == bull in a china shop
28
- #
29
- # Merging down is more considered (and polite) to team members than merging up.
30
- # If you know what you are doing you can merge or clobber up!
31
- #
32
- # - <tt>safe checkin --merge --branch</tt> | merge up (into master) and branch wins on duplicates
33
- # - <tt>safe checkin --merge --master</tt> | merge up (into master) but master wins on duplicates
34
- # - <tt>safe checkin --clobber</tt> | force master to exactly mimic our branch state
35
- #
36
- # == checkin | merge up mechanics
37
- #
38
- # The mechanics of a simple in-sync checkin is to
39
- #
40
- # - sync the master crypts to exactly mimic the branch crypts
41
- # - tell master the content id of the book index file
42
- # - tell master what the current random iv (initialization vector) is
43
- # - create a new commit ID and set it on both master and branch
44
- # - set the master's last updated date and time
45
- #
46
- class CheckIn < UseCase
47
-
48
-
49
- # The <b>checkin use case</b> commits any changes made to the safe book into
50
- # master. This is straightforward if the master's state has not been forwarded
51
- # by a ckeckin from another (shell) branch.
52
- def execute
53
-
54
- book = Book.new()
55
- book.print_book_mark()
56
-
57
- unless book.can_checkin?()
58
-
59
- puts "Cannot checkin as master has moved forward."
60
- puts "First see the difference, then checkout, and then checkin."
61
- puts ""
62
- puts " safe diff"
63
- puts " safe checkout"
64
- puts " safe checkin"
65
- puts ""
66
- return
67
-
68
- end
69
-
70
- StateMigrate.checkin( book )
71
-
72
- puts "The checkin was on #{KeyNow.readable()}\n"
73
- puts "Checkin from branch to master was successful.\n"
74
- puts ""
75
-
76
-
77
- end
78
-
79
-
80
- end
81
-
82
-
83
- end