zillabyte-cli 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- data/lib/zillabyte/api/flows.rb +3 -1
- data/lib/zillabyte/cli/apps.rb +70 -71
- data/lib/zillabyte/cli/auth.rb +2 -4
- data/lib/zillabyte/cli/base.rb +2 -0
- data/lib/zillabyte/cli/components.rb +135 -47
- data/lib/zillabyte/cli/{relations.rb → data.rb} +70 -98
- data/lib/zillabyte/cli/flows.rb +50 -50
- data/lib/zillabyte/cli/git.rb +6 -7
- data/lib/zillabyte/cli/help.rb +3 -5
- data/lib/zillabyte/cli/keys.rb +18 -15
- data/lib/zillabyte/cli/nuke.rb +4 -6
- data/lib/zillabyte/cli/query.rb +26 -50
- data/lib/zillabyte/cli/repl.rb +6 -4
- data/lib/zillabyte/cli/templates/apps/ruby/README.md +123 -0
- data/lib/zillabyte/cli/templates/apps/ruby/zillabyte.conf.yaml +3 -0
- data/lib/zillabyte/cli/templates/ruby/Gemfile.lock +81 -0
- data/lib/zillabyte/helpers.rb +22 -0
- data/lib/zillabyte-cli/version.rb +1 -1
- data/zillabyte-cli.gemspec +0 -1
- metadata +50 -66
- data/lib/#zillabyte-cli.rb# +0 -5
- data/lib/zillabyte/cli/#logs.rb# +0 -12
- data/lib/zillabyte/cli/#repl.rb# +0 -43
- data/lib/zillabyte/cli/templates/python/#simple_function.py# +0 -27
@@ -2,34 +2,35 @@ require "zillabyte/cli/base"
|
|
2
2
|
require "zillabyte/cli/helpers/table_output_builder"
|
3
3
|
require "csv"
|
4
4
|
require "open-uri"
|
5
|
-
require "aws-sdk"
|
6
5
|
require "json"
|
7
6
|
require "base64"
|
8
7
|
|
9
8
|
|
10
|
-
# manage custom
|
9
|
+
# manage custom datasets
|
11
10
|
#
|
12
|
-
class Zillabyte::Command::
|
11
|
+
class Zillabyte::Command::Data < Zillabyte::Command::Base
|
13
12
|
|
14
13
|
MAX_POLL_SECONDS = 60 * 5
|
15
14
|
POLL_SLEEP = 1
|
16
15
|
APPENDS_ROWS_SLICE = 5_000;
|
17
16
|
|
18
|
-
#
|
17
|
+
# data
|
19
18
|
#
|
20
|
-
#
|
21
|
-
#
|
19
|
+
# Lists your custom datasets.
|
20
|
+
#
|
21
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
22
22
|
#
|
23
23
|
def index
|
24
24
|
self.list
|
25
25
|
end
|
26
26
|
|
27
27
|
|
28
|
-
#
|
28
|
+
# data
|
29
29
|
#
|
30
|
-
#
|
30
|
+
# Lists your custom datasets.
|
31
31
|
#
|
32
|
-
#
|
32
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
33
|
+
#
|
33
34
|
def list
|
34
35
|
type = options[:output_type] || nil
|
35
36
|
|
@@ -48,20 +49,20 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
48
49
|
vals
|
49
50
|
end
|
50
51
|
|
51
|
-
display "
|
52
|
+
display "datasets\n" if type.nil? && rows.size > 0
|
52
53
|
display TableOutputBuilder.build_table(headings, rows, type)
|
53
|
-
display "Total number of
|
54
|
+
display "Total number of datasets: "+rows.length.to_s if type.nil?
|
54
55
|
|
55
56
|
end
|
56
|
-
alias_command "rl:list", "relations:list"
|
57
57
|
|
58
58
|
|
59
|
-
#
|
59
|
+
# data:delete ID
|
60
60
|
#
|
61
|
-
#
|
61
|
+
# Deletes a dataset.
|
62
62
|
#
|
63
|
-
# -f, --force
|
64
|
-
# --output_type OUTPUT_TYPE
|
63
|
+
# -f, --force # Delete without asking for confirmation
|
64
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
65
|
+
#
|
65
66
|
def delete
|
66
67
|
id = options[:id] || shift_argument
|
67
68
|
forced = options[:force]
|
@@ -74,10 +75,10 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
74
75
|
end
|
75
76
|
|
76
77
|
while true
|
77
|
-
display "This operation cannot be undone. Are you sure you want to delete this
|
78
|
+
display "This operation cannot be undone. Are you sure you want to delete this dataset? (yes/no):", false
|
78
79
|
confirm = ask
|
79
80
|
break if confirm == "yes" || confirm == "no"
|
80
|
-
display "Please enter 'yes' to delete the
|
81
|
+
display "Please enter 'yes' to delete the dataset or 'no' to exit"
|
81
82
|
end
|
82
83
|
end
|
83
84
|
|
@@ -96,20 +97,19 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
96
97
|
end
|
97
98
|
end
|
98
99
|
end
|
99
|
-
alias_command "rl:delete", "relations:delete"
|
100
100
|
|
101
101
|
|
102
|
-
#
|
102
|
+
# data:create NAME
|
103
103
|
#
|
104
|
-
#
|
104
|
+
# Creates a new dataset.
|
105
105
|
#
|
106
|
-
# --schema SCHEMA
|
107
|
-
# --public SCOPE
|
108
|
-
# --file FILE
|
109
|
-
# --filetype FILETYPE
|
110
|
-
# --description DESCRIPTION
|
111
|
-
# --aliases ALIASES
|
112
|
-
# --output_type OUTPUT_TYPE
|
106
|
+
# --schema SCHEMA # Column names and types in the format "field_1:output_type_1,field_2:output_type_2,..."
|
107
|
+
# --public SCOPE # Make the dataset public
|
108
|
+
# --file FILE # A data file
|
109
|
+
# --filetype FILETYPE # File format type, defaults to csv
|
110
|
+
# --description DESCRIPTION # Description of dataset contents
|
111
|
+
# --aliases ALIASES # Dataset name aliases in the format "alias_1,alias_2,..."
|
112
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
113
113
|
#
|
114
114
|
def create
|
115
115
|
|
@@ -126,9 +126,9 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
126
126
|
aliases = options[:aliases] || nil
|
127
127
|
|
128
128
|
if type.nil?
|
129
|
-
hash =
|
129
|
+
hash = get_dataset_properties(schema,is_public,description,aliases)
|
130
130
|
else
|
131
|
-
hash =
|
131
|
+
hash = hash_dataset_properties(schema,is_public,description,aliases, type)
|
132
132
|
end
|
133
133
|
|
134
134
|
if file
|
@@ -144,19 +144,19 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
144
144
|
if type == "json"
|
145
145
|
display "{}"
|
146
146
|
else
|
147
|
-
display "
|
147
|
+
display "dataset ##{res['id']} #{res['action']}. size: #{res['size'] || 0} rows."
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
151
|
end
|
152
|
-
alias_command "rl:create", "relations:create"
|
153
152
|
|
154
153
|
|
155
|
-
#
|
154
|
+
# data:append ID FILE
|
155
|
+
#
|
156
|
+
# Adds data to an existing dataset.
|
156
157
|
#
|
157
|
-
#
|
158
|
-
# --
|
159
|
-
# --output_type OUTPUT_TYPE # Output formatting type i.e. json
|
158
|
+
# --filetype FILETYPE # Input File format type, defaults to csv
|
159
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
160
160
|
#
|
161
161
|
def append
|
162
162
|
|
@@ -169,14 +169,16 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
169
169
|
error("no id given", type) if id.nil?
|
170
170
|
error("no file given", type) if file.nil?
|
171
171
|
|
172
|
-
|
173
|
-
columns =
|
172
|
+
dataset = self.api.data.get(id, options)
|
173
|
+
columns = dataset["columns"].map{|col| {col["index"] => col["type"]}}
|
174
174
|
raw_rows = sanity_check_file(file,filetype,{"columns" => columns}, type)
|
175
175
|
|
176
176
|
total_rows = 0
|
177
177
|
display("uploading content.", false)
|
178
178
|
raw_rows.each_slice(APPENDS_ROWS_SLICE) do |rows|
|
179
179
|
|
180
|
+
|
181
|
+
# TODO: post to direct signed s3 (http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/PresignedPost.html)
|
180
182
|
display(".", false)
|
181
183
|
res = self.api.data.append(id, {:gzip_rows => Base64.encode64(gzip(rows.to_json()))})
|
182
184
|
# res = self.api.data.append(id, {:rows => rows})
|
@@ -188,19 +190,17 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
188
190
|
if type == "json"
|
189
191
|
display({:rows => total_rows}.to_json)
|
190
192
|
else
|
191
|
-
display "
|
193
|
+
display "dataset ##{id} appended #{total_rows} rows"
|
192
194
|
end
|
193
195
|
|
194
196
|
end
|
195
|
-
alias_command "append", "relations:append"
|
196
|
-
alias_command "rl:append", "relations:append"
|
197
197
|
|
198
|
-
#
|
198
|
+
# data:pull ID OUTPUT
|
199
199
|
#
|
200
|
-
#
|
200
|
+
# Pulls dataset into OUTPUT.gz.
|
201
201
|
#
|
202
|
-
#
|
203
|
-
#
|
202
|
+
# --cycle_id [cycle_id] # Retrieve data generated during specified cycle if dataset is associated with an app [default: last cycle]
|
203
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
204
204
|
#
|
205
205
|
def pull
|
206
206
|
|
@@ -214,54 +214,23 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
214
214
|
|
215
215
|
res = self.api.data.pull(id, options)
|
216
216
|
|
217
|
-
|
218
|
-
display "Waiting for download." if type.nil?
|
219
|
-
File.open(file, "w") do |f|
|
220
|
-
f.write open(res["uri"]).read
|
221
|
-
end
|
222
|
-
elsif(res["s3_credentials"])
|
223
|
-
display "Request sent. Depending on the size of your file, this may take a while." if type.nil?
|
224
|
-
s3 = AWS::S3.new(res["s3_credentials"])
|
225
|
-
bucket = s3.buckets[res["s3_bucket"]]
|
226
|
-
obj = bucket.objects.with_prefix("#{res["s3_file_key"]}/")
|
227
|
-
|
228
|
-
while(true)
|
229
|
-
keys = obj.collect(&:key)
|
230
|
-
if keys.length > 0 and keys.include?("#{res["s3_file_key"]}/manifest")
|
231
|
-
display "Starting to write to file..." if type.nil?
|
232
|
-
File.open(file, "w") do |f|
|
233
|
-
obj.each do |o|
|
234
|
-
if o.key == "#{res["s3_file_key"]}/manifest"
|
235
|
-
next
|
236
|
-
end
|
237
|
-
f.write(o.read)
|
238
|
-
end
|
239
|
-
end
|
240
|
-
break
|
241
|
-
else
|
242
|
-
sleep(3)
|
243
|
-
obj = bucket.objects.with_prefix("#{res["s3_file_key"]}/")
|
244
|
-
end
|
245
|
-
end
|
246
|
-
end
|
217
|
+
handle_downloading_manifest(file, res, type)
|
247
218
|
|
248
219
|
if type == "json"
|
249
220
|
display "{}"
|
250
221
|
else
|
251
|
-
display "
|
222
|
+
display "finished pulling dataset ##{id} to file"
|
252
223
|
end
|
253
224
|
|
254
225
|
end
|
255
|
-
alias_command "rl:pull", "relations:pull"
|
256
226
|
|
257
|
-
#
|
227
|
+
# data:pull:s3 ID S3_KEY S3_SECRET S3_BUCKET s3_FILE_KEY
|
258
228
|
#
|
259
|
-
#
|
229
|
+
# Pulls dataset to S3_BUCKET/FILE_KEY/part***.gz.
|
260
230
|
#
|
261
|
-
#
|
262
|
-
#
|
231
|
+
# --cycle_id [cycle_id] # Retrieve data generated during specified cycle if dataset is associated with an app [default: last cycle]
|
232
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
263
233
|
#
|
264
|
-
|
265
234
|
def pull_to_s3
|
266
235
|
|
267
236
|
id = options[:id] || shift_argument
|
@@ -286,24 +255,27 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
286
255
|
if type == "json"
|
287
256
|
display "{}"
|
288
257
|
else
|
289
|
-
display "downloading
|
290
|
-
display "if the
|
258
|
+
display "downloading dataset to s3://#{res["s3_bucket"]}/#{res["s3_file_key"]}/"
|
259
|
+
display "if the dataset is large, this may take a while, please check your s3 account after a few minutes"
|
291
260
|
end
|
292
261
|
end
|
293
|
-
alias_command "
|
294
|
-
alias_command "rl:pull:s3", "relations:pull_to_s3"
|
262
|
+
alias_command "data:pull:s3", "data:pull_to_s3"
|
295
263
|
|
296
264
|
|
297
|
-
#
|
265
|
+
# data:show ID
|
266
|
+
#
|
267
|
+
# Shows a sample of the dataset. See 'zillabyte queries' for
|
268
|
+
# more elaborate functionality.
|
298
269
|
#
|
299
|
-
#
|
270
|
+
# --cycle_id [cycle_id] # Retrieve data generated during specified cycle if dataset is associated with an app [default: last cycle]
|
271
|
+
# --no_truncation # Don't truncate long strings
|
272
|
+
# --meta # Show metadata columns (since, confidence, source)
|
273
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
300
274
|
#
|
301
|
-
# --cycle_id [cycle_id] # retrieve data generated for that cycle, only if this relation is associated with an app. (defaults to the last cycle)
|
302
|
-
# --no_truncation # don't truncate long strings
|
303
|
-
# --output_type OUTPUT_TYPE # the type of the output
|
304
275
|
def show
|
305
276
|
name = options[:name] || shift_argument
|
306
277
|
type = options[:output_type]
|
278
|
+
show_meta = options[:meta] || false
|
307
279
|
error "no id given" if name.nil?
|
308
280
|
|
309
281
|
# Initial request..
|
@@ -354,6 +326,7 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
354
326
|
headings = []
|
355
327
|
concrete_headings = res["rows"].first.keys
|
356
328
|
concrete_headings.delete("id")
|
329
|
+
META_COLUMNS.each {|c| concrete_headings.delete c} if (!show_meta)
|
357
330
|
concrete_headings.each do |ch|
|
358
331
|
has_alias = false
|
359
332
|
(res['column_aliases'] || []).each do |al|
|
@@ -386,24 +359,23 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
386
359
|
if type == "json"
|
387
360
|
display "{}"
|
388
361
|
else
|
389
|
-
display "empty
|
362
|
+
display "empty dataset"
|
390
363
|
end
|
391
364
|
end
|
392
365
|
|
393
366
|
end
|
394
|
-
alias_command "rl:show", "relations:show"
|
395
367
|
|
396
368
|
|
397
369
|
private
|
398
370
|
|
399
371
|
|
400
|
-
def
|
372
|
+
def hash_dataset_properties(schema, is_public, description, aliases, type)
|
401
373
|
if !aliases.nil?
|
402
374
|
aliases = aliases.strip.split(",").map{|x| x.strip}.uniq
|
403
375
|
aliases.each do |a|
|
404
376
|
if(!(a =~ /^[a-zA-Z0-9\_]+$/i))
|
405
377
|
error_message = "(\"#{a}\" contains illegal characters. Only letters, numbers and underscore are allowed in alias names."
|
406
|
-
error_message += "If you would like to give alias names to your
|
378
|
+
error_message += "If you would like to give alias names to your dataset, please enter them below. (comma separated, only letters, number and underscore allowed)"
|
407
379
|
error(error_message, type)
|
408
380
|
end
|
409
381
|
end
|
@@ -443,7 +415,7 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
443
415
|
|
444
416
|
|
445
417
|
|
446
|
-
def
|
418
|
+
def get_dataset_properties(schema, is_public, description = "", aliases = nil)
|
447
419
|
|
448
420
|
description ||= ""
|
449
421
|
valid_types=["string", "integer", "float"]
|
@@ -486,7 +458,7 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
486
458
|
|
487
459
|
if is_public.nil?
|
488
460
|
while true
|
489
|
-
display "Would you like your
|
461
|
+
display "Would you like your dataset to be public? (yes or no)"
|
490
462
|
pp = ask.strip.downcase
|
491
463
|
if(pp == "yes" or pp == "y")
|
492
464
|
is_public = "public"
|
@@ -523,7 +495,7 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
523
495
|
|
524
496
|
CSV.foreach(file) do |row|
|
525
497
|
if row.size != n_columns
|
526
|
-
error("
|
498
|
+
error("dataset expects #{n_columns} column(s). Found a row with #{row.size}::\n #{row}", type)
|
527
499
|
end
|
528
500
|
|
529
501
|
float_cols.each do |i|
|
data/lib/zillabyte/cli/flows.rb
CHANGED
@@ -21,10 +21,10 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
21
21
|
|
22
22
|
# flows:status [DIR]
|
23
23
|
#
|
24
|
-
#
|
24
|
+
# Fetches detailed status of the flow.
|
25
25
|
#
|
26
|
-
# --
|
27
|
-
# --
|
26
|
+
# --directory DIR # Flow directory
|
27
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
28
28
|
#
|
29
29
|
def status
|
30
30
|
|
@@ -56,11 +56,11 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
56
56
|
|
57
57
|
# flows:pull ID DIR
|
58
58
|
#
|
59
|
-
#
|
59
|
+
# Pulls a flow source to a directory.
|
60
60
|
#
|
61
|
-
# --force
|
62
|
-
# --
|
63
|
-
# --
|
61
|
+
# --force # Pulls even if the directory exists
|
62
|
+
# --directory DIR # Flow directory
|
63
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
64
64
|
#
|
65
65
|
# Examples:
|
66
66
|
#
|
@@ -107,13 +107,21 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
107
107
|
|
108
108
|
# flows:prep [DIR]
|
109
109
|
#
|
110
|
-
#
|
110
|
+
# Performs any necessary initialization for the flow.
|
111
111
|
#
|
112
|
-
# --directory DIR
|
113
|
-
# --output_type OUTPUT_TYPE
|
112
|
+
# --directory DIR # Flow directory
|
113
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
114
|
+
# --mode MODE # Specify development or production mode for dependencies #HIDDEN
|
114
115
|
#
|
115
|
-
def prep
|
116
|
-
|
116
|
+
def prep()
|
117
|
+
mode, bundle_flags = case options[:mode]
|
118
|
+
when nil, "development"
|
119
|
+
[:development, ""]
|
120
|
+
when "production"
|
121
|
+
[:production, "--deployment"]
|
122
|
+
else
|
123
|
+
error("Unsupported mode #{options[:mode].inspect()}. Zillabyte currently supports development and production.")
|
124
|
+
end
|
117
125
|
type = options[:output_type]
|
118
126
|
dir = options[:directory] || shift_argument
|
119
127
|
if dir.nil?
|
@@ -130,12 +138,10 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
130
138
|
|
131
139
|
case meta["language"]
|
132
140
|
when "ruby"
|
133
|
-
|
134
141
|
# Execute in the bundler context
|
135
142
|
full_script = File.join(dir, meta["script"])
|
136
|
-
cmd = "cd \"#{meta['home_dir']}\"; unset BUNDLE_GEMFILE; unset RUBYOPT; bundle install"
|
143
|
+
cmd = "cd \"#{meta['home_dir']}\"; unset BUNDLE_GEMFILE; unset RUBYOPT; bundle install #{bundle_flags}"
|
137
144
|
exec(cmd)
|
138
|
-
|
139
145
|
when "python"
|
140
146
|
vDir = "#{meta['home_dir']}/vEnv"
|
141
147
|
lock_file = meta['home_dir']+"/zillabyte_thread_lock_file"
|
@@ -158,11 +164,11 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
158
164
|
|
159
165
|
# flows:logs ID [OPERATION_NAME]
|
160
166
|
#
|
161
|
-
#
|
167
|
+
# Streams logs for the flow from our cluster.
|
162
168
|
#
|
163
|
-
# --
|
164
|
-
# --
|
165
|
-
#
|
169
|
+
# --operation OPERATION_NAME # Specify the operation to show logs for
|
170
|
+
# -v, --verbose LEVEL # Sets the verbosity (error, info, debug) [default: info]
|
171
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
166
172
|
#
|
167
173
|
def logs
|
168
174
|
|
@@ -193,8 +199,9 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
193
199
|
|
194
200
|
# flows:errors ID
|
195
201
|
#
|
196
|
-
#
|
197
|
-
#
|
202
|
+
# Show recent errors generated by the flow.
|
203
|
+
#
|
204
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
198
205
|
#
|
199
206
|
def errors
|
200
207
|
|
@@ -256,11 +263,11 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
256
263
|
|
257
264
|
# flows:live_run [OPERATION_NAME] [PIPE_NAME] [DIR]
|
258
265
|
#
|
259
|
-
#
|
266
|
+
# Runs a local flow with live data.
|
260
267
|
#
|
261
|
-
# --config CONFIG_FILE
|
262
|
-
# --
|
263
|
-
# --
|
268
|
+
# --config CONFIG_FILE # Use the given config file
|
269
|
+
# --directory DIR # Flow directory
|
270
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
264
271
|
#
|
265
272
|
def live_run
|
266
273
|
|
@@ -292,11 +299,11 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
292
299
|
|
293
300
|
# flows:info [DIR]
|
294
301
|
#
|
295
|
-
#
|
302
|
+
# Outputs the info for the flow in the dir.
|
296
303
|
#
|
297
|
-
# --pretty
|
298
|
-
# --
|
299
|
-
# --
|
304
|
+
# --pretty # Pretty prints the info output
|
305
|
+
# --directory DIR # Flow directory
|
306
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
300
307
|
#
|
301
308
|
def info
|
302
309
|
|
@@ -330,10 +337,10 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
330
337
|
|
331
338
|
# flows:delete ID
|
332
339
|
#
|
333
|
-
#
|
340
|
+
# Deletes a flow. If the flow is running, this command will kill it.
|
334
341
|
#
|
335
|
-
# -f, --force
|
336
|
-
# --output_type OUTPUT_TYPE
|
342
|
+
# -f, --force # Don't ask for confirmation
|
343
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
337
344
|
#
|
338
345
|
def delete
|
339
346
|
id = options[:id] || shift_argument
|
@@ -412,9 +419,6 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
412
419
|
end
|
413
420
|
|
414
421
|
|
415
|
-
#
|
416
|
-
# --output_type OUTPUT_TYPE # specify an output type i.e. json
|
417
|
-
#
|
418
422
|
def self.get_info(cmd, info_file, dir, options = {})
|
419
423
|
type = options[:output_type]
|
420
424
|
|
@@ -457,18 +461,16 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
457
461
|
end
|
458
462
|
|
459
463
|
|
460
|
-
|
461
|
-
|
462
464
|
# flows:test
|
463
465
|
#
|
464
|
-
#
|
466
|
+
# Tests a local flow with sample data.
|
465
467
|
#
|
466
|
-
# --config CONFIG_FILE
|
467
|
-
# --input INPUT_FILE
|
468
|
-
# --output OUTPUT_FILE
|
469
|
-
# --cycles CYCLES
|
470
|
-
# --directory DIR
|
471
|
-
# -i, --interactive
|
468
|
+
# --config CONFIG_FILE # Use the given config file
|
469
|
+
# --input INPUT_FILE # Uses a CSV for component input (only applicable for components)
|
470
|
+
# --output OUTPUT_FILE # Writes sink output to a file
|
471
|
+
# --cycles CYCLES # Number of cycles to emit [default 1] (only applicable for apps)
|
472
|
+
# --directory DIR # Flow directory
|
473
|
+
# -i, --interactive # Interactively control input and read output (only applicable for apps)
|
472
474
|
#
|
473
475
|
def test
|
474
476
|
dir = options[:directory]
|
@@ -514,10 +516,10 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
514
516
|
|
515
517
|
# flows:kill ID
|
516
518
|
#
|
517
|
-
#
|
519
|
+
# Kills the given flow.
|
518
520
|
#
|
519
|
-
# --config CONFIG_FILE
|
520
|
-
# --output_type OUTPUT_TYPE
|
521
|
+
# --config CONFIG_FILE # Use the given config file
|
522
|
+
# --output_type OUTPUT_TYPE # Specify an output type i.e. json #HIDDEN
|
521
523
|
#
|
522
524
|
def kill
|
523
525
|
id = options[:id] || shift_argument
|
@@ -578,9 +580,7 @@ class Zillabyte::Command::Flows < Zillabyte::Command::Base
|
|
578
580
|
|
579
581
|
private
|
580
582
|
|
581
|
-
|
582
|
-
# --output_type OUTPUT_TYPE # specify an output type i.e. json
|
583
|
-
#
|
583
|
+
|
584
584
|
def command(arg="--execute_live", type = nil, dir = Dir.pwd, ignore_stderr = false)
|
585
585
|
meta = Zillabyte::CLI::Config.get_config_info(dir, self, options)
|
586
586
|
|
data/lib/zillabyte/cli/git.rb
CHANGED
@@ -6,14 +6,13 @@ class Zillabyte::Command::Git < Zillabyte::Command::Base
|
|
6
6
|
|
7
7
|
# git:remote [OPTIONS]
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# Adds a git remote to an app repo.
|
10
|
+
# If OPTIONS are specified they will be passed to git remote add.
|
10
11
|
#
|
11
|
-
#
|
12
|
+
# -r, --remote REMOTE # The git remote to create, default "Zillabyte"
|
13
|
+
# -n, --name NAME # The name of the app, default current directory's name
|
12
14
|
#
|
13
|
-
#
|
14
|
-
# -n, --name NAME # the name of the app, default current directory's name
|
15
|
-
#
|
16
|
-
#Examples:
|
15
|
+
# Examples:
|
17
16
|
#
|
18
17
|
# $ zillabyte git:remote -a example
|
19
18
|
# Git remote zillabyte added
|
@@ -32,4 +31,4 @@ class Zillabyte::Command::Git < Zillabyte::Command::Base
|
|
32
31
|
|
33
32
|
end
|
34
33
|
|
35
|
-
end
|
34
|
+
end
|
data/lib/zillabyte/cli/help.rb
CHANGED
@@ -4,14 +4,13 @@ require "zillabyte/cli/base"
|
|
4
4
|
#
|
5
5
|
class Zillabyte::Command::Help < Zillabyte::Command::Base
|
6
6
|
|
7
|
-
PRIMARY_NAMESPACES = %w(
|
7
|
+
PRIMARY_NAMESPACES = %w( data query apps components logs )
|
8
8
|
|
9
9
|
# help
|
10
10
|
def index(*direct_args)
|
11
11
|
|
12
12
|
if command = args.shift || direct_args.shift
|
13
13
|
if command == "aliases"
|
14
|
-
puts
|
15
14
|
puts "Useful aliases: "
|
16
15
|
puts
|
17
16
|
summary_for_aliases(Zillabyte::Command.command_aliases)
|
@@ -85,8 +84,8 @@ private
|
|
85
84
|
|
86
85
|
def summary_for_aliases(command_aliases)
|
87
86
|
used_aliases = command_aliases.select{|c,a| !c.include?("-") and !c.include?(":") and !skip_command?(commands[a])}
|
88
|
-
a_size = longest(used_aliases.map { |al,al_to| al }) +
|
89
|
-
a_to_size = longest(used_aliases.map { |al,al_to| al_to }) +
|
87
|
+
a_size = longest(used_aliases.map { |al,al_to| al }) + 6
|
88
|
+
a_to_size = longest(used_aliases.map { |al,al_to| al_to }) + 6
|
90
89
|
used_aliases.sort_by{|k,v| v}.each do |command_alias, alias_to|
|
91
90
|
|
92
91
|
if command_alias.include?("-") or command_alias.include?(":")
|
@@ -149,7 +148,6 @@ private
|
|
149
148
|
puts
|
150
149
|
puts " " + legacy_help_for_command(name).to_s
|
151
150
|
end
|
152
|
-
puts
|
153
151
|
end
|
154
152
|
|
155
153
|
namespace_commands = commands_for_namespace(name).reject do |command|
|