Update spec, begin message implementation
This commit is contained in:
parent
fd517e6117
commit
9953bcee2c
|
@ -23,8 +23,7 @@ Eg: `pigeon identity show` becomes `./pigeon-cli show`.
|
||||||
- [X] pigeon peer remove
|
- [X] pigeon peer remove
|
||||||
- [X] pigeon peer block
|
- [X] pigeon peer block
|
||||||
- [X] pigeon peer all
|
- [X] pigeon peer all
|
||||||
- [ ] Update spec to look [like this](https://gist.github.com/RickCarlino/3ff4178db4a75fd135832c403cd313d4)
|
- [ ] pigeon message create
|
||||||
- [ ] pigeon message new
|
|
||||||
- [ ] pigeon message append
|
- [ ] pigeon message append
|
||||||
- [ ] pigeon message current
|
- [ ] pigeon message current
|
||||||
- [ ] pigeon message save
|
- [ ] pigeon message save
|
||||||
|
@ -37,3 +36,5 @@ Eg: `pigeon identity show` becomes `./pigeon-cli show`.
|
||||||
- [ ] add parsers and validators for all CLI inputs
|
- [ ] add parsers and validators for all CLI inputs
|
||||||
- [ ] Performance benchmarks
|
- [ ] Performance benchmarks
|
||||||
- [ ] Performance tuning (DO THIS LAST!)
|
- [ ] Performance tuning (DO THIS LAST!)
|
||||||
|
|
||||||
|
- [ ] Update spec to look [like this](https://gist.github.com/RickCarlino/3ff4178db4a75fd135832c403cd313d4)
|
||||||
|
|
12
TODO.md
12
TODO.md
|
@ -4,9 +4,10 @@ I'm adding them here for quick reference.
|
||||||
|
|
||||||
```
|
```
|
||||||
author @ajgdylxeifojlxpbmen3exlnsbx8buspsjh37b/ipvi=.ed25519
|
author @ajgdylxeifojlxpbmen3exlnsbx8buspsjh37b/ipvi=.ed25519
|
||||||
depth 23
|
sequence 23
|
||||||
kind "example"
|
kind "example"
|
||||||
prev %85738f8f9a7f1b04b5329c590ebcb9e425925c6d0984089c43a022de4f19c281.sha256
|
previous %85738f8f9a7f1b04b5329c590ebcb9e425925c6d0984089c43a022de4f19c281.sha256
|
||||||
|
timestamp 23123123123
|
||||||
|
|
||||||
"foo":&3f79bb7b435b05321651daefd374cdc681dc06faa65e374e38337b88ca046dea.sha256
|
"foo":&3f79bb7b435b05321651daefd374cdc681dc06faa65e374e38337b88ca046dea.sha256
|
||||||
"baz":"bar"
|
"baz":"bar"
|
||||||
|
@ -23,11 +24,6 @@ pigeon message new my_message
|
||||||
|
|
||||||
pigeon message current # Show active log entry.
|
pigeon message current # Show active log entry.
|
||||||
# => author: @ajgdylxeifojlxpbmen3exlnsbx8buspsjh37b/ipvi=.ed25519
|
# => author: @ajgdylxeifojlxpbmen3exlnsbx8buspsjh37b/ipvi=.ed25519
|
||||||
# => depth: 1
|
|
||||||
# => kind: &82244417f956ac7c599f191593f7e441a4fafa20a4158fd52e154f1dc4c8ed92.sha256
|
|
||||||
# => prev: %jvKh9yoiEJaePzoWCF1nnqpIlPgTk9FHEtqczQbvzGM=.sha256
|
|
||||||
# =>
|
|
||||||
# =>
|
|
||||||
|
|
||||||
pigeon message append --name=2e7a0bc3 --value=2e7a0bc3
|
pigeon message append --name=2e7a0bc3 --value=2e7a0bc3
|
||||||
# => \n
|
# => \n
|
||||||
|
@ -35,7 +31,7 @@ pigeon message append --name=2e7a0bc3 --value=2e7a0bc3
|
||||||
# => No one likes the way it is right now.
|
# => No one likes the way it is right now.
|
||||||
# => We will come back to this monstrosity later.
|
# => We will come back to this monstrosity later.
|
||||||
|
|
||||||
pigeon message save
|
pigeon message sign
|
||||||
# => author: @ajgdylxeifojlxpbmen3exlnsbx8buspsjh37b/ipvi=.ed25519
|
# => author: @ajgdylxeifojlxpbmen3exlnsbx8buspsjh37b/ipvi=.ed25519
|
||||||
# => depth: 1
|
# => depth: 1
|
||||||
# => kind: &82244417f956ac7c599f191593f7e441a4fafa20a4158fd52e154f1dc4c8ed92.sha256
|
# => kind: &82244417f956ac7c599f191593f7e441a4fafa20a4158fd52e154f1dc4c8ed92.sha256
|
||||||
|
|
|
@ -1,5 +1,36 @@
|
||||||
module Pigeon
|
module Pigeon
|
||||||
class Message
|
class Message
|
||||||
# WIP - will work on peer stuff first
|
NAME_OF_DRAFT = "HEAD"
|
||||||
|
|
||||||
|
attr_reader :author,
|
||||||
|
:kind,
|
||||||
|
:previous,
|
||||||
|
:body,
|
||||||
|
:sequence, # Maybe not?
|
||||||
|
:timestamp, # Maybe not?
|
||||||
|
:signature # Maybe not?
|
||||||
|
|
||||||
|
def initialize(author:, kind:, previous: nil, body: [])
|
||||||
|
@author = author
|
||||||
|
@kind = kind
|
||||||
|
@previous = previous
|
||||||
|
@body = body
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.create(author:, kind:, previous: nil, body: [])
|
||||||
|
# instantiate
|
||||||
|
msg = self.new(author: author,
|
||||||
|
kind: kind,
|
||||||
|
previous: previous,
|
||||||
|
body: body)
|
||||||
|
# Save to disk as HEAD
|
||||||
|
Pigeon::Storage.set_config(NAME_OF_DRAFT, msg.dump)
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def dump
|
||||||
|
string = Marshal.dump(self)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -82,7 +82,7 @@ module Pigeon
|
||||||
.map { |x| KeyPair.add_headers(x) }
|
.map { |x| KeyPair.add_headers(x) }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private # ====================================
|
||||||
|
|
||||||
def initialized?
|
def initialized?
|
||||||
File.directory?(root_dir)
|
File.directory?(root_dir)
|
||||||
|
|
15
pigeon-cli
15
pigeon-cli
|
@ -72,6 +72,18 @@ module Pigeon
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class PigeonMessage < Thor
|
||||||
|
desc "create", "Begin a new Pigeon message"
|
||||||
|
|
||||||
|
def create(kind)
|
||||||
|
raise "TODO: FIXME"
|
||||||
|
puts Pigeon::Message.create(
|
||||||
|
kind: "???",
|
||||||
|
author: "???",
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class CLI < Thor
|
class CLI < Thor
|
||||||
desc "status", "Show various information about the `.pigeon` directory"
|
desc "status", "Show various information about the `.pigeon` directory"
|
||||||
|
|
||||||
|
@ -97,6 +109,9 @@ module Pigeon
|
||||||
|
|
||||||
desc "peer SUBCOMMAND ...ARGS", "Manage blob storage"
|
desc "peer SUBCOMMAND ...ARGS", "Manage blob storage"
|
||||||
subcommand "peer", Peer
|
subcommand "peer", Peer
|
||||||
|
|
||||||
|
desc "message SUBCOMMAND ...ARGS", "Manage messages"
|
||||||
|
subcommand "message", PigeonMessage
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,7 @@ RSpec.describe Pigeon::Storage do
|
||||||
include FakeFS::SpecHelpers
|
include FakeFS::SpecHelpers
|
||||||
LOGO_BLOB = File.read("./logo.png")
|
LOGO_BLOB = File.read("./logo.png")
|
||||||
IDS = %w(@_TlC2z3FT4fimecC4eytrBhOwhLUZsVBZEZriBO9cWs=.ed25519
|
IDS = %w(@_TlC2z3FT4fimecC4eytrBhOwhLUZsVBZEZriBO9cWs=.ed25519
|
||||||
@28FyT7evjcYrrwngr8G2V1HZ0ODK0VPsFctDEZwfZJc=.ed25519
|
@28FyT7evjcYrrwngr8G2V1HZ0ODK0VPsFctDEZwfZJc=.ed25519)
|
||||||
@ExA5Fmld-vMDjROfN30G5pmSp_261QILFP3qe64iDn8=.ed25519
|
|
||||||
@galdahnB3L2DE2cTU0Me54IpIUKVEgKmBwvZVtWJccg=.ed25519
|
|
||||||
@I6cN_IE9iPmH05xXnlI_WyLqnrAoKv1plUKWfiGSSK4=.ed25519
|
|
||||||
@JnCKDs5tIzY9OF--GFT94Qj5jHtK7lTxqCt1tmPcwjM=.ed25519
|
|
||||||
@q-_9BTnTThvW2ZGkmy8D3j-hW9ON2PNa3nwbCQgRw-g=.ed25519
|
|
||||||
@VIim19-PzaavRICicQg4c4z08SoWTa1tr2e-kfhmm0Y=.ed25519)
|
|
||||||
|
|
||||||
def test_fs
|
def test_fs
|
||||||
FakeFS.with_fresh do
|
FakeFS.with_fresh do
|
||||||
|
|
Loading…
Reference in New Issue