zillabyte-cli 0.1.20 → 0.1.21

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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZWRmMzQwZmQ1ZWZkN2I5YmYyMDlmYTg0YmI5MDNjZmU1N2YxMjBiZA==
5
- data.tar.gz: !binary |-
6
- NWViMWY3ZWU3NTIyZGFlYzBkNWNlOTcxNDlhYWYxZDMwYjk3NWM2Ng==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NTEzNWQ3NzVkMDE5ZjM5MmU0YmQ2YjU4ZmRhY2JiMDM0ZDc2OTBkYThlNzU3
10
- MTkyYjNlNDkwYmZlNDRiOGE4N2IyNWJkNzZkYzYyYmVlNTRlZjgwYTJjODNm
11
- ZDg1NWNjMWJhOTg1MjFhMzA0ODZkZTIzNzk5N2RhNzBiMzczYzY=
12
- data.tar.gz: !binary |-
13
- YzJjOTg5MjZkMDRjMmFhODcxNjYzYzYwYjM3YmI4Njc3YTIzMjQwYjY2MTM1
14
- NzY3YjkyZTgxYzA0ZWM5M2I1MzlmYjIwNjY1OTNhODJhYWI1MjkwYzgzNTY1
15
- YzczNGU0OTljMzc0ZTU5YzE3MmNmZTliMjhlM2RiZWExNmZhMTc=
2
+ SHA1:
3
+ metadata.gz: 11fa3e9bf4153e02116008ae0f04067004f00f47
4
+ data.tar.gz: 5b0a30dbddda2dfd3f03e5309f91802bad78cae1
5
+ SHA512:
6
+ metadata.gz: 163b0f3e39bcdd1f4565f39c16e658d18beef3a75127b1ea158f720a22b63773db514ccd6aaf6f1a1cdc490278a07eaca4e72dabe648cb09e47e0f4955fcfbd0
7
+ data.tar.gz: 9d3a5f6de29ec004f5f0accbd1806e836eac2e4218694dd72fd69d4c2e9e9bf506283da2b26c3773612eee838fd7cf6330e915f4bba59ae644d53fbe790bc3f1
@@ -0,0 +1,5 @@
1
+ require "zillabyte-cli/version"
2
+ require "zillabyte/api"
3
+ require "zillabyte/cli"
4
+ require "zillabyte/common"
5
+ require "zillabyte/queries"
@@ -0,0 +1,12 @@
1
+ require "zillabyte/cli/base"
2
+
3
+ # manage custom logs
4
+ #
5
+ class Zillabyte::Command::Logs < Zillabyte::Command::Base
6
+
7
+
8
+
9
+
10
+
11
+
12
+ end
@@ -0,0 +1,43 @@
1
+ require "zillabyte/cli/base"
2
+ require 'readline'
3
+ # REPL console for zillabyte commands
4
+ #
5
+ class Zillabyte::Command::Repl < Zillabyte::Command::Base
6
+
7
+ # repl
8
+ #
9
+ # start a console session for zillabyte
10
+ # --quiet # HIDDEN
11
+ # --history HISTORY# HIDDEN hack to allow history for readline
12
+ def index
13
+ if !options[:quiet]
14
+ v = `zillabyte version`
15
+ display "\n#{v}Type q,exit or Ctrl+D to quit\n\n"
16
+ end
17
+ server = `echo $ZILLABYTE_API_HOST` || ""
18
+ prompt = ""
19
+ if server && server.chomp.length > 0
20
+ prompt = "#{server.chomp} "
21
+ end
22
+ prompt += "zillabyte $ "
23
+ if options[:history]
24
+ #p options[:history]
25
+ history = JSON.parse(options[:history])
26
+ history.last(50).each do |his|
27
+ # TODO: Handle single quotes ??
28
+ Readline::HISTORY << his
29
+ end
30
+ end
31
+ # TODO: Add tab completion for basic commands, app/relation names etc.
32
+ while cmd = Readline.readline(prompt, true)
33
+ if cmd && cmd.length > 0
34
+ if cmd.downcase == "exit" || cmd.downcase == "q"
35
+ display "" # TODO Make Ctrl+D print a newline too
36
+ return
37
+ else
38
+ exec "zillabyte #{cmd}; zillabyte repl --quiet --history '#{Readline::HISTORY.to_a.to_json}'"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -205,7 +205,7 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Flows
205
205
  sleep(2) # wait for kill command
