safedb 0.3.1011 → 0.4.1002

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +56 -19
  3. data/README.md +15 -15
  4. data/Rakefile +7 -0
  5. data/bin/safe +2 -2
  6. data/lib/{interprete.rb → cli.rb} +168 -121
  7. data/lib/controller/admin/README.md +47 -0
  8. data/lib/controller/admin/access.rb +47 -0
  9. data/lib/controller/admin/checkin.rb +83 -0
  10. data/lib/controller/admin/checkout.rb +57 -0
  11. data/lib/controller/admin/diff.rb +75 -0
  12. data/lib/{usecase → controller/admin}/export.rb +15 -14
  13. data/lib/controller/admin/goto.rb +52 -0
  14. data/lib/controller/admin/import.rb +54 -0
  15. data/lib/controller/admin/init.rb +113 -0
  16. data/lib/controller/admin/login.rb +88 -0
  17. data/lib/{usecase → controller/admin}/logout.rb +0 -0
  18. data/lib/controller/admin/open.rb +39 -0
  19. data/lib/{usecase → controller/admin}/token.rb +2 -2
  20. data/lib/controller/admin/tree.md +54 -0
  21. data/lib/{usecase → controller/admin}/use.rb +0 -0
  22. data/lib/controller/admin/view.rb +61 -0
  23. data/lib/{usecase → controller/api}/docker/README.md +0 -0
  24. data/lib/{usecase → controller/api}/docker/docker.rb +1 -1
  25. data/lib/{usecase → controller/api}/jenkins/README.md +0 -0
  26. data/lib/{usecase → controller/api}/jenkins/jenkins.rb +1 -1
  27. data/lib/{usecase → controller/api}/terraform/README.md +1 -1
  28. data/lib/{usecase → controller/api}/terraform/terraform.rb +1 -1
  29. data/lib/{usecase → controller/api}/vpn/README.md +1 -1
  30. data/lib/{usecase → controller/api}/vpn/vpn.ini +0 -0
  31. data/lib/{usecase → controller/api}/vpn/vpn.rb +0 -0
  32. data/lib/{usecase → controller}/config/README.md +0 -0
  33. data/lib/{usecase → controller}/edit/README.md +0 -0
  34. data/lib/controller/edit/editverse.rb +48 -0
  35. data/lib/controller/edit/put.rb +35 -0
  36. data/lib/controller/edit/remove.rb +29 -0
  37. data/lib/{usecase/update/README.md → controller/edit/rename.md} +0 -0
  38. data/lib/{usecase → controller}/files/README.md +1 -1
  39. data/lib/controller/files/read.rb +36 -0
  40. data/lib/{usecase/files/eject.rb → controller/files/write.rb} +15 -20
  41. data/lib/{usecase → controller}/id.rb +0 -0
  42. data/lib/controller/query/print.rb +26 -0
  43. data/lib/controller/query/queryverse.rb +39 -0
  44. data/lib/controller/query/show.rb +50 -0
  45. data/lib/{session/require.gem.rb → controller/requirer.rb} +13 -9
  46. data/lib/{usecase → controller}/set.rb +4 -4
  47. data/lib/controller/usecase.rb +244 -0
  48. data/lib/{usecase → controller}/verse.rb +0 -0
  49. data/lib/{usecase → controller}/visit/README.md +0 -0
  50. data/lib/{usecase → controller}/visit/visit.rb +0 -0
  51. data/lib/factbase/facts.safedb.net.ini +7 -7
  52. data/lib/{keytools/key.docs.rb → model/README.md} +102 -66
  53. data/lib/model/book.rb +484 -0
  54. data/lib/model/branch.rb +48 -0
  55. data/lib/model/checkin.feature +33 -0
  56. data/lib/{configs/README.md → model/configs.md} +4 -4
  57. data/lib/model/content.rb +214 -0
  58. data/lib/model/indices.rb +132 -0
  59. data/lib/model/safe_tree.rb +51 -0
  60. data/lib/model/state.inspect.rb +221 -0
  61. data/lib/model/state.migrate.rb +334 -0
  62. data/lib/model/text_chunk.rb +68 -0
  63. data/lib/{extension → utils/extend}/array.rb +0 -0
  64. data/lib/{extension → utils/extend}/dir.rb +0 -0
  65. data/lib/{extension → utils/extend}/file.rb +0 -0
  66. data/lib/utils/extend/hash.rb +76 -0
  67. data/lib/{extension → utils/extend}/string.rb +6 -6
  68. data/lib/{session/fact.finder.rb → utils/facts/fact.rb} +0 -0
  69. data/lib/utils/identity/identifier.rb +356 -0
  70. data/lib/{keytools/key.ident.rb → utils/identity/machine.id.rb} +67 -4
  71. data/lib/utils/inspect/inspector.rb +81 -0
  72. data/lib/{keytools/kdf.bcrypt.rb → utils/kdfs/bcrypt.rb} +0 -0
  73. data/lib/{keytools → utils/kdfs}/kdf.api.rb +16 -16
  74. data/lib/{keytools/key.local.rb → utils/kdfs/kdfs.rb} +40 -40
  75. data/lib/{keytools/kdf.pbkdf2.rb → utils/kdfs/pbkdf2.rb} +0 -0
  76. data/lib/{keytools/kdf.scrypt.rb → utils/kdfs/scrypt.rb} +0 -0
  77. data/lib/{keytools → utils}/key.error.rb +2 -2
  78. data/lib/{keytools → utils}/key.pass.rb +2 -2
  79. data/lib/{keytools → utils/keys}/key.64.rb +0 -0
  80. data/lib/{keytools → utils/keys}/key.rb +6 -2
  81. data/lib/{keytools/key.iv.rb → utils/keys/random.iv.rb} +0 -0
  82. data/lib/{logging/gem.logging.rb → utils/logs/logger.rb} +6 -5
  83. data/lib/{keytools/key.pair.rb → utils/store/datamap.rb} +48 -30
  84. data/lib/{keytools/key.db.rb → utils/store/datastore.rb} +38 -104
  85. data/lib/utils/store/merge-boys-school.json +40 -0
  86. data/lib/utils/store/merge-girls-school.json +48 -0
  87. data/lib/utils/store/merge-merged-data.json +56 -0
  88. data/lib/utils/store/struct.rb +75 -0
  89. data/lib/utils/store/test-commands.sh +24 -0
  90. data/lib/{keytools/key.now.rb → utils/time/timestamp.rb} +32 -21
  91. data/lib/version.rb +1 -1
  92. metadata +86 -73
  93. data/lib/extension/hash.rb +0 -33
  94. data/lib/keytools/key.algo.rb +0 -109
  95. data/lib/keytools/key.api.rb +0 -1326
  96. data/lib/keytools/key.id.rb +0 -322
  97. data/lib/modules/cryptology/amalgam.rb +0 -70
  98. data/lib/modules/cryptology/engineer.rb +0 -99
  99. data/lib/modules/mappers/dictionary.rb +0 -288
  100. data/lib/session/time.stamp.rb +0 -340
  101. data/lib/session/user.home.rb +0 -49
  102. data/lib/usecase/cmd.rb +0 -471
  103. data/lib/usecase/edit/delete.rb +0 -46
  104. data/lib/usecase/files/file_me.rb +0 -78
  105. data/lib/usecase/files/read.rb +0 -169
  106. data/lib/usecase/files/write.rb +0 -89
  107. data/lib/usecase/goto.rb +0 -57
  108. data/lib/usecase/import.rb +0 -157
  109. data/lib/usecase/init.rb +0 -61
  110. data/lib/usecase/login.rb +0 -72
  111. data/lib/usecase/open.rb +0 -71
  112. data/lib/usecase/print.rb +0 -40
  113. data/lib/usecase/put.rb +0 -81
  114. data/lib/usecase/show.rb +0 -138
  115. data/lib/usecase/update/rename.rb +0 -180
  116. data/lib/usecase/view.rb +0 -71
