pagoda 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pagoda/cli/helpers/log.rb +32 -51
- data/lib/pagoda/cli/version.rb +1 -1
- data/pagoda.gemspec +3 -3
- metadata +3 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b82fbafabb8913d4b309f98147a55e3e92429845
|
4
|
+
data.tar.gz: 0af5c92fb2d6c0e2fe0e187a4732b0daf7cabc42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c98df4a9e79fea3407038412b118bd77476d0307c25a133bf4b97b868c9ae16acbc0e10a2c6c334d3632d3109eaa4d6751c9d4e03ae43f23dad9f5abdb1aa4e
|
7
|
+
data.tar.gz: 2e7a3493cd6f28eeca0d7ad3d1be955e37a05562db3f3024cd1f4e1a0635cdd93712010da81ce2a3fdd83746763acfaf2f3af5e893cd930414ba8cb2199da78f
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
require "msgpack"
|
1
|
+
require 'websocket-client-simple'
|
2
|
+
# require "msgpack"
|
3
3
|
require 'json'
|
4
4
|
require 'pp'
|
5
|
-
require 'eventmachine'
|
6
5
|
require "base64"
|
7
6
|
|
8
7
|
module Pagoda::Command
|
@@ -28,59 +27,41 @@ module Pagoda::Command
|
|
28
27
|
|
29
28
|
app_id = client.app_info(app)[:id]
|
30
29
|
if options[:live]
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
#
|
46
|
-
puts "
|
47
|
-
puts "press 'ctrl+c to exit"
|
48
|
-
puts "----------------------------"
|
49
|
-
end
|
50
|
-
|
51
|
-
# socket.onmessage do |msg, type|
|
52
|
-
# puts "Received message: #{msg}"
|
53
|
-
# end
|
54
|
-
socket.onmessage = lambda do |event|
|
55
|
-
# p [:message, MessagePack.unpack(event.data.pack("c*"))]
|
56
|
-
data = MessagePack.unpack(event.data.pack("c*"))
|
57
|
-
if data['keypath']
|
58
|
-
colorize "[#{Time.at(data['data']['time'].to_i / 1000000) rescue Time.now}] #{(data['data']['log'].split(':').first rescue '')} : ", (data['data']['log'].split(':').first rescue 'str'), false
|
59
|
-
puts data['data']['log'].to_s.split(':')[1..-1].join(":").strip
|
60
|
-
# else
|
61
|
-
# puts data
|
62
|
-
end
|
30
|
+
STDOUT.sync = true
|
31
|
+
socket = WebSocket::Client::Simple.connect("wss://live.pagodabox.com/stormpack/websocket/pagodabox?protocol=1&client=ruby&version=1.0.0&batch=false&adapter=json&flash=false&authorization=Basic%20#{Base64.encode64("#{user}:#{password}").chop.gsub(/\=/, '%3D')}")
|
32
|
+
|
33
|
+
socket.on :open do
|
34
|
+
socket.send({"event"=>"stormpack:subscribe","data"=>{"channel"=>"app-log-#{app_id}"}}.to_json, {:type => :binary})
|
35
|
+
puts "Now tailing your live stream"
|
36
|
+
puts "press 'ctrl+c to exit"
|
37
|
+
puts "----------------------------"
|
38
|
+
end
|
39
|
+
|
40
|
+
socket.on :message do |msg|
|
41
|
+
data = JSON.parse(msg.to_s)
|
42
|
+
if (data['keypath'] rescue false)
|
43
|
+
@cla ||= Pagoda::Command::Log.new(nil, nil, nil)
|
44
|
+
@cla.colorize "[#{Time.at(data['data']['time'].to_i / 1000000) rescue Time.now}] #{(data['data']['log'].split(':').first rescue '')} : ", (data['data']['log'].split(':').first rescue 'str'), false
|
45
|
+
puts data['data']['log'].to_s.split(':')[1..-1].join(":").strip
|
63
46
|
end
|
47
|
+
end
|
64
48
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
# puts 'Server connection closed'
|
70
|
-
EM.stop
|
71
|
-
end
|
49
|
+
socket.on :close do |e|
|
50
|
+
p e
|
51
|
+
exit 1
|
52
|
+
end
|
72
53
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
54
|
+
[:INT, :TERM].each do |sig|
|
55
|
+
Signal.trap(sig) do
|
56
|
+
STDOUT.sync = false
|
57
|
+
# socket.close 1000, 'Going away'
|
58
|
+
puts "Log closing."
|
59
|
+
puts "----------------------------"
|
60
|
+
puts
|
61
|
+
exit 1
|
82
62
|
end
|
83
63
|
end
|
64
|
+
sleep
|
84
65
|
else
|
85
66
|
count = (options[:count] || 100).to_i
|
86
67
|
|
data/lib/pagoda/cli/version.rb
CHANGED
data/pagoda.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.add_dependency "pagoda-tunnel"
|
23
23
|
gem.add_dependency "rest-client"
|
24
24
|
gem.add_dependency "gli", '~> 2.0.0'
|
25
|
-
gem.add_dependency
|
26
|
-
gem.add_dependency 'msgpack'
|
27
|
-
gem.add_dependency 'eventmachine'
|
25
|
+
gem.add_dependency "websocket-client-simple"
|
26
|
+
# gem.add_dependency 'msgpack'
|
27
|
+
# gem.add_dependency 'eventmachine'
|
28
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagoda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lyon Hill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -95,35 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 2.0.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - '>='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - '>='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: msgpack
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - '>='
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: eventmachine
|
98
|
+
name: websocket-client-simple
|
127
99
|
requirement: !ruby/object:Gem::Requirement
|
128
100
|
requirements:
|
129
101
|
- - '>='
|