206
206
 
207
207
  hash = self.api.logs.get(res['id'], nil, options)
208
- fetch_logs(hash, "_ALL_", "App deployed")
208
+ fetch_logs(hash, "_ALL_", ["App deployed", "STOP_LOGGING"])
209
209
 
210
210
  display "{}" if type == "json"
211
211
 
@@ -279,7 +279,7 @@ class Zillabyte::Command::Components < Zillabyte::Command::Flows
279
279
 
280
280
  sleep 2
281
281
  hash = self.api.logs.get(comp_id, nil, options)
282
- fetch_logs(hash, "_ALL_", "Component registered")
282
+ fetch_logs(hash, "_ALL_", ["Component registered", "STOP_LOGGING"])
283
283
 
284
284
  display "{}" if type == "json"
285
285
 
@@ -384,7 +384,7 @@ class Zillabyte::Command::Data < Zillabyte::Command::Base
384
384
  end
385
385
 
386
386
  # We only reach here after polling is complete...
387
- if res["rows"].size > 0
387
+ if res["rows"] && res["rows"].size > 0
388
388
  headings = []
389
389
  concrete_headings = res["rows"].first.keys
390
390
  concrete_headings.delete("id")
@@ -607,6 +607,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
607
607
  @color_map[operation_name]
608
608
  end
609
609
  ip = hash["server"] || ENV["ZILLABYTE_API_HOST"] #Quick fix for logs on zilla machines
610
+ exit_on = [exit_on] unless exit_on.is_a?(Array)
610
611
 
611
612
  @color_map = {}
612
613
  @all_colors = [:green, :yellow, :magenta, :cyan, :light_black, :light_green, :light_yellow, :light_blue, :light_magenta, :light_cyan]
@@ -621,11 +622,20 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
621
622
  r.each do |line|
622
623
  begin
623
624
  op = line.match(/\[(.*?)\]/)[0].to_s[1...-1]
625
+
624
626
  op_name = op.split(".")[0]
625
627
  next if op_name != operation and operation != "_ALL_"
626
628
  line_split = line.split("[")
627
- print line_split[0] + "[" + op.colorize(color_for(op)) + line_split[1..-1].join("[")[op.length..-1]
628
- break if exit_on and line.include? exit_on
629
+ print line_split[0] + "[" + op.colorize(color_for(op)) + line_split[1..-1].join("[")[op.length..-1] unless line.include?("[HIDDEN]")
630
+
631
+ done = false
632
+ exit_on.each do |exit_str|
633
+ if line.include? exit_str
634
+ done = true
635
+ break
636
+ end
637
+ end
638
+ break if done
629
639
  rescue Exception => e
630
640
  next
631
641
  end
@@ -187,7 +187,7 @@ class Zillabyte::Command::Query < Zillabyte::Command::Base
187
187
 
188
188
  headings = []
189
189
  filtered = []
190
- if res['rows'].first
190
+ if res['rows'] && res['rows'].first
191
191
  concrete_headings = res['rows'].first.keys
192
192
  META_COLUMNS.each {|c| concrete_headings.delete c} if (!show_meta)
193
193
  concrete_headings.each do |ch|
