pagoda 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +0 -0
- data/Gemfile.lock +12 -8
- data/bin/pagoda +3 -3
- data/lib/pagoda/cli/commands/log.rb +6 -3
- data/lib/pagoda/cli/helpers/log.rb +80 -54
- data/lib/pagoda/cli/version.rb +1 -1
- data/pagoda.gemspec +3 -1
- metadata +57 -45
- data/newpagoda-0.5.0.gem +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ebf5df5a892dae6f2ab3422cd715a3e3dce31821
|
4
|
+
data.tar.gz: eb90b58aa1084ea3e5a640dbc00d4d208cdfcf00
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: afa8eb59341f072e6f998b7fe0bbfe9a7ae9f30ce6c1d42a09c73cd3bed90d16e7b0ad6fa5fc78e9fe9bf0775bcd74a3e0f2f8768d5bcf026e3050a23e590e0f
|
7
|
+
data.tar.gz: 2d58c7d5fbe50277938bc50ebd0a7ee27ccb4ad5f0acb631533cc0799cf297de6da1f577a88add8a7577de09899dd974172536fb922c140a5fd251897e3243d3
|
data/.DS_Store
CHANGED
File without changes
|
data/.gitignore
CHANGED
File without changes
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,30 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pagoda (0.
|
5
|
-
|
4
|
+
pagoda (0.7.0)
|
5
|
+
eventmachine
|
6
|
+
faye-websocket
|
7
|
+
gli (~> 2.0.0)
|
8
|
+
msgpack
|
6
9
|
pagoda-client
|
7
10
|
pagoda-tunnel
|
8
11
|
rest-client
|
9
|
-
socketio-client
|
10
12
|
|
11
13
|
GEM
|
12
14
|
remote: http://rubygems.org/
|
13
15
|
specs:
|
14
16
|
coderay (0.9.8)
|
15
17
|
diff-lcs (1.1.3)
|
18
|
+
eventmachine (1.0.3)
|
19
|
+
faye-websocket (0.4.6)
|
20
|
+
eventmachine (>= 0.12.0)
|
16
21
|
gli (2.0.0)
|
17
|
-
json_pure (1.
|
22
|
+
json_pure (1.8.0)
|
18
23
|
method_source (0.6.7)
|
19
24
|
ruby_parser (>= 2.3.1)
|
20
|
-
mime-types (1.
|
21
|
-
|
25
|
+
mime-types (1.23)
|
26
|
+
msgpack (0.5.4)
|
27
|
+
pagoda-client (0.2.2)
|
22
28
|
json_pure
|
23
29
|
rest-client
|
24
30
|
pagoda-tunnel (0.1.3)
|
@@ -42,8 +48,6 @@ GEM
|
|
42
48
|
sexp_processor (~> 3.0)
|
43
49
|
sexp_processor (3.0.7)
|
44
50
|
slop (2.1.0)
|
45
|
-
socketio-client (0.0.3)
|
46
|
-
rest-client
|
47
51
|
|
48
52
|
PLATFORMS
|
49
53
|
ruby
|
data/bin/pagoda
CHANGED
@@ -66,9 +66,9 @@ post do |global,command,options,args|
|
|
66
66
|
end
|
67
67
|
|
68
68
|
on_error do |exception|
|
69
|
-
if exception.class == RestClient::Unauthorized
|
70
|
-
|
71
|
-
|
69
|
+
# if exception.class == RestClient::Unauthorized
|
70
|
+
# Pagoda::Command::Base.error "Username or Password is invald"
|
71
|
+
if exception.class == RestClient::ResourceNotFound
|
72
72
|
Pagoda::Command::Base.error "It appears we cant find your 'resource', please try again later"
|
73
73
|
elsif exception.class == RestClient::InternalServerError
|
74
74
|
Pagoda::Command::Base.error "It appears pagodabox is having some trouble, please try again later"
|
@@ -2,9 +2,12 @@ desc 'Real time log to your pagodabox application'
|
|
2
2
|
arg_name 'Component name'
|
3
3
|
command :log do |c|
|
4
4
|
|
5
|
-
c.desc
|
6
|
-
c.
|
7
|
-
|
5
|
+
c.desc "Live stream"
|
6
|
+
c.switch [:live]
|
7
|
+
|
8
|
+
c.desc 'Number of log lines to retrieve'
|
9
|
+
c.arg_name 'COUNT'
|
10
|
+
c.flag [:c, :count]
|
8
11
|
|
9
12
|
c.desc 'App name'
|
10
13
|
c.arg_name 'APP_NAME'
|
@@ -1,11 +1,16 @@
|
|
1
|
-
require '
|
1
|
+
require 'faye/websocket'
|
2
|
+
require "msgpack"
|
3
|
+
require 'json'
|
4
|
+
require 'pp'
|
5
|
+
require 'eventmachine'
|
6
|
+
require "base64"
|
2
7
|
|
3
8
|
module Pagoda::Command
|
4
9
|
class Log < Base
|
5
10
|
|
6
11
|
COLORS = [
|
7
|
-
'light_red',
|
8
12
|
'light_green',
|
13
|
+
'light_red',
|
9
14
|
'light_yellow',
|
10
15
|
'light_blue',
|
11
16
|
'light_magenta',
|
@@ -20,76 +25,97 @@ module Pagoda::Command
|
|
20
25
|
]
|
21
26
|
|
22
27
|
def run
|
23
|
-
|
24
|
-
|
25
|
-
if
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
on_event('authenticated') do
|
45
|
-
puts "Successfully Authenticated"
|
28
|
+
|
29
|
+
app_id = client.app_info(app)[:id]
|
30
|
+
if options[:live]
|
31
|
+
EM.run do
|
32
|
+
STDOUT.sync = true
|
33
|
+
# socket = WebSocket::EventMachine::Client.connect(:uri => "wss://#{user}:#{password}@live.pagodabox.com/stormpack/websocket/pagodabox?protocol=1&client=ruby&version=1.0.0&batch=false&adapter=msgpack&flash=false")
|
34
|
+
socket = Faye::WebSocket::Client.new("wss://live.pagodabox.com/stormpack/websocket/pagodabox?protocol=1&client=ruby&version=1.0.0&batch=false&adapter=msgpack&flash=false&authorization=Basic%20#{Base64.encode64("#{user}:#{password}").chop.gsub(/\=/, '%3D')}")
|
35
|
+
|
36
|
+
# puts "Connecting to #{socket.inspect}"
|
37
|
+
|
38
|
+
# socket.onopen do
|
39
|
+
# puts "Connected"
|
40
|
+
# socket.send({"event"=>"stormpack:subscribe","data"=>{"channel"=>"app-log-#{app_id}"}}.to_msgpack, :type => :binary)
|
41
|
+
# end
|
42
|
+
socket.onopen = lambda do |event|
|
43
|
+
# puts 'connection open'
|
44
|
+
socket.send({"event"=>"stormpack:subscribe","data"=>{"channel"=>"app-log-#{app_id}"}}.to_msgpack.bytes.to_a)
|
45
|
+
# puts "listening to app: #{app}"
|
46
|
+
puts "Now tailing your live stream"
|
47
|
+
puts "press 'ctrl+c to exit"
|
48
|
+
puts "----------------------------"
|
46
49
|
end
|
47
50
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
55
62
|
end
|
56
63
|
end
|
57
64
|
|
58
|
-
|
59
|
-
|
65
|
+
# socket.onclose do
|
66
|
+
# puts "Disconnected"
|
67
|
+
# end
|
68
|
+
socket.onclose = lambda do |event|
|
69
|
+
# puts 'Server connection closed'
|
70
|
+
EM.stop
|
60
71
|
end
|
61
72
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
73
|
+
[:INT, :TERM].each do |sig|
|
74
|
+
Signal.trap(sig) do
|
75
|
+
STDOUT.sync = false
|
76
|
+
# socket.close 1000, 'Going away'
|
77
|
+
puts "Log closing."
|
78
|
+
puts "----------------------------"
|
79
|
+
puts
|
80
|
+
socket.close
|
81
|
+
end
|
67
82
|
end
|
68
|
-
|
69
83
|
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
puts "
|
77
|
-
puts "
|
78
|
-
puts
|
79
|
-
|
84
|
+
else
|
85
|
+
count = (options[:count] || 100).to_i
|
86
|
+
|
87
|
+
log = []
|
88
|
+
last_time_stamp = Time.now.to_i * 100_000_000
|
89
|
+
while log.length < count
|
90
|
+
# puts "****"
|
91
|
+
# puts "#{app}?start=#{last_time_stamp + 1}&stop=#{Time.now.to_i * 1000000}"
|
92
|
+
# puts "****"
|
93
|
+
|
94
|
+
r = JSON.parse(RestClient.get("https://#{user}:#{password}@logvac.pagodabox.com/logs/apps/#{app_id}?limit=#{count - log.length}&start=#{last_time_stamp - 1}&stop=#{0}"))
|
95
|
+
if r == []
|
96
|
+
break
|
97
|
+
else
|
98
|
+
last_time_stamp = r.last['time']
|
99
|
+
log = log + r
|
100
|
+
end
|
101
|
+
print " loading... (#{log.length} of #{count}) \r"
|
102
|
+
end
|
103
|
+
puts
|
104
|
+
log.reverse.each do |line|
|
105
|
+
colorize("[#{Time.at(line['time'].to_i / 1000000)}] #{line['log'].split(':').first} : ", line['log'].split(':').first, false)
|
106
|
+
puts line['log'].split(':')[1..-1].join(":").strip
|
80
107
|
end
|
81
108
|
end
|
82
109
|
|
83
|
-
loop { sleep 1000 }
|
84
110
|
|
85
111
|
end
|
86
112
|
|
87
|
-
def colorize message, name
|
113
|
+
def colorize message, name, newline = true
|
88
114
|
@hash ||= {}
|
89
115
|
if color = @hash[name]
|
90
|
-
puts message.send(color)
|
116
|
+
newline ? (puts message.send(color)) : (print message.send(color))
|
91
117
|
else
|
92
|
-
puts message.send(@hash[name] = next_color)
|
118
|
+
newline ? (puts message.send(@hash[name] = next_color)) : (print message.send(@hash[name] = next_color))
|
93
119
|
# retry
|
94
120
|
end
|
95
121
|
end
|
data/lib/pagoda/cli/version.rb
CHANGED
data/pagoda.gemspec
CHANGED
@@ -18,9 +18,11 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_development_dependency "rspec"
|
19
19
|
gem.add_development_dependency "pry"
|
20
20
|
|
21
|
-
gem.add_dependency 'socketio-client'
|
22
21
|
gem.add_dependency "pagoda-client"
|
23
22
|
gem.add_dependency "pagoda-tunnel"
|
24
23
|
gem.add_dependency "rest-client"
|
25
24
|
gem.add_dependency "gli", '~> 2.0.0'
|
25
|
+
gem.add_dependency 'faye-websocket'
|
26
|
+
gem.add_dependency 'msgpack'
|
27
|
+
gem.add_dependency 'eventmachine'
|
26
28
|
end
|
metadata
CHANGED
@@ -1,128 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagoda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.7.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Lyon Hill
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: pry
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: pagoda-client
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
name: pagoda-
|
56
|
+
name: pagoda-tunnel
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
70
|
+
name: rest-client
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
84
|
+
name: gli
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.0.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: faye-websocket
|
96
99
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
100
|
requirements:
|
99
|
-
- -
|
101
|
+
- - '>='
|
100
102
|
- !ruby/object:Gem::Version
|
101
103
|
version: '0'
|
102
104
|
type: :runtime
|
103
105
|
prerelease: false
|
104
106
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
107
|
requirements:
|
107
|
-
- -
|
108
|
+
- - '>='
|
108
109
|
- !ruby/object:Gem::Version
|
109
110
|
version: '0'
|
110
111
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
112
|
+
name: msgpack
|
112
113
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: '0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
121
|
requirements:
|
123
|
-
- -
|
122
|
+
- - '>='
|
124
123
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: eventmachine
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
126
139
|
description: Pagoda Box User facing interface to improve workflow with Pagoda Box
|
127
140
|
email:
|
128
141
|
- lyon@pagodabox.com
|
@@ -162,7 +175,6 @@ files:
|
|
162
175
|
- lib/pagoda/cli/helpers/tunnel.rb
|
163
176
|
- lib/pagoda/cli/override.rb
|
164
177
|
- lib/pagoda/cli/version.rb
|
165
|
-
- newpagoda-0.5.0.gem
|
166
178
|
- pagoda.gemspec
|
167
179
|
- pagoda.rdoc
|
168
180
|
- spec/lib/helper_spec.rb
|
@@ -173,27 +185,26 @@ files:
|
|
173
185
|
- spec/spec_helper.rb
|
174
186
|
homepage: http://www.pagodabox.com
|
175
187
|
licenses: []
|
188
|
+
metadata: {}
|
176
189
|
post_install_message:
|
177
190
|
rdoc_options: []
|
178
191
|
require_paths:
|
179
192
|
- lib
|
180
193
|
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
-
none: false
|
182
194
|
requirements:
|
183
|
-
- -
|
195
|
+
- - '>='
|
184
196
|
- !ruby/object:Gem::Version
|
185
197
|
version: '0'
|
186
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
|
-
none: false
|
188
199
|
requirements:
|
189
|
-
- -
|
200
|
+
- - '>='
|
190
201
|
- !ruby/object:Gem::Version
|
191
202
|
version: '0'
|
192
203
|
requirements: []
|
193
204
|
rubyforge_project:
|
194
|
-
rubygems_version:
|
205
|
+
rubygems_version: 2.0.0
|
195
206
|
signing_key:
|
196
|
-
specification_version:
|
207
|
+
specification_version: 4
|
197
208
|
summary: Pagoda Box CLI
|
198
209
|
test_files:
|
199
210
|
- spec/lib/helper_spec.rb
|
@@ -202,3 +213,4 @@ test_files:
|
|
202
213
|
- spec/lib/helpers/key_spec.rb
|
203
214
|
- spec/lib/helpers/tunnel_spec.rb
|
204
215
|
- spec/spec_helper.rb
|
216
|
+
has_rdoc:
|
data/newpagoda-0.5.0.gem
DELETED
Binary file
|