data/lib/usecase/init.rb DELETED
@@ -1,61 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- module SafeDb
4
-
5
- # The <b>init use case</b> initializes safe thus preparing it
6
- # for the ability to lock secrets, unlock them, transport their keys and
7
- # much more.
8
- #
9
- # safe is a <b>(glorified) placeholder</b>. It takes things in now,
10
- # keeps them safe and gives them back later, in a <b>helpful manner</b>.
11
- #
12
- # == Alternat Error Flows
13
- #
14
- # An error will be thrown
15
- #
16
- # - if safe cannot create, extend, read or write the drive folder
17
- # - if the domain is already in the configuration file
18
- # - if domain has non alphanums, excl hyphens, underscores, @ symbols, periods
19
- # - if domain does not begin or end with alphanums.
20
- # - if non alpha-nums (excl at signs) appear consecutively
21
- # - if no alpha-nums appear in the string
22
- # - if the domain string's length is less than 5
23
- # - if "safedb.net" appears twice (or more) in a directory tree
24
- #
25
- class Init < UseCase
26
-
27
- attr_writer :password, :domain_name, :base_path
28
-
29
-
30
- # The init use case prepares the <b>safe</b> so that you can <b>open</b> an envelope,
31
- # <b>put</b> secrets into it and then <b>seal</b> (lock) it. Locking effectively writes
32
- # crypted blocks to both keystore and crypt store.
33
- def execute
34
-
35
- return unless ops_key_exists?
36
-
37
- KeyApi.init_app_domain( @domain_name, @base_path )
38
- keys_setup = KeyApi.is_domain_keys_setup?( @domain_name )
39
-
40
- if ( keys_setup )
41
- print_already_initialized
42
- return
43
- end
44
-
45
- domain_password = KeyPass.password_from_shell( true ) if @password.nil?
46
- domain_password = @password unless @password.nil?
47
-
48
- KeyApi.setup_domain_keys( @domain_name, domain_password, create_header() )
49
- print_domain_initialized
50
-
51
- end
52
-
53
-
54
- def pre_validation
55
- end
56
-
57
-
58
- end
59
-
60
-
61
- end
data/lib/usecase/login.rb DELETED
@@ -1,72 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- module SafeDb
4
-
5
- # The <b>login use case</b> is given the domain name and if needs be
6
- # it collects the password then (if correct) logs the user in.
7
- #
8
- # Here are some key facts about the login command
9
- #
10
- # - its domain name parameter is mandatory
11
- # - it is called at the start of every session
12
- # - it is undone by the logout command
13
- # - it requires the shell token environment variable to be set
14
- # - you can nest login commands thus using multiple domains
15
- # - you can call it with a --with=password switch
16
- # - a space before the command prevents it being logged in .bash_history
17
- # - you can deliver the password in multiple ways
18
- class Login < UseCase
19
-
20
- attr_writer :password, :domain_name
21
-
22
-
23
- def execute
24
-
25
- return unless ops_key_exists?
26
-
27
- unless ( KeyApi.is_domain_keys_setup?( @domain_name ) )
28
- print_not_initialized
29
- return
30
- end
31
-
32
- ############## Call [[ KeyApi.is_logged_in? ]] - then print msg and skip password collection below
33
- ############## Call [[ KeyApi.is_logged_in? ]] - then print msg and skip password collection below
34
- ############## Call [[ KeyApi.is_logged_in? ]] - then print msg and skip password collection below
35
- ############## Call [[ KeyApi.is_logged_in? ]] - then print msg and skip password collection below
36
- ############## Call [[ KeyApi.is_logged_in? ]] - then print msg and skip password collection below
37
- ############## Call [[ KeyApi.is_logged_in? ]] - then print msg and skip password collection below
38
-
39
- domain_secret = KeyPass.password_from_shell( false ) if @password.nil?
40
- domain_secret = @password unless @password.nil?
41
-
42
- ############## Use [[ KeyApi.valid_password? ]] and give error if not valid
43
- ############## Use [[ KeyApi.valid_password? ]] and give error if not valid
44
- ############## Use [[ KeyApi.valid_password? ]] and give error if not valid
45
- ############## Use [[ KeyApi.valid_password? ]] and give error if not valid
46
- ############## Use [[ KeyApi.valid_password? ]] and give error if not valid
47
-
48
- KeyApi.do_login( @domain_name, domain_secret, create_header() )
49
-
50
- view_uc = View.new
51
- view_uc.flow_of_events
52
-
53
- end
54
-
55
-
56
- # Perform pre-conditional validations in preparation to executing the main flow
57
- # of events for this use case. This method may throw the below exceptions.
58
- #
59
- # @raise [SafeDirNotConfigured] if the safe's url has not been configured
60
- # @raise [EmailAddrNotConfigured] if the email address has not been configured
61
- # @raise [StoreUrlNotConfigured] if the crypt store url is not configured
62
- def pre_validation
63
-
64
- end
65
-
66
-
67
- end
68
-
69
-
70
- end
71
-
72
-
data/lib/usecase/open.rb DELETED
@@ -1,71 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- module SafeDb
4
-
5
- # The <tt>open use case</tt> allows us to add (put), subtract (del)ete, change
6
- # (update) and list the secrets within an envelope (outer path) at a given
7
- # position (inner path), whether that envelope exists or not.
8
- #
9
- # Also see the <b>reopen</b> command which only differs from open in that it
10
- # fails if the path specified does not exist in either the sealed or session
11
- # envelopes.
12
- #
13
- # == The Open Path Parameter
14
- #
15
- # Open must be called with a single <b>path</b> parameter with an optional
16
- # single colon separating the outer (path to envelope) from the inner (path
17
- # within envelope).
18
- #
19
- # == Open (Path) Pre-Conditions
20
- #
21
- # The domain must have been initialized on this machine stating the path to
22
- # the base folder that contains the key and crypt material.
23
- #
24
- # To open a path these conditions must be true.
25
- #
26
- # - the shell session token must have been set at the session beginning
27
- # - a successful <tt>login</tt> command must have been issued
28
- # - the external drive (eg usb key) must be configured and accessible
29
- #
30
- # == Observable Value
31
- #
32
- # The observable value delivered by +[open]+ boils down to
33
- #
34
- # - an openkey (eg asdfx1234) and corresponding open encryption key
35
- # - open encryption key written to <tt>~/.safedb.net/open.keys/asdfx1234.x.txt</tt>
36
- # - the opened path (ending in filename) written to session.cache base in [safe]
37
- # - the INI string (were the file to be decrypted) would look like the below
38
- #
39
- # [session]
40
- # base.path = home/wifi
41
- #
42
- class Open < UseCase
43
-
44
- # The two paths that have been posted to the open command.
45
- # First is a relative path to the obfuscated envelope and then
46
- # the path in envelope to the point of interest.
47
- attr_writer :env_path, :key_path
48
-
49
- def execute
50
-
51
- return unless ops_key_exists?
52
- master_db = KeyApi.read_master_db()
53
-
54
- master_db[ ENV_PATH ] = @env_path
55
- master_db[ KEY_PATH ] = @key_path
56
-
57
- KeyApi.write_master_db( create_header(), master_db )
58
-
59
- # Show the mini dictionary at the opened chapter and verse location
60
- # More work is needed when for when only the chapter is opened in
61
- # which case we should show the list of verses and perhaps the count
62
- # of key value pairs each verse contains.
63
- Show.new.flow_of_events
64
-
65
- end
66
-
67
-
68
- end
69
-
70
-
71
- end
data/lib/usecase/print.rb DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- module SafeDb
4
-
5
- class Print < UseCase
6
-
7
- attr_writer :key_name
8
-
9
- def get_chapter_data( chapter_key )
10
- return KeyDb.from_json( KeyApi.content_unlock( chapter_key ) )
11
- end
12
-
13
- def execute
14
-
15
- return unless ops_key_exists?
16
-
17
- master_db = get_master_database()
18
-
19
- return if unopened_envelope?( master_db )
20
-
21
- chapter_id = ENVELOPE_KEY_PREFIX + master_db[ ENV_PATH ]
22
- has_chapter = KeyApi.db_envelope_exists?( master_db[ chapter_id ] )
23
-
24
- chapter_data = get_chapter_data( master_db[ chapter_id ] ) if has_chapter
25
- has_verse = has_chapter && chapter_data.has_key?( master_db[ KEY_PATH ] )
26
-
27
- chapter_err_msg = "Nothing was found at chapter " + master_db[ ENV_PATH ]
28
- raise ArgumentError, chapter_err_msg unless has_chapter
29
- verse_err_msg = "Nothing was found at chapter " + master_db[ ENV_PATH ] + " verse " + master_db[ KEY_PATH ]
30
- raise ArgumentError, verse_err_msg unless has_verse
31
-
32
- print chapter_data[ master_db[ KEY_PATH ] ][ @key_name ]
33
-
34
- end
35
-
36
-
37
- end
38
-
39
-
40
- end
data/lib/usecase/put.rb DELETED
@@ -1,81 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- module SafeDb
4
-
5
- # The <b>put use case</b> follows <b>open</b> and it adds secrets into an
6
- # <em>(encrypted at rest)</em> <b>envelope</b>. Put can be called many times
7
- # and when done, the <b>lock use case</b> can be called to commit all opened
8
- # secrets into the configured storage engines.
9
- #
10
- # Calling <em>put</em> <b>before</b> calling open or <b>after</b> calling lock
11
- # is not allowed and will result in an error.
12
- #
13
- # == Put Pre-Conditions
14
- #
15
- # When the put use case is called - the below conditions ring true.
16
- #
17
- # - the <b>folder path</b> ending in ../../my must exist
18
- # - a session id, filename and encryption key ( in workstation config )
19
- #
20
- # == Observable Value
21
- #
22
- # The observable value delivered by +put+ boils down to
23
- #
24
- # - a new <b>friends.xyz123abc.os.txt</b> file if this is the first put.
25
- # - a new group_name/key_name (like monica/surname) entry is added if required
26
- # - a secret value is added against the key or updated if it already exists
27
- # - a new session id and encryption key is generated and used to re-encrypt
28
- class Put < UseCase
29
-
30
- attr_writer :secret_id, :secret_value
31
-
32
- # Execute the act of putting a string key and string value pair into a
33
- # map at the chapter and verse location, overwriting if need be.
34
- def execute
35
-
36
- return unless ops_key_exists?
37
- master_db = KeyApi.read_master_db()
38
-
39
- return if unopened_envelope?( master_db )
40
-
41
- envelope_id = ENVELOPE_KEY_PREFIX + master_db[ ENV_PATH ]
42
- has_content = KeyApi.db_envelope_exists?( master_db[ envelope_id ] )
43
-
44
- # To get hold of the content we must either
45
- #
46
- # a) unlock it using the breadcrumbs or
47
- # b) start afresh with a new content db
48
- content_box = KeyDb.from_json( KeyApi.content_unlock( master_db[ envelope_id ] ) ) if has_content
49
- content_box = KeyDb.new() unless has_content
50
- content_hdr = create_header()
51
-
52
- # If no content envelope exists we need to place
53
- # an empty one inside the appdb content database.
54
- master_db[ envelope_id ] = {} unless has_content
55
-
56
- # This is the PUT use case so we append a
57
- #
58
- # a) key for the new dictionary entry
59
- # b) value for the new dictionary entry
60
- #
61
- # into the current content envelope and write
62
- # the envelope to the content filepath.
63
- crumbs_dict = master_db[ envelope_id ]
64
- content_box.create_entry( master_db[ KEY_PATH ], @secret_id, @secret_value )
65
- KeyApi.content_lock( crumbs_dict, content_box.to_json, content_hdr )
66
-
67
- # Three envelope crumbs namely the external ID, the
68
- # random iv and the crypt key are written afresh into
69
- # the master database.
70
- KeyApi.write_master_db( content_hdr, master_db )
71
-
72
- # Show the mini dictionary at the opened chapter and verse location
73
- Show.new.flow_of_events
74
-
75
- end
76
-
77
-
78
- end
79
-
80
-
81
- end
data/lib/usecase/show.rb DELETED
@@ -1,138 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- module SafeDb
4
-
5
- # Show the mini dictionary of key-value pairs within the logged in book
6
- # at the opened chapter and verse.
7
- #
8
- # If no dictionary exists at the opened chapter and verse a suitable
9
- # message is pushed out to the console.
10
- class Show < UseCase
11
-
12
- def get_chapter_data( chapter_key )
13
- return KeyDb.from_json( KeyApi.content_unlock( chapter_key ) )
14
- end
15
-
16
- def execute
17
-
18
- return unless ops_key_exists?
19
- master_db = KeyApi.read_master_db()
20
-
21
- return if unopened_envelope?( master_db )
22
-
23
- chapter_id = ENVELOPE_KEY_PREFIX + master_db[ ENV_PATH ]
24
- has_chapter = KeyApi.db_envelope_exists?( master_db[ chapter_id ] )
25
- chapter_data = get_chapter_data( master_db[ chapter_id ] ) if has_chapter
26
- has_verse = has_chapter && chapter_data.has_key?( master_db[ KEY_PATH ] )
27
-
28
-
29
- ##global_variables - DONE
30
- ##local_variables - DONE
31
- ##instance_variables - DONE
32
- ##class_variables - tough nut to crack with very little benefit (method class_variables not defined)
33
-
34
- =begin
35
- puts ""
36
- puts "QQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
37
- puts "QQQ ~~~~~~~~~~~~~ Global Variable Array List ~~~~~~~~~~~~~~~~ QQQQQ"
38
- puts "QQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
39
-
40
- puts global_variables.inspect
41
-
42
- puts "QQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
43
- puts "QQQ ~~~~~~~~~~~~~ Global Variable Values Printed ~~~~~~~~~~~~~~~~ QQQQQ"
44
- puts "QQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
45
-
46
- global_variables.sort.each do |name|
47
-
48
- puts "<<< ------------------------------------------------------------------->>>"
49
- puts "<<< #{name.to_s} >>>"
50
- puts "<<< ------------------------------------------------------------------->>>"
51
- next if name.to_s.eql?( "$FILENAME" )
52
- global_variable_value = eval "#{name}.inspect"
53
- puts "<<< #{global_variable_value}"
54
-
55
- end
56
-
57
- puts ""
58
- puts "QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
59
- puts "QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
60
- puts ""
61
- puts "QQQQQQQQQQQ QQQQQQQQQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
62
- puts "QQQQQQQQQQQ Bug Finder QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
63
- puts "QQQQQQQQQQQ QQQQQQQQQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
64
- puts ""
65
- self.instance_variables.map do |attribute|
66
- puts "=============================================="
67
- puts "----------------------------------------------"
68
- puts attribute
69
- pp self.instance_variable_get(attribute)
70
- end
71
- puts "=============================================="
72
- puts "QQQQQQQQQQQ QQQQQQQQQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
73
- puts "QQQQQQQQQQQ QQQQQQQQQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
74
- puts ""
75
- puts "### ------------------------------------"
76
- puts "### Inspect View"
77
- puts "### ------------------------------------"
78
- pp self.inspect
79
- puts "### ------------------------------------"
80
- puts "QQQQQQQQQQQ QQQQQQQQQQQQQQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
81
- puts "QQQQQQQQQQQ Local Variables QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
82
- puts "QQQQQQQQQQQ QQQQQQQQQQQQQQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
83
-
84
- local_variables.map do |attribute|
85
- puts "=============================================="
86
- puts "----------------------------------------------"
87
- puts attribute
88
- pp binding.local_variable_get(attribute.to_sym)
89
- end
90
- puts "QQQQQQQQQQQ QQQQQQQQQQQQQQQ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
91
-
92
- puts ""
93
- =end
94
-
95
-
96
- return unless has_verse
97
-
98
- line_dictionary = chapter_data[ master_db[ KEY_PATH ] ]
99
-
100
- puts ""
101
- puts "### ##################################\n"
102
- puts "### chapter =>> #{master_db[ ENV_PATH ]}\n"
103
- puts "### & verse =>> #{master_db[ KEY_PATH ]}\n"
104
- puts "### # lines =>> #{line_dictionary.length}\n"
105
- puts "### ##################################\n"
106
- puts "--- ----------------------------------\n"
107
- puts ""
108
-
109
- showable_content = {}
110
- line_dictionary.each do | key_str, value_object |
111
-
112
- is_file = key_str.start_with? FILE_KEY_PREFIX
113
- value_object.store( FILE_CONTENT_KEY, SECRET_MASK_STRING ) if is_file
114
- showable_content.store( key_str[ FILE_KEY_PREFIX.length .. -1 ], value_object ) if is_file
115
- next if is_file
116
-
117
- is_secret = key_str.start_with? "@"
118
- showable_val = SECRET_MASK_STRING if is_secret
119
- showable_val = value_object unless is_secret
120
- showable_content.store( key_str, showable_val )
121
-
122
- end
123
-
124
- puts JSON.pretty_generate( showable_content )
125
- puts "--- ----------------------------------\n"
126
- puts "### ##################################\n"
127
- puts ""
128
-
129
- end
130
-
131
- private
132
-
133
- SECRET_MASK_STRING = "***********************"
134
-
135
- end
136
-
137
-
138
- end