@@ -0,0 +1,27 @@
1
+ import zillabyte
2
+
3
+ def prep(controller):
4
+ return
5
+
6
+ # This is the heart of your algorithm. It's processed on every
7
+ # web page. This algorithm is run in parallel on possibly hundreds
8
+ # of machines.
9
+ def execute(controller, tup):
10
+ if("hello world" in tup.values["html"]):
11
+ controller.emit("has_hello_world",{"url":tup.values["url"]})
12
+ return
13
+
14
+ zillabyte.simple_function(\
15
+ # This directive instructs zillabyte to give your function every
16
+ # web page in our known universe. Your function will have access
17
+ # to two fields: URL and HTML
18
+ matches = "select * from web_pa", \
19
+
20
+ # This directive tells Zillabyte what kind of data your function
21
+ # produces. In this case, we're saying we will emit a tuple that
22
+ # is one-column wide and contains the field 'URL'
23
+ emits = [["has_hello_world", [{"url":"string"}]]], \
24
+
25
+ prepare = prep, \
26
+ execute = execute\
27
+ )
File without changes
@@ -154,6 +154,15 @@ module Zillabyte
154
154
  return nil
155
155
  end
156
156
 
157
+
158
+ # Format a message for display
159
+ def truncate_message(msg, t_length = 50)
160
+ return msg if(!msg.instance_of?(String))
161
+ m_length = msg.length
162
+ msg_out = m_length > t_length ? msg[0..t_length-3]+"..." : msg
163
+ msg_out
164
+ end
165
+
157
166
 
158
167
  def handle_downloading_manifest(file, res, type = nil)
159
168
  require("open-uri")
@@ -451,16 +451,6 @@ class Zillabyte::Runner::ComponentOperation
451
451
  write_stream.flush
452
452
  end
453
453
 
454
- # Format a message for display
455
- def self.truncate_message(msg)
456
- return msg if(!msg.instance_of?(String))
457
- t_length = 50 # truncates entries to this length
458
- m_length = msg.length
459
- msg_out = m_length > t_length ? msg[0..t_length-3]+"..." : msg
460
- msg_out
461
- end
462
-
463
-
464
454
  # Handshake connection to multilang
465
455
  def self.handshake(write_stream, read_stream)
466
456
  begin
@@ -1354,14 +1354,6 @@ module Zillabyte; module Runner; class MultilangOperation
1354
1354
  write_stream.flush
1355
1355
  end
1356
1356
 
1357
- # Format a message for display
1358
- def self.truncate_message(msg)
1359
- return msg if(!msg.instance_of?(String))
1360
- t_length = 50 # truncates entries to this length
1361
- m_length = msg.length
1362
- msg_out = m_length > t_length ? msg[0..t_length-3]+"..." : msg
1363
- msg_out
1364
- end
1365
1357
 
1366
1358
 
1367
1359
  # Handshake connection to multilang
@@ -1,5 +1,5 @@
1
1
  module Zillabyte
2
2
  module CLI
3
- VERSION = "0.1.20"
3
+ VERSION = "0.1.21"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,167 +1,167 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zillabyte-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - zillabyte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2014-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: netrc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.7.7
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.7.7
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rest-client
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.6.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.6.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: excon
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.31'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.31'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: terminal-table
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.4'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: activesupport
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 3.2.11
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 3.2.11
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: multi_json
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '1.0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: bundler
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.3'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '1.3'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: colorize
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0.6'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.6'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: indentation
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0.1'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.1'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: mkfifo
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ! '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ! '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  description: The Official Zillabyte CLI Gem
@@ -173,9 +173,16 @@ executables:
173
173
  extensions: []
174
174
  extra_rdoc_files: []
175
175
  files:
176
+ - Gemfile
177
+ - LICENSE
178
+ - README.md
176
179
  - bin/zb
177
180
  - bin/zbd
178
181
  - bin/zillabyte
182
+ - lib/#zillabyte-cli.rb#
183
+ - lib/zillabyte-cli.rb
184
+ - lib/zillabyte-cli/version.rb
185
+ - lib/zillabyte/api.rb
179
186
  - lib/zillabyte/api/apps.rb
180
187
  - lib/zillabyte/api/base.rb
181
188
  - lib/zillabyte/api/components.rb
@@ -189,8 +196,10 @@ files:
189
196
  - lib/zillabyte/api/settings.rb
