qqq 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.org +34 -14
- data/Gemfile.lock +13 -13
- data/Rakefile +1 -7
- data/lib/qqq/api.rb +3 -3
- data/lib/qqq/cli.rb +13 -8
- data/lib/qqq/event.rb +21 -1
- data/lib/qqq/keys.rb +1 -1
- data/lib/qqq/version.rb +1 -1
- data/lib/qqq.rb +20 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 901963455ef035a7b1055749513102b79fa568304c668038a585dcff606f73b8
|
4
|
+
data.tar.gz: 7de4aa5267b50b0d62b8815237ad61e36111d0859a0f7379f5d83388dc03ebf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3739b7a3fcbc083cf1017e64c5fc0182e120afb6b6e9736c69bfd6f175497ecbb8a79971e749e689622367f3b77df12802ad088f22f259403ba2da6fea4cfc2
|
7
|
+
data.tar.gz: 471fc79d97ac7583978b2582eaa4bb77366e58e9cd445abf750069f399ec308e7232a175f1aaeac8e482262f1efb949dc945797213906abcae847fc10d8e488b
|
data/CHANGELOG.org
CHANGED
@@ -1,39 +1,59 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
* Version 0.1.0 - Milestone I
|
2
3
|
|
3
4
|
"Better than puts"
|
4
5
|
|
5
6
|
features
|
6
|
-
- [
|
7
|
-
- [ ] metaprogramming / reflection
|
8
|
-
|
9
|
-
- [ ] rich data
|
10
|
-
- [ ] recorded timestamp and uuid recorded in db
|
7
|
+
- [X] recorded timestamp and uuid recorded in db
|
11
8
|
- [X] record in a database
|
12
9
|
- [X] send to an api
|
13
10
|
- [X] timestamps
|
14
11
|
- [X] send message from command line
|
15
12
|
- [X] tail and mark from command line
|
16
|
-
- [ ] did not run (no wondering if line didn't run)... possible?
|
17
|
-
- [ ] increments if run multiple times..
|
18
|
-
- [ ] start / stop 'marks'
|
19
13
|
|
20
|
-
dev
|
14
|
+
dev
|
15
|
+
- [ ] simplify dashboard
|
21
16
|
- [X] create rudimentary uh... dashboard/orchestration
|
22
17
|
- [X] Tighten e2e.sh test.
|
23
|
-
|
24
|
-
|
18
|
+
|
19
|
+
** 0.1.1
|
20
|
+
|
21
|
+
table stakes
|
22
|
+
- [ ] some sort of supervisor around cli, etc. e.g. api send dies if server not up yet. should hang out and retry
|
23
|
+
- [ ] update documentation
|
24
|
+
- [ ] general presentation polish
|
25
|
+
- [ ] more tests? CI?
|
26
|
+
|
27
|
+
features
|
28
|
+
- [ ] a way to specifiy redis config (my qqq's in tests are getting lost to a fake redis)
|
25
29
|
|
26
30
|
* Milestone II
|
27
31
|
|
28
32
|
features
|
33
|
+
- [ ] did not run (no wondering if line didn't run)... possible?
|
34
|
+
- [ ] increments if run multiple times..
|
35
|
+
- [ ] start / stop 'marks'
|
29
36
|
- [ ] some recent history (last 100?) when I start tailing
|
30
37
|
- [ ] q, qq, qqq levels
|
31
38
|
- [ ] file worker (append to /tmp/qqq)
|
32
39
|
- [ ] plugin arch for worker
|
33
40
|
- [ ] updated development documentation
|
34
41
|
- [ ] api key to follow me around (~/.qqq.conf or whatever)
|
42
|
+
- [ ] updating webapp (websockets)
|
43
|
+
- [ ] handles complex object printing
|
44
|
+
- [ ] rich data
|
45
|
+
- [ ] metaprogramming / reflection
|
46
|
+
- [ ] config panel to turn on/off 'q steams'
|
35
47
|
|
36
|
-
|
48
|
+
|
49
|
+
dev
|
50
|
+
- [ ] some sort of handshake system for handling processes
|
51
|
+
- [ ] local gem dev - de-req rake install loop
|
37
52
|
- [ ] split out configuration (yaml?) for 'service' interaction
|
38
53
|
- [ ] split the development panel / user panel
|
39
|
-
|
54
|
+
|
55
|
+
* Beyond
|
56
|
+
|
57
|
+
- move to a ruby only actor model? (https://github.com/ntl/actor)
|
58
|
+
- consider other options?
|
59
|
+
- electron app for dashboard? get away from shell stuff
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
qqq (0.1.
|
4
|
+
qqq (0.1.1)
|
5
5
|
activerecord
|
6
6
|
faraday
|
7
7
|
json
|
@@ -14,32 +14,32 @@ PATH
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
activemodel (5.2.
|
18
|
-
activesupport (= 5.2.
|
19
|
-
activerecord (5.2.
|
20
|
-
activemodel (= 5.2.
|
21
|
-
activesupport (= 5.2.
|
17
|
+
activemodel (5.2.3)
|
18
|
+
activesupport (= 5.2.3)
|
19
|
+
activerecord (5.2.3)
|
20
|
+
activemodel (= 5.2.3)
|
21
|
+
activesupport (= 5.2.3)
|
22
22
|
arel (>= 9.0)
|
23
|
-
activesupport (5.2.
|
23
|
+
activesupport (5.2.3)
|
24
24
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
25
|
i18n (>= 0.7, < 2)
|
26
26
|
minitest (~> 5.1)
|
27
27
|
tzinfo (~> 1.1)
|
28
28
|
arel (9.0.0)
|
29
|
-
concurrent-ruby (1.1.
|
29
|
+
concurrent-ruby (1.1.5)
|
30
30
|
diff-lcs (1.3)
|
31
31
|
fakeredis (0.7.0)
|
32
32
|
redis (>= 3.2, < 5.0)
|
33
|
-
faraday (0.
|
33
|
+
faraday (0.15.4)
|
34
34
|
multipart-post (>= 1.2, < 3)
|
35
|
-
i18n (1.
|
35
|
+
i18n (1.6.0)
|
36
36
|
concurrent-ruby (~> 1.0)
|
37
|
-
json (2.
|
37
|
+
json (2.2.0)
|
38
38
|
minitest (5.11.3)
|
39
|
-
multipart-post (2.
|
39
|
+
multipart-post (2.1.1)
|
40
40
|
mustermann (1.0.3)
|
41
41
|
mysql2 (0.5.0)
|
42
|
-
rack (2.0.
|
42
|
+
rack (2.0.7)
|
43
43
|
rack-protection (2.0.5)
|
44
44
|
rack
|
45
45
|
rake (10.5.0)
|
data/Rakefile
CHANGED
data/lib/qqq/api.rb
CHANGED
@@ -2,10 +2,10 @@ require 'faraday'
|
|
2
2
|
|
3
3
|
module QQQ
|
4
4
|
module API
|
5
|
-
def self.publish(
|
5
|
+
def self.publish(event)
|
6
6
|
conn = Faraday.new(:url => "http://localhost:3600")
|
7
|
-
resp = conn.post '/
|
7
|
+
resp = conn.post '/events', { :event => event.as_json }
|
8
8
|
puts resp.status, resp.body
|
9
9
|
end
|
10
10
|
end
|
11
|
-
end
|
11
|
+
end
|
data/lib/qqq/cli.rb
CHANGED
@@ -7,16 +7,15 @@ module QQQ
|
|
7
7
|
|
8
8
|
desc :tail, "Tails the qqq log"
|
9
9
|
def tail
|
10
|
-
|
11
|
-
|
12
|
-
puts msg
|
10
|
+
QQQ.subscribe do |event|
|
11
|
+
puts event.message
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
desc :payload, "For now- separate tail"
|
17
16
|
def payload
|
18
|
-
QQQ.
|
19
|
-
puts
|
17
|
+
QQQ.subscribe do |event|
|
18
|
+
puts event.to_s
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
@@ -32,12 +31,18 @@ module QQQ
|
|
32
31
|
|
33
32
|
desc :send, "Sends message to a remote server"
|
34
33
|
def send
|
35
|
-
QQQ.subscribe do |
|
36
|
-
puts "Remotely publishing: #{
|
37
|
-
API.publish(
|
34
|
+
QQQ.subscribe do |event|
|
35
|
+
puts "Remotely publishing: #{event.message}"
|
36
|
+
API.publish(event)
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
40
|
+
desc :version, "Publishes the version number"
|
41
|
+
def version
|
42
|
+
puts "QQQ Version #{QQQ::VERSION}"
|
43
|
+
QQQ.publish(QQQ::VERSION)
|
44
|
+
end
|
45
|
+
|
41
46
|
# desc :server, "Starts server to receive message"
|
42
47
|
# def server
|
43
48
|
# Sinatra....how?
|
data/lib/qqq/event.rb
CHANGED
@@ -1,10 +1,30 @@
|
|
1
1
|
module QQQ
|
2
2
|
class Event
|
3
|
+
|
4
|
+
attr_reader :uuid, :message, :recorded_at
|
5
|
+
|
6
|
+
def self.from(json_string:)
|
7
|
+
payload = JSON.parse json_string
|
8
|
+
puts payload
|
9
|
+
Event.new(uuid: payload["uuid"], message: payload["message"], recorded_at: payload["recorded_at"])
|
10
|
+
end
|
11
|
+
|
3
12
|
def initialize(uuid:, message:, recorded_at:)
|
4
13
|
@uuid = uuid
|
5
14
|
@message = message
|
6
15
|
@recorded_at = recorded_at
|
7
16
|
end
|
8
17
|
|
18
|
+
def as_json(options={})
|
19
|
+
{ uuid: @uuid,
|
20
|
+
message: @message,
|
21
|
+
recorded_at: @recorded_at,
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_json(*options)
|
26
|
+
as_json(*options).to_json(*options)
|
27
|
+
end
|
28
|
+
|
9
29
|
end
|
10
|
-
end
|
30
|
+
end
|
data/lib/qqq/keys.rb
CHANGED
data/lib/qqq/version.rb
CHANGED
data/lib/qqq.rb
CHANGED
@@ -2,6 +2,7 @@ require 'redis'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
# Lib
|
5
|
+
require 'qqq/event'
|
5
6
|
require 'qqq/api'
|
6
7
|
require 'qqq/cli'
|
7
8
|
require 'qqq/keys'
|
@@ -12,45 +13,45 @@ require 'uuidtools'
|
|
12
13
|
module QQQ
|
13
14
|
class Error < StandardError; end
|
14
15
|
|
15
|
-
# message =
|
16
|
+
# message = "hello world"
|
16
17
|
def self.qqq(message)
|
17
18
|
publish(message)
|
18
19
|
end
|
19
20
|
|
20
21
|
def self.publish(message)
|
21
|
-
|
22
|
-
|
23
|
-
uuid = UUIDTools::UUID.random_create()
|
22
|
+
uuid = UUIDTools::UUID.random_create().to_s
|
24
23
|
timestamp = Time.now
|
25
24
|
|
26
25
|
message_for_humans = "[#{uuid}] [#{timestamp}] #{message}"
|
27
|
-
|
26
|
+
redis.publish(Keys::MESSAGES_CHANNEL_KEY, message_for_humans.to_json)
|
28
27
|
|
29
|
-
|
30
|
-
|
28
|
+
event = Event.new(uuid: uuid, message: message, recorded_at: timestamp)
|
29
|
+
redis.publish(Keys::EVENT_CHANNEL_KEY, event.to_json)
|
31
30
|
end
|
32
31
|
|
33
32
|
def self.subscribe &block
|
34
|
-
|
35
|
-
@redis.subscribe Keys::MESSAGES_CHANNEL_KEY do |on|
|
33
|
+
redis.subscribe Keys::EVENT_CHANNEL_KEY do |on|
|
36
34
|
puts "Connected..."
|
37
35
|
|
38
|
-
on.message do |channel,
|
39
|
-
|
36
|
+
on.message do |channel, event_json_string|
|
37
|
+
event = Event.from(json_string: event_json_string)
|
38
|
+
block.call(event)
|
40
39
|
end
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
44
|
-
|
45
|
-
@redis = Redis.new
|
46
|
-
@redis.subscribe Keys::PAYLOAD_CHANNEL_KEY do |on|
|
47
|
-
puts "Connected..."
|
43
|
+
private
|
48
44
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
def self.redis
|
46
|
+
puts "wha hoo"
|
47
|
+
if defined?(FakeRedis) && FakeRedis.enabled?
|
48
|
+
FakeRedis.disable
|
49
|
+
@redis ||= Redis.new
|
50
|
+
FakeRedis.enable
|
51
|
+
else
|
52
|
+
@redis ||= Redis.new
|
53
53
|
end
|
54
54
|
end
|
55
|
+
|
55
56
|
end
|
56
57
|
|