qqq 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 221dbef300b4bf5d3f57a4be9fc0ef9584358981e914c17857d110ec42e20a09
4
- data.tar.gz: bac7bd7c093ce99079eb74d3ad71cf598e8a3d80c37cff9bf089f5ac7e0398f4
3
+ metadata.gz: 901963455ef035a7b1055749513102b79fa568304c668038a585dcff606f73b8
4
+ data.tar.gz: 7de4aa5267b50b0d62b8815237ad61e36111d0859a0f7379f5d83388dc03ebf8
5
5
  SHA512:
6
- metadata.gz: d57613b3bec97a6e8871006fa16874cf59ed71baac77c79eb0d57e201cb16f0ee724c1950d4208175b696d2a3e8901f36f342257b2d24e1da73816574a7a37e6
7
- data.tar.gz: e43afd5dfe602d67b16e76e8d2925717c73611877aed0e336a16befe966d3c5b6a91f704ee7b48ea3e20a6f663df4d412d6b8762198d973cd1b622dc52575c6c
6
+ metadata.gz: f3739b7a3fcbc083cf1017e64c5fc0182e120afb6b6e9736c69bfd6f175497ecbb8a79971e749e689622367f3b77df12802ad088f22f259403ba2da6fea4cfc2
7
+ data.tar.gz: 471fc79d97ac7583978b2582eaa4bb77366e58e9cd445abf750069f399ec308e7232a175f1aaeac8e482262f1efb949dc945797213906abcae847fc10d8e488b
data/CHANGELOG.org CHANGED
@@ -1,39 +1,59 @@
1
- * Milestone I
1
+
2
+ * Version 0.1.0 - Milestone I
2
3
 
3
4
  "Better than puts"
4
5
 
5
6
  features
6
- - [ ] object inspection
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
- - [ ] local gem dev - de-req rake install loop
24
- - [ ] some sort of handshake system for handling processes
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
- dev
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
- - [ ] config panel to turn on/off 'q steams'
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.0)
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.2)
18
- activesupport (= 5.2.2)
19
- activerecord (5.2.2)
20
- activemodel (= 5.2.2)
21
- activesupport (= 5.2.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.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.4)
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.9.2)
33
+ faraday (0.15.4)
34
34
  multipart-post (>= 1.2, < 3)
35
- i18n (1.5.2)
35
+ i18n (1.6.0)
36
36
  concurrent-ruby (~> 1.0)
37
- json (2.1.0)
37
+ json (2.2.0)
38
38
  minitest (5.11.3)
39
- multipart-post (2.0.0)
39
+ multipart-post (2.1.1)
40
40
  mustermann (1.0.3)
41
41
  mysql2 (0.5.0)
42
- rack (2.0.6)
42
+ rack (2.0.7)
43
43
  rack-protection (2.0.5)
44
44
  rack
45
45
  rake (10.5.0)
data/Rakefile CHANGED
@@ -3,10 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :critical
7
-
8
- desc "Critical path suite"
9
- task :critical do
10
- `sh spec/e2e.sh`
11
- end
12
-
6
+ task :default => :spec
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(msg)
5
+ def self.publish(event)
6
6
  conn = Faraday.new(:url => "http://localhost:3600")
7
- resp = conn.post '/messages', { :message => { message: msg } }
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
- puts "hi"
11
- QQQ.subscribe do |msg|
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.subscribe_payload do |payload|
19
- puts payload.to_s
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 |msg|
36
- puts "Remotely publishing: #{msg}"
37
- API.publish(msg)
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
@@ -1,6 +1,6 @@
1
1
  module QQQ
2
2
  module Keys
3
3
  MESSAGES_CHANNEL_KEY = "qqq::messages_channel"
4
- PAYLOAD_CHANNEL_KEY = "qqq::payload_channel"
4
+ EVENT_CHANNEL_KEY = "qqq::payload_channel"
5
5
  end
6
6
  end
data/lib/qqq/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module QQQ
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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 = 'hi'
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
- @redis = Redis.new
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
- @redis.publish(Keys::MESSAGES_CHANNEL_KEY, message_for_humans.to_json)
26
+ redis.publish(Keys::MESSAGES_CHANNEL_KEY, message_for_humans.to_json)
28
27
 
29
- payload = {message: message, uuid: uuid, recorded_at: timestamp}
30
- @redis.publish(Keys::PAYLOAD_CHANNEL_KEY, payload.to_json)
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
- @redis = Redis.new
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, msg|
39
- block.call(msg)
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
- def self.subscribe_payload &block
45
- @redis = Redis.new
46
- @redis.subscribe Keys::PAYLOAD_CHANNEL_KEY do |on|
47
- puts "Connected..."
43
+ private
48
44
 
49
- on.message do |channel, payload_json_string|
50
- payload = JSON.parse payload_json_string
51
- block.call(payload)
52
- end
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qqq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Skulski