190
197
  - lib/zillabyte/api/sources.rb
191
198
  - lib/zillabyte/api/zillalogs.rb
192
- - lib/zillabyte/api.rb
193
199
  - lib/zillabyte/auth.rb
200
+ - lib/zillabyte/cli.rb
201
+ - lib/zillabyte/cli/#logs.rb#
202
+ - lib/zillabyte/cli/#repl.rb#
194
203
  - lib/zillabyte/cli/apps.rb
195
204
  - lib/zillabyte/cli/auth.rb
196
205
  - lib/zillabyte/cli/base.rb
@@ -205,7 +214,6 @@ files:
205
214
  - lib/zillabyte/cli/helpers/table_output_builder.rb
206
215
  - lib/zillabyte/cli/host.rb
207
216
  - lib/zillabyte/cli/keys.rb
208
- - lib/zillabyte/cli/log_formatter.rb
209
217
  - lib/zillabyte/cli/nuke.rb
210
218
  - lib/zillabyte/cli/query.rb
211
219
  - lib/zillabyte/cli/repl.rb
@@ -216,67 +224,68 @@ files:
216
224
  - lib/zillabyte/cli/templates/apps/python/app.py
217
225
  - lib/zillabyte/cli/templates/apps/python/requirements.txt
218
226
  - lib/zillabyte/cli/templates/apps/python/zillabyte.conf.yaml
219
- - lib/zillabyte/cli/templates/apps/ruby/app.rb.erb
220
227
  - lib/zillabyte/cli/templates/apps/ruby/Gemfile
221
228
  - lib/zillabyte/cli/templates/apps/ruby/README.md
229
+ - lib/zillabyte/cli/templates/apps/ruby/app.rb.erb
222
230
  - lib/zillabyte/cli/templates/apps/ruby/zillabyte.conf.yaml
223
231
  - lib/zillabyte/cli/templates/components/js/simple_function.js
224
232
  - lib/zillabyte/cli/templates/components/js/zillabyte.conf.yaml
225
233
  - lib/zillabyte/cli/templates/components/python/component.py
226
234
  - lib/zillabyte/cli/templates/components/python/requirements.txt
227
235
  - lib/zillabyte/cli/templates/components/python/zillabyte.conf.yaml
228
- - lib/zillabyte/cli/templates/components/ruby/component.rb.erb
229
236
  - lib/zillabyte/cli/templates/components/ruby/Gemfile
237
+ - lib/zillabyte/cli/templates/components/ruby/component.rb.erb
230
238
  - lib/zillabyte/cli/templates/components/ruby/zillabyte.conf.yaml
231
- - lib/zillabyte/cli/templates/ruby/Gemfile.lock
239
+ - lib/zillabyte/cli/templates/python/#simple_function.py#
240
+ - lib/zillabyte/cli/untitled.md
232
241
  - lib/zillabyte/cli/version.rb
233
242
  - lib/zillabyte/cli/zillalogs.rb
234
- - lib/zillabyte/cli.rb
235
243
  - lib/zillabyte/command.rb
244
+ - lib/zillabyte/common.rb
236
245
  - lib/zillabyte/common/session.rb
237
246
  - lib/zillabyte/common/tar.rb
238
- - lib/zillabyte/common.rb
239
247
  - lib/zillabyte/helpers.rb
240
248
  - lib/zillabyte/queries.rb
249
+ - lib/zillabyte/runner.rb
241
250
  - lib/zillabyte/runner/app_runner.rb
242
251
  - lib/zillabyte/runner/component_operation.rb
243
252
  - lib/zillabyte/runner/component_runner.rb
244
253
  - lib/zillabyte/runner/multilang_operation.rb
245
254
  - lib/zillabyte/runner/operation.rb
246
- - lib/zillabyte/runner.rb
247
- - lib/zillabyte-cli/version.rb
248
- - lib/zillabyte-cli.rb
249
- - LICENSE
250
- - README.md
255
+ - zillabyte-cli.gemspec
251
256
  - zillabyte_emails.csv
