Add second message to scratchpad.sh
This commit is contained in:
parent
1ef6d4e6ce
commit
cb13fbe57a
|
@ -79,6 +79,11 @@ module Pigeon
|
|||
Template.new(self).render
|
||||
end
|
||||
|
||||
def message_id # I need this to calculate `prev`.
|
||||
raise "NO!" unless @signature && !@signature.downcase.include?("draft")
|
||||
Digest::SHA256.digest(self.render)
|
||||
end
|
||||
|
||||
def append(key, value)
|
||||
# TODO: Sanitize, validate inputs.
|
||||
case value[0]
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
require "strscan"
|
||||
|
||||
module Pigeon
|
||||
class Token
|
||||
attr_reader :kind
|
||||
attr_accessor :content
|
||||
|
||||
def initialize(kind)
|
||||
@kind = kind
|
||||
end
|
||||
end
|
||||
|
||||
class Parser
|
||||
def initialize(string)
|
||||
puts "THIS CLASS IS AN EXPERIMENT"
|
||||
puts "I MIGHT DELETE IT LATER."
|
||||
@scanner = StringScanner.new(string)
|
||||
# @scanner.peek
|
||||
# @scanner.scan_until
|
||||
# @scanner.getch
|
||||
end
|
||||
end
|
||||
end
|
|
@ -60,11 +60,17 @@ echo "...blob"
|
|||
echo "...identity"
|
||||
./pigeon-cli message append key6 \@galdahnB3L2DE2cTU0Me54IpIUKVEgKmBwvZVtWJccg=.ed25519
|
||||
|
||||
echo "show draft message"
|
||||
echo "== show draft message"
|
||||
./pigeon-cli message show
|
||||
|
||||
echo "sign (publish, save, commit, etc) draft message"
|
||||
echo "== sign (publish, save, commit, etc) draft message"
|
||||
./pigeon-cli message sign
|
||||
|
||||
echo "=== add a second message to the db"
|
||||
./pigeon-cli message create second_test
|
||||
./pigeon-cli message append hello "world"
|
||||
./pigeon-cli message sign
|
||||
./pigeon-cli message show
|
||||
|
||||
echo "getting status:"
|
||||
./pigeon-cli status
|
||||
|
|
|
@ -3,11 +3,11 @@ require "spec_helper"
|
|||
RSpec.describe Pigeon::Template do
|
||||
MessageShim = Struct.new(:author, :body, :kind, :depth, :prev, :signature)
|
||||
EXPECTED_DRAFT = [
|
||||
"\nauthor FAKE_AUTHOR",
|
||||
"author FAKE_AUTHOR",
|
||||
"\nkind FAKE_KIND",
|
||||
"\nprev DRAFT",
|
||||
"\ndepth DRAFT",
|
||||
"\n\n\nsignature DRAFT \n\n",
|
||||
"\n\n\nsignature DRAFT \n",
|
||||
].join("")
|
||||
it "renders a DRAFT" do
|
||||
args = ["FAKE_AUTHOR",
|
||||
|
|
Loading…
Reference in New Issue