Rename "ALPHANUMERICISH" to "B64LIKE". Fix tests.

This commit is contained in:
Netscape Navigator 2020-04-02 07:22:52 -05:00
parent 3c36f0efc2
commit 82ed554aba
3 changed files with 8 additions and 9 deletions

View File

@ -38,8 +38,8 @@ Eg: `pigeon identity show` becomes `./pigeon-cli show`.
- [X] pigeon bundle consume (We are minimally feature complete at this point)
- [X] Fix the diagram in the spec document
- [ ] 100% test coverage
- [ ] Why are blob multihashes in hex rather than b64?
- [ ] Use URNs instead of multihash?
- [ ] Fork detection?
- [ ] Put all the [HEADER, string, FOOTER].join("") nonsense into Pigeon::Helpers
- [ ] Change all the `{40,90}` values in ::Lexer to real length values
- [ ] Update the bundles.md document once `bundle consume` works.

View File

@ -39,11 +39,10 @@ module Pigeon
when BLOB_SIGIL, MESSAGE_SIGIL, IDENTITY_SIGIL, STRING_SIGIL
self.body[key] = value
else
if value.is_a?(String)
self.body[key] = value.inspect
else
raise "Unexpected value! Did you wrap it in quotes?: #{value}"
end
# If users passes a string and forgets to append
# the string sigil (\"), we add it for them.
# This might be a bad or good idea. Not sure yet.
self.body[key] = value.inspect
end
self.save
return self.body[key]

View File

@ -9,7 +9,7 @@ module Pigeon
BLOB_VALUE = /&.{40,90}.sha256/
NULL_VALUE = /NONE/
STRG_VALUE = /".{1,64}"/
ALPHANUMERICISH = /[a-zA-Z0-9_-]{1,64}/
B64LIKE = /[a-zA-Z0-9_\-=]{1,64}/
ALL_VALUES = [
FEED_VALUE,
MESG_VALUE,
@ -23,8 +23,8 @@ module Pigeon
AUTHOR = /author #{FEED_VALUE}\n/
DEPTH = /depth #{DEPTH_COUNT}\n/
PREV = /prev (#{MESG_VALUE}|#{NULL_VALUE})\n/
KIND = /kind #{ALPHANUMERICISH}\n/
BODY_ENTRY = /#{ALPHANUMERICISH}:#{ANY_VALUE}\n/
KIND = /kind #{B64LIKE}\n/
BODY_ENTRY = /#{B64LIKE}:#{ANY_VALUE}\n/
FOOTER_ENTRY = /signature .*{87,88}\.sig\.ed25519\n?/