252
257
  - zillaconf.json
253
- - Gemfile
254
- - zillabyte-cli.gemspec
255
258
  homepage: http://www.zillabyte.com
256
259
  licenses:
257
260
  - MIT
258
261
  metadata: {}
259
- post_install_message: ! "\nGetting Started with Zillabyte\n==============================\n\n(1)
260
- Register for an auth token at http://zillabyte.com\n(2) Log in by running 'zillabyte
261
- login' in the command line\n(3) Build an empty app by running 'zillabyte apps:init'\n
262
- \ Or... check out our Quick Starts by visiting http://docs.zillabyte.com/\n\nQuestions,
263
- comments? Please visit us at http://docs.zillabyte.com\n"
262
+ post_install_message: |2
263
+
264
+ Getting Started with Zillabyte
265
+ ==============================
266
+
267
+ (1) Register for an auth token at http://zillabyte.com
268
+ (2) Log in by running 'zillabyte login' in the command line
269
+ (3) Build an empty app by running 'zillabyte apps:init'
270
+ Or... check out our Quick Starts by visiting http://docs.zillabyte.com/
271
+
272
+ Questions, comments? Please visit us at http://docs.zillabyte.com
264
273
  rdoc_options: []
265
274
  require_paths:
266
275
  - lib
267
276
  required_ruby_version: !ruby/object:Gem::Requirement
268
277
  requirements:
269
- - - ! '>='
278
+ - - ">="
270
279
  - !ruby/object:Gem::Version
271
280
  version: '0'
272
281
  required_rubygems_version: !ruby/object:Gem::Requirement
273
282
  requirements:
274
- - - ! '>='
283
+ - - ">="
275
284
  - !ruby/object:Gem::Version
276
285
  version: '0'
277
286
  requirements: []
278
287
  rubyforge_project:
279
- rubygems_version: 2.0.6
288
+ rubygems_version: 2.2.2
280
289
  signing_key:
281
290
  specification_version: 4
282
291
  summary: The Official Zillabyte CLI Gem
