zillabyte-cli 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +9 -9
- data/lib/zillabyte/api/apps.rb +13 -16
- data/lib/zillabyte/api/data.rb +8 -7
- data/lib/zillabyte/api.rb +12 -5
- data/lib/zillabyte/cli/apps.rb +41 -28
- data/lib/zillabyte/cli/relations.rb +8 -9
- data/lib/zillabyte/cli/repl.rb +22 -0
- data/lib/zillabyte/cli/templates/ruby/app.rb +16 -0
- data/lib/zillabyte/cli/templates/ruby/zillabyte.conf.yaml +1 -1
- data/lib/zillabyte-cli/version.rb +1 -1
- metadata +5 -7
- data/lib/#zillabyte-cli.rb# +0 -5
- data/lib/zillabyte/cli/#logs.rb# +0 -12
- data/lib/zillabyte/cli/templates/python/#simple_function.py# +0 -27
- data/lib/zillabyte/cli/templates/ruby/simple_app.rb +0 -42
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2YzNzJlOTE4Mzk3Y2QxZmYwMTY1NjNiNWUxYTBlZTg5ODk4OTgyNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
7
|
-
|
6
|
+
OGFkNGQ1MDYxMTE2NzJhMDIyNGJjMjc4YzNiNTQ2YmUzYjljZTRmMA==
|
7
|
+
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzQzM2E2NjIxYmZmZjhhNzlkYmQzMjgyNzkzMTg2YjRkMDQ4YTY1ZDQxY2Rk
|
10
|
+
MjU0NTU2MGMwYWJjNjgxYmE3NDk5MjNmZmJkNDdhOTBhZWViYzdkN2JlNWIw
|
11
|
+
MTMyZGZiYjYwNjdkNzI1Y2YyN2JlZWI2NDY2N2NiOTIyZjY5NjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTllY2ZjNjViNTM3ZjcwODhlOGM5MDZhMWQ5YjAyZGMzMGY0MGZhOGNlNTcz
|
14
|
+
MGQzYjM1MzJkZmI5ZmQwZmJjYjQzNDk5MDI0MDY0N2JmNmVlZjJiYjcxNDY5
|
15
|
+
YWM1NmI3ZjE0NTJkM2ZiMzc4YzhlMDhmODJlMzAzOWFlNjBmMWY=
|
data/lib/zillabyte/api/apps.rb
CHANGED
@@ -14,15 +14,14 @@ class Zillabyte::API::Apps < Zillabyte::API::Base
|
|
14
14
|
res = @api.request(
|
15
15
|
:expects => 200,
|
16
16
|
:method => :get,
|
17
|
-
:path => "/flows"
|
17
|
+
:path => "/flows",
|
18
|
+
:body => options.to_json
|
18
19
|
)
|
19
20
|
|
20
21
|
res.body
|
21
22
|
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
25
|
|
27
26
|
# GET /flows/id
|
28
27
|
def get(id, options = {})
|
@@ -42,8 +41,6 @@ class Zillabyte::API::Apps < Zillabyte::API::Base
|
|
42
41
|
|
43
42
|
end
|
44
43
|
|
45
|
-
|
46
|
-
|
47
44
|
|
48
45
|
# GET /flows/id/kill
|
49
46
|
def kill(id, options = {})
|
@@ -115,29 +112,29 @@ class Zillabyte::API::Apps < Zillabyte::API::Base
|
|
115
112
|
end
|
116
113
|
|
117
114
|
|
118
|
-
# GET /flows/id
|
115
|
+
# GET /flows/id/download
|
119
116
|
def pull_to_directory(id, dir, session = nil, options = {})
|
120
117
|
|
121
118
|
# Get the resource. note query params
|
122
|
-
|
119
|
+
type = options[:type]
|
120
|
+
session.display "downloading ##{id}" if session && type.nil?
|
123
121
|
res = @api.request(
|
124
122
|
:expects => 200,
|
125
123
|
:method => :get,
|
126
|
-
:path => "/flows/#{id}/download"
|
127
|
-
|
128
|
-
#:path => "/flows/#{id}?tar=1"
|
124
|
+
:path => "/flows/#{id}/download",
|
125
|
+
:body => options.to_json
|
129
126
|
)
|
130
|
-
|
127
|
+
|
131
128
|
hash = res.body
|
132
129
|
unless hash['status'] == 'error'
|
133
130
|
if(hash['tar'])
|
134
|
-
session.display "unpacking to #{dir}" if
|
131
|
+
session.display "unpacking to #{dir}" if type.nil?
|
135
132
|
tar = StringIO.new(Base64.decode64(hash['tar']))
|
136
133
|
hash.delete('tar')
|
137
134
|
Zillabyte::Common::Tar.untar(tar, dir)
|
138
|
-
#If you get an uri instead of the tar, then download the file directly from s3
|
135
|
+
#If you get an uri instead of the tar, then download the file directly from s3
|
139
136
|
elsif(hash['uri'])
|
140
|
-
session.display "downloading ##{id} to #{dir}" if
|
137
|
+
session.display "downloading ##{id} to #{dir}" if type.nil?
|
141
138
|
uri = URI(hash['uri'])
|
142
139
|
try_again = 1
|
143
140
|
while(try_again)
|
@@ -191,7 +188,7 @@ class Zillabyte::API::Apps < Zillabyte::API::Base
|
|
191
188
|
options = {
|
192
189
|
:name => hash['name'],
|
193
190
|
:meta => hash,
|
194
|
-
#
|
191
|
+
# :tar => Base64.encode64(tar.read)
|
195
192
|
}.merge(options)
|
196
193
|
|
197
194
|
session.display("uploading #{tar.size} bytes... ", false) if session && type.nil?
|
@@ -259,7 +256,7 @@ class Zillabyte::API::Apps < Zillabyte::API::Base
|
|
259
256
|
command = "cd \"#{dir}\"; PYTHONPATH=~/zb1/multilang/python/Zillabyte python \"#{full_script}\" #{arg}"
|
260
257
|
end
|
261
258
|
when "js"
|
262
|
-
#
|
259
|
+
#command = "#{Zillabyte::API::CASPERJS_BIN} #{Zillabyte::API::API_CLIENT_JS} \"#{full_script}\" --info"
|
263
260
|
command = "cd \"#{dir}\"; NODE_PATH=~/zb1/multilang/js/src/lib #{Zillabyte::API::NODEJS_BIN} \"#{full_script}\" #{arg}"
|
264
261
|
else
|
265
262
|
session.error "unsupported language: #{hash["language"]}" if session
|
data/lib/zillabyte/api/data.rb
CHANGED
@@ -7,7 +7,7 @@ class Zillabyte::API::Data < Zillabyte::API::Base
|
|
7
7
|
res = @api.request(
|
8
8
|
:expects => 200,
|
9
9
|
:method => :get,
|
10
|
-
:path => "/relations/#{id}",
|
10
|
+
:path => "/relations/#{CGI.escape(id)}",
|
11
11
|
:body => options.to_json
|
12
12
|
)
|
13
13
|
res.body
|
@@ -28,7 +28,7 @@ class Zillabyte::API::Data < Zillabyte::API::Base
|
|
28
28
|
res = @api.request(
|
29
29
|
:expects => 200,
|
30
30
|
:method => :post,
|
31
|
-
:path => "/relations/#{id}/pull",
|
31
|
+
:path => "/relations/#{CGI.escape(id)}/pull",
|
32
32
|
:body => options.to_json
|
33
33
|
)
|
34
34
|
res.body
|
@@ -38,7 +38,7 @@ class Zillabyte::API::Data < Zillabyte::API::Base
|
|
38
38
|
res = @api.request(
|
39
39
|
:expects => 200,
|
40
40
|
:method => :post,
|
41
|
-
:path => "/relations/#{id}/pull_to_s3",
|
41
|
+
:path => "/relations/#{CGI.escape(id)}/pull_to_s3",
|
42
42
|
:body => options.to_json
|
43
43
|
)
|
44
44
|
res.body
|
@@ -53,7 +53,7 @@ class Zillabyte::API::Data < Zillabyte::API::Base
|
|
53
53
|
# schema
|
54
54
|
# relations
|
55
55
|
}.merge(options)
|
56
|
-
|
56
|
+
|
57
57
|
res = @api.request(
|
58
58
|
:expects => 200,
|
59
59
|
:method => :post,
|
@@ -66,12 +66,13 @@ class Zillabyte::API::Data < Zillabyte::API::Base
|
|
66
66
|
end
|
67
67
|
|
68
68
|
|
69
|
-
def delete(id,
|
69
|
+
def delete(id, options={})
|
70
70
|
|
71
71
|
res = @api.request(
|
72
72
|
:expects => 200,
|
73
73
|
:method => :delete,
|
74
|
-
:path => "/relations/#{id}"
|
74
|
+
:path => "/relations/#{CGI.escape(id)}",
|
75
|
+
:body => options.to_json
|
75
76
|
)
|
76
77
|
|
77
78
|
res.body
|
@@ -84,7 +85,7 @@ class Zillabyte::API::Data < Zillabyte::API::Base
|
|
84
85
|
res = @api.request(
|
85
86
|
:expects => 200,
|
86
87
|
:method => :post,
|
87
|
-
:path => "/relations/#{id}/append",
|
88
|
+
:path => "/relations/#{CGI.escape(id)}/append",
|
88
89
|
:body => options.to_json
|
89
90
|
)
|
90
91
|
hash = res.body
|
data/lib/zillabyte/api.rb
CHANGED
@@ -65,13 +65,17 @@ class Zillabyte::API
|
|
65
65
|
end
|
66
66
|
|
67
67
|
type = nil
|
68
|
-
if
|
69
|
-
|
68
|
+
if params[:body]
|
69
|
+
begin
|
70
|
+
param_hash = JSON.parse(params[:body])
|
71
|
+
type = param_hash["type"]
|
72
|
+
rescue JSON::ParserError => e
|
73
|
+
@session.error("invalid parameters", type)
|
74
|
+
end
|
70
75
|
end
|
71
76
|
|
72
|
-
|
73
77
|
begin
|
74
|
-
|
78
|
+
|
75
79
|
# If a block is given, then we assume we're streaming (i.e. for logs)
|
76
80
|
if block_given?
|
77
81
|
|
@@ -111,11 +115,13 @@ class Zillabyte::API
|
|
111
115
|
end
|
112
116
|
end
|
113
117
|
end
|
114
|
-
|
118
|
+
|
115
119
|
# Execute the request
|
116
120
|
response = @connection.request(params)
|
117
121
|
|
118
122
|
|
123
|
+
|
124
|
+
|
119
125
|
rescue Excon::Errors::HTTPStatusError => error
|
120
126
|
|
121
127
|
|
@@ -125,6 +131,7 @@ class Zillabyte::API
|
|
125
131
|
hash = JSON.parse(error.response.body)
|
126
132
|
if hash['error_message']
|
127
133
|
@session.error(hash['error_message'], type)
|
134
|
+
|
128
135
|
end
|
129
136
|
rescue JSON::ParserError => e
|
130
137
|
# Trickle to generic message below
|
data/lib/zillabyte/cli/apps.rb
CHANGED
@@ -108,13 +108,17 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
108
108
|
# $ zillabyte apps:pull .
|
109
109
|
#
|
110
110
|
def pull
|
111
|
-
|
112
|
-
|
111
|
+
|
112
|
+
app_id = options[:id] || shift_argument
|
113
|
+
|
114
|
+
if !(app_id =~ /^\d*$/)
|
115
|
+
options[:is_name] = true
|
116
|
+
end
|
117
|
+
|
113
118
|
dir = options[:directory] || shift_argument
|
114
119
|
type = options[:type]
|
115
|
-
|
116
120
|
|
117
|
-
error("no id given", type) if
|
121
|
+
error("no id given", type) if app_id.nil?
|
118
122
|
error("no directory given", type) if dir.nil?
|
119
123
|
|
120
124
|
# Create if not exists..
|
@@ -126,7 +130,7 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
126
130
|
FileUtils.mkdir_p(dir)
|
127
131
|
end
|
128
132
|
|
129
|
-
res = api.apps.pull_to_directory
|
133
|
+
res = api.apps.pull_to_directory app_id, dir, session, options
|
130
134
|
|
131
135
|
if res['error']
|
132
136
|
error("error: #{res['error_message']}", type)
|
@@ -150,10 +154,13 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
150
154
|
# --type TYPE # specify an output type i.e. json
|
151
155
|
#
|
152
156
|
def delete
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
+
app_id = options[:id] || shift_argument
|
158
|
+
|
159
|
+
if app_id.nil?
|
160
|
+
app_id = read_name_from_conf(options)
|
161
|
+
options[:is_name] = true
|
162
|
+
elsif !(app_id =~ /^\d*$/)
|
163
|
+
options[:is_name] = true
|
157
164
|
end
|
158
165
|
forced = options[:force]
|
159
166
|
type = options[:type]
|
@@ -176,7 +183,7 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
176
183
|
confirmed = forced || confirm == "yes"
|
177
184
|
|
178
185
|
if confirmed
|
179
|
-
response = api.apps.delete(
|
186
|
+
response = api.apps.delete(app_id, options)
|
180
187
|
if type == "json"
|
181
188
|
display {}.to_json
|
182
189
|
else
|
@@ -195,7 +202,6 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
195
202
|
def prep
|
196
203
|
|
197
204
|
dir = options[:directory] || shift_argument || Dir.pwd
|
198
|
-
|
199
205
|
meta = Zillabyte::CLI::Config.get_config_info(dir)
|
200
206
|
|
201
207
|
case meta["language"]
|
@@ -203,7 +209,7 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
203
209
|
|
204
210
|
# Execute in the bundler context
|
205
211
|
full_script = File.join(dir, meta["script"])
|
206
|
-
cmd = "cd \"#{meta['home_dir']}\"; unset BUNDLE_GEMFILE; bundle install"
|
212
|
+
cmd = "cd \"#{meta['home_dir']}\"; unset BUNDLE_GEMFILE; unset RUBYOPT; bundle install"
|
207
213
|
exec(cmd)
|
208
214
|
|
209
215
|
when "python"
|
@@ -258,7 +264,7 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
258
264
|
|
259
265
|
|
260
266
|
|
261
|
-
# apps:logs
|
267
|
+
# apps:logs ID [OPERATION_NAME]
|
262
268
|
#
|
263
269
|
# streams logs from the distributed workers
|
264
270
|
#
|
@@ -267,7 +273,14 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
267
273
|
#
|
268
274
|
def logs
|
269
275
|
|
270
|
-
app_id = options[:
|
276
|
+
app_id = options[:id] || shift_argument
|
277
|
+
if app_id.nil?
|
278
|
+
app_id = read_name_from_conf(options)
|
279
|
+
options[:is_name] = true
|
280
|
+
elsif !(app_id =~ /^\d*$/)
|
281
|
+
options[:is_name] = true
|
282
|
+
end
|
283
|
+
|
271
284
|
operation_id = options[:operation] || shift_argument || '_ALL_'
|
272
285
|
category = options[:verbose] || '_ALL_'
|
273
286
|
type = options[:type]
|
@@ -275,16 +288,10 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
275
288
|
carry_settings = {
|
276
289
|
:category => category
|
277
290
|
}
|
278
|
-
api_options = {}
|
279
291
|
|
280
|
-
if app_id.nil?
|
281
|
-
app_id = read_name_from_conf(options)
|
282
|
-
api_options[:flow_name] = true
|
283
|
-
end
|
284
|
-
|
285
292
|
display "Retrieving logs for app ##{app_id}...please wait..." if type.nil?
|
286
293
|
lf = LogFormatter::Operation.new
|
287
|
-
self.api.logs.get(app_id, operation_id,
|
294
|
+
self.api.logs.get(app_id, operation_id, options) do |line|
|
288
295
|
|
289
296
|
error(line['error_message'], type) if line['error']
|
290
297
|
lf.print_log_line(line) if type.nil?
|
@@ -309,7 +316,9 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
309
316
|
# No name?
|
310
317
|
if app_id.nil?
|
311
318
|
app_id = read_name_from_conf(options)
|
312
|
-
options[:
|
319
|
+
options[:is_name] = true
|
320
|
+
elsif !(app_id =~ /^\d*$/)
|
321
|
+
options[:is_name] = true
|
313
322
|
end
|
314
323
|
|
315
324
|
type = options[:type]
|
@@ -372,7 +381,9 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
372
381
|
|
373
382
|
if app_id.nil?
|
374
383
|
app_id = read_name_from_conf(options)
|
375
|
-
options[:
|
384
|
+
options[:is_name] = true
|
385
|
+
elsif !(app_id =~ /^\d*$/)
|
386
|
+
options[:is_name] = true
|
376
387
|
end
|
377
388
|
|
378
389
|
if trigger_next
|
@@ -401,7 +412,7 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
401
412
|
if response["job_id"]
|
402
413
|
options[:job_id] = response["job_id"]
|
403
414
|
app_id = response["flow_id"]
|
404
|
-
options.delete :
|
415
|
+
options.delete :is_name
|
405
416
|
|
406
417
|
start = Time.now.utc
|
407
418
|
display "Next cycle request sent. If your app was RETIRED this may take slightly longer." if type.nil?
|
@@ -892,12 +903,14 @@ class Zillabyte::Command::Apps < Zillabyte::Command::Base
|
|
892
903
|
#
|
893
904
|
def kill
|
894
905
|
|
895
|
-
|
906
|
+
app_id = options[:id] || shift_argument
|
896
907
|
type = options[:type]
|
897
908
|
|
898
|
-
if
|
899
|
-
|
900
|
-
options[:
|
909
|
+
if app_id.nil?
|
910
|
+
app_id = read_name_from_conf(options)
|
911
|
+
options[:is_name] = true
|
912
|
+
elsif !(app_id =~ /^\d*$/)
|
913
|
+
options[:is_name] = true
|
901
914
|
end
|
902
915
|
|
903
916
|
display "Killing app ##{id}...please wait..." if type.nil?
|
@@ -80,9 +80,9 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
80
80
|
end
|
81
81
|
|
82
82
|
confirmed = forced || confirm == "yes"
|
83
|
-
|
84
83
|
if confirmed
|
85
|
-
res = api.data.delete(id)
|
84
|
+
res = api.data.delete(id, options)
|
85
|
+
|
86
86
|
if res['error']
|
87
87
|
error(res['error'], type)
|
88
88
|
else
|
@@ -110,7 +110,7 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
110
110
|
# --type TYPE # The output format type
|
111
111
|
#
|
112
112
|
def create
|
113
|
-
|
113
|
+
|
114
114
|
name = options[:name] || shift_argument
|
115
115
|
file = options[:file] || nil
|
116
116
|
filetype = options[:filetype] || nil
|
@@ -136,7 +136,6 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
136
136
|
end
|
137
137
|
|
138
138
|
res = api.data.create name, hash
|
139
|
-
|
140
139
|
if res['error']
|
141
140
|
error("#{res['error_message']}", type)
|
142
141
|
else
|
@@ -146,7 +145,7 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
146
145
|
display "relation ##{res['id']} #{res['action']}. size: #{res['size'] || 0} rows."
|
147
146
|
end
|
148
147
|
end
|
149
|
-
|
148
|
+
|
150
149
|
end
|
151
150
|
alias_command "rl:create", "relations:create"
|
152
151
|
|
@@ -169,11 +168,11 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
169
168
|
error("no file given", type) if file.nil?
|
170
169
|
|
171
170
|
|
172
|
-
relation = self.api.data.get(id)
|
171
|
+
relation = self.api.data.get(id, options)
|
173
172
|
columns = relation["columns"].map{|col| {col["index"] => col["type"]}}
|
174
173
|
rows = sanity_check_file(file,filetype,{"columns" => columns}, type)
|
175
174
|
|
176
|
-
res = self.api.data.append(id, {:rows => rows})
|
175
|
+
res = self.api.data.append(id, options.merge({:rows => rows}))
|
177
176
|
if type == "json"
|
178
177
|
display {}.to_json
|
179
178
|
else
|
@@ -189,7 +188,7 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
189
188
|
# pulls relation data into OUTPUT.gz
|
190
189
|
#
|
191
190
|
# --cycle_id [cycle_id] # retrieve data generated for that cycle, only if this relation is associated with an app. (defaults to the last cycle
|
192
|
-
# --type TYPE #
|
191
|
+
# --type TYPE # specify a communication format (i.e json) for programmatic interaction
|
193
192
|
#
|
194
193
|
def pull
|
195
194
|
|
@@ -427,7 +426,7 @@ class Zillabyte::Command::Relations < Zillabyte::Command::Base
|
|
427
426
|
error("specify public or private using --public")
|
428
427
|
end
|
429
428
|
|
430
|
-
{:schema => schema, :public => is_public, :description => description, :aliases => aliases}
|
429
|
+
{:schema => schema, :public => is_public, :description => description, :aliases => aliases, :type => type}
|
431
430
|
end
|
432
431
|
|
433
432
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "zillabyte/cli/base"
|
2
|
+
|
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
|
+
#
|
11
|
+
def index
|
12
|
+
|
13
|
+
while true
|
14
|
+
|
15
|
+
display "zilla> ", false
|
16
|
+
cmd = ask
|
17
|
+
exec "zillabyte #{cmd}; zillabyte repl"
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This is a template; feel free to change it.
|
2
|
+
# For more details, check out http://docs.zillabyte.com/quickstart/hello_world/
|
3
|
+
|
4
|
+
require 'zillabyte'
|
5
|
+
|
6
|
+
app = Zillabyte.app("hello_world_app")
|
7
|
+
.source("select * from web_pages")
|
8
|
+
.each{ |page|
|
9
|
+
if page['html'].include? "hello world"
|
10
|
+
emit :url => page['url']
|
11
|
+
end
|
12
|
+
}
|
13
|
+
.sink{
|
14
|
+
name "has_hello_world"
|
15
|
+
column "url", :string
|
16
|
+
}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
language: ruby
|
2
|
-
script:
|
2
|
+
script: app.rb
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zillabyte-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zillabyte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -243,7 +243,6 @@ extensions: []
|
|
243
243
|
extra_rdoc_files: []
|
244
244
|
files:
|
245
245
|
- bin/zillabyte
|
246
|
-
- lib/#zillabyte-cli.rb#
|
247
246
|
- lib/zillabyte/api/apps.rb
|
248
247
|
- lib/zillabyte/api/base.rb
|
249
248
|
- lib/zillabyte/api/data.rb
|
@@ -257,7 +256,6 @@ files:
|
|
257
256
|
- lib/zillabyte/api/zillalogs.rb
|
258
257
|
- lib/zillabyte/api.rb
|
259
258
|
- lib/zillabyte/auth.rb
|
260
|
-
- lib/zillabyte/cli/#logs.rb#
|
261
259
|
- lib/zillabyte/cli/apps.rb
|
262
260
|
- lib/zillabyte/cli/auth.rb
|
263
261
|
- lib/zillabyte/cli/base.rb
|
@@ -270,15 +268,15 @@ files:
|
|
270
268
|
- lib/zillabyte/cli/log_formatter.rb
|
271
269
|
- lib/zillabyte/cli/query.rb
|
272
270
|
- lib/zillabyte/cli/relations.rb
|
271
|
+
- lib/zillabyte/cli/repl.rb
|
273
272
|
- lib/zillabyte/cli/sources.rb
|
274
273
|
- lib/zillabyte/cli/templates/js/simple_function.js
|
275
274
|
- lib/zillabyte/cli/templates/js/zillabyte.conf.yaml
|
276
|
-
- lib/zillabyte/cli/templates/python/#simple_function.py#
|
277
275
|
- lib/zillabyte/cli/templates/python/requirements.txt
|
278
276
|
- lib/zillabyte/cli/templates/python/simple_function.py
|
279
277
|
- lib/zillabyte/cli/templates/python/zillabyte.conf.yaml
|
278
|
+
- lib/zillabyte/cli/templates/ruby/app.rb
|
280
279
|
- lib/zillabyte/cli/templates/ruby/Gemfile
|
281
|
-
- lib/zillabyte/cli/templates/ruby/simple_app.rb
|
282
280
|
- lib/zillabyte/cli/templates/ruby/zillabyte.conf.yaml
|
283
281
|
- lib/zillabyte/cli/version.rb
|
284
282
|
- lib/zillabyte/cli/zillalogs.rb
|
@@ -317,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
317
315
|
version: '0'
|
318
316
|
requirements: []
|
319
317
|
rubyforge_project:
|
320
|
-
rubygems_version: 2.
|
318
|
+
rubygems_version: 2.0.7
|
321
319
|
signing_key:
|
322
320
|
specification_version: 4
|
323
321
|
summary: The Official Zillabyte CLI Gem
|
data/lib/#zillabyte-cli.rb#
DELETED
data/lib/zillabyte/cli/#logs.rb#
DELETED
@@ -1,27 +0,0 @@
|
|
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
|
-
)
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'zillabyte'
|
2
|
-
|
3
|
-
Zillabyte.simple_app do
|
4
|
-
|
5
|
-
# This specifies the app's name and is mandatory.
|
6
|
-
name "simple_app"
|
7
|
-
|
8
|
-
# This directive instructs zillabyte to give your app every
|
9
|
-
# web page in our known universe. Your app will have access
|
10
|
-
# to two fields: URL and HTML
|
11
|
-
matches "select * from web_pages"
|
12
|
-
|
13
|
-
# This directive tells Zillabyte what kind of data your app
|
14
|
-
# produces. In this case, we're saying we will emit a tuple that
|
15
|
-
# is one-column wide and contains the field 'URL'
|
16
|
-
emits [
|
17
|
-
[
|
18
|
-
"has_hello_world", [ {"URL"=>:string} ]
|
19
|
-
]
|
20
|
-
]
|
21
|
-
|
22
|
-
|
23
|
-
# This is the heart of your algorithm. It's processed on every
|
24
|
-
# web page. This algorithm is run in parallel on possibly hundreds
|
25
|
-
# of machines.
|
26
|
-
execute do |tuple|
|
27
|
-
|
28
|
-
# get the fields
|
29
|
-
url = tuple['url']
|
30
|
-
html = tuple['html']
|
31
|
-
|
32
|
-
# For the purpose of this test, to show results from the test set,
|
33
|
-
# we'll loosen the search to include either hello or world
|
34
|
-
# instead of
|
35
|
-
# if html.include?('hello world')
|
36
|
-
if html.include?('hello world')
|
37
|
-
emit("has_hello_world", "URL" => url)
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|