@@ -1,106 +0,0 @@
1
- class LogFormatter
2
-
3
- ########################################################
4
- ## Base / Generic ######################################
5
- ########################################################
6
- COLORS = [:green, :yellow, :magenta, :cyan, :light_black, :light_green, :light_yellow, :light_blue, :light_magenta, :light_cyan]
7
-
8
- class Base
9
-
10
- def initialize
11
- @all_colors ||= COLORS.clone
12
- @color_map = {
13
- 'app' => :white
14
- }
15
- end
16
-
17
- def print_log_line(hash)
18
-
19
- # Dno't show heartbeats
20
- return if hash['heartbeat']
21
-
22
- # Init
23
- line = hash['line']
24
- category = hash['category']
25
- date = hash['date']
26
- name = hash['name']
27
- index = hash['index']
28
-
29
- # Don't display 'hidden' lines
30
- if category == 'hidden'
31
-
32
- handle_hidden(name, index, category, date, line);
33
-
34
- else
35
-
36
- # Print it out
37
- display(name, index, category, date, line)
38
-
39
- end
40
-
41
-
42
- end
43
-
44
-
45
- protected
46
-
47
- def handle_hidden(operation_name, operation_index, category, date, line)
48
- end
49
-
50
- def display(operation_name, operation_index, category, date, line)
51
- require("colorize")
52
- puts "#{get_name(operation_name, operation_index).rjust(9).colorize(color_for(operation_name))} - #{line}"
53
- end
54
-
55
-
56
- def get_name(operation_name, operation_index)
57
- if operation_index and operation_index != ""
58
- return "#{operation_name}.#{operation_index}"
59
- else
60
- return operation_name
61
- end
62
- end
63
-
64
- def color_for(operation_name)
65
- @color_map[operation_name] ||= @all_colors[ @color_map.size % @all_colors.size ]
66
- @color_map[operation_name]
67
- end
68
-
69
- end
70
-
71
-
72
- ########################################################
73
- ## Startup #############################################
74
- ########################################################
75
-
76
- class Startup < Base
77
-
78
- def display(operation_name, operation_index, category, date, line)
79
- require("colorize")
80
- puts "#{get_name(operation_name, operation_index).rjust(15).colorize(color_for(operation_name))} : #{line}"
81
- end
82
-
83
- def handle_hidden(operation_name, operation_index, category, date, line)
84
- case line
85
- when 'REGISTER_FLOW_DEPLOYED', 'REGISTER_FLOW_TIMEOUT', 'STARTUP_ABORT'
86
- # done reading the logs
87
- exit(0)
88
- end
89
- end
90
-
91
- end
92
-
93
-
94
- ########################################################
95
- ## Operation Colorized #################################
96
- ########################################################
97
-
98
- class Operation < Base
99
- # TODO: color'ify each operation
100
- end
101
-
102
-
103
-
104
- end
105
-
106
-
@@ -1,81 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- actionpack (3.2.17)
5
- activemodel (= 3.2.17)
6
- activesupport (= 3.2.17)
7
- builder (~> 3.0.0)
8
- erubis (~> 2.7.0)
9
- journey (~> 1.0.4)
10
- rack (~> 1.4.5)
11
- rack-cache (~> 1.2)
12
- rack-test (~> 0.6.1)
13
- sprockets (~> 2.2.1)
14
- activemodel (3.2.17)
15
- activesupport (= 3.2.17)
16
- builder (~> 3.0.0)
17
- activesupport (3.2.17)
18
- i18n (~> 0.6, >= 0.6.4)
19
- multi_json (~> 1.0)
20
- ascii_charts (0.9.1)
21
- aws-sdk (1.33.0)
22
- json (~> 1.4)
23
- nokogiri (>= 1.4.4)
24
- uuidtools (~> 2.1)
25
- builder (3.0.4)
26
- chronic (0.10.2)
27
- colorize (0.7.2)
28
- erubis (2.7.0)
29
- excon (0.33.0)
30
- hike (1.2.3)
31
- i18n (0.6.9)
32
- indentation (0.1.1)
33
- journey (1.0.4)
34
- json (1.8.1)
35
- mime-types (2.2)
36
- mini_portile (0.5.3)
37
- multi_json (1.9.2)
38
- netrc (0.7.7)
39
- nokogiri (1.6.1)
40
- mini_portile (~> 0.5.0)
41
- rack (1.4.5)
42
- rack-cache (1.2)
43
- rack (>= 0.4)
44
- rack-test (0.6.2)
45
- rack (>= 1.0)
46
- rest-client (1.6.7)
47
- mime-types (>= 1.16)
48
- sprockets (2.2.2)
49
- hike (~> 1.2)
50
- multi_json (~> 1.0)
51
- rack (~> 1.0)
52
- tilt (~> 1.1, != 1.3.0)
53
- terminal-table (1.4.5)
54
- tilt (1.4.1)
55
- time_difference (0.3.2)
56
- activesupport
57
- uuidtools (2.1.4)
58
- zillabyte (0.0.20)
59
- zillabyte-cli (~> 0.0.20)
60
- zillabyte-cli (0.0.20)
61
- actionpack (~> 3.2.13)
62
- activesupport (~> 3.2.11)
63
- ascii_charts (~> 0.9.1)
64
- aws-sdk (~> 1.33.0)
65
- bundler (~> 1.3)
66
- chronic (~> 0.10)
67
- colorize (~> 0.6)
68
- excon (~> 0.31)
69
- indentation (~> 0.1)
70
- mini_portile (~> 0.5.0)
71
- multi_json (~> 1.0)
72
- netrc (~> 0.7.7)
73
- rest-client (~> 1.6.1)
74
- terminal-table (~> 1.4)
75
- time_difference
76
-
77
- PLATFORMS
78
- ruby
79
-
80
- DEPENDENCIES
81
- zillabyte