zillabyte-cli 0.1.23 → 0.1.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 92e75d91289dcf56900c9e9d145910a44cd7d8f5
4
- data.tar.gz: f055414a6fac2898da96d332667e921106ff88eb
5
- SHA512:
6
- metadata.gz: 5d64345b60eee16d53efa88cc61090ba97cc39a31be2c1ccc0cd3f539d442f254fd434a4a45a78aa36c4d8b195c7c837a212f9032fbab42c4412836c10cd3d98
7
- data.tar.gz: 80011b41c32f75922d7932eb7092f034e92d0a121ee3a6cd1495ec9bf323df69fa13e44f2da3a6061b7d7acb2ee81be8f640e361e7f63e6956dba78dd52f6b29
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZTZjYWM4MDcxZTUyNzM4MGZiMGQyZTAyN2U4YTlkNzViZGQ1MWEyMw==
5
+ data.tar.gz: !binary |-
6
+ NTEwZDVkZjFmMmZjNjU2NWFkNTRkMjgwODRhYWI3MWE5NDA1NDBlOA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YmExNmVlMmZmYmE5YWM4ZjdiMmJmMzBjM2M5ZTkwNzBjODE3MTNmNzI5ZTM3
10
+ NjBlNzVlYTg4ZWQxMGI3MDAzMzRkZjI5NzIyOTY0ZDQ2YWVlNDhhMTMwMjIw
11
+ M2E0MTFiODFjZjQ5NzJkZGQxMTJiNjhhMmMyMzM4MTJhOWJlZGI=
12
+ data.tar.gz: !binary |-
13
+ YWU0MjQyY2Q1OGFkYzkyODE1NjMyZjVmODQ2NTFjZGNhOGY1M2I0ODNjNjdl
14
+ MzFhMjM4ODRjMTU3ZDVlNjE0N2U5ZTI3YWViZGEyOTc1YzZjNzc4ZWRiYWNk
15
+ MTBjZWE3ZGQ0MjcxNWZiYWQyYTYwZGZhN2JhYjRiNzkyZjc5Njg=
@@ -1,5 +1,5 @@
1
1
  module Zillabyte
2
2
  module CLI
3
- VERSION = "0.1.23"
3
+ VERSION = "0.1.24"
4
4
  end
5
5
  end
@@ -57,12 +57,13 @@ class Zillabyte::Runner::ComponentOperation
57
57
  def self.run_input()
58
58
  input = @__options[:input]
59
59
 
60
+ fields = @__node["fields"].map {|f| f.keys[0]}
61
+
60
62
  # Read input from file
61
63
  if input
62
64
  messages = []
63
65
  cdisplay "reading from file...."
64
66
  csv_rows = CSV.read("#{input}")
65
- fields = @__node["fields"].map {|f| f.keys[0]}
66
67
  csv_rows.each do |row|
67
68
  tuple = {}
68
69
  fields.each {|f| tuple[f] = row.shift}
@@ -146,32 +147,20 @@ class Zillabyte::Runner::ComponentOperation
146
147
  break
147
148
  end
148
149
 
149
- # Build tuple
150
- begin
151
-
152
- tuple = JSON.parse(msg)
153
- rescue JSON::ParserError
154
- cdisplay "Error: invalid JSON"
155
- next
150
+ # Build tuples
151
+ args = msg.gsub(/[\'\"]/, '').split(' ')
152
+ component_args = []
153
+
154
+ while(true) do
155
+ break if args.empty?
156
+ tuple = {}
157
+ fields.each {|f| tuple[f] = args.shift}
158
+ tuple_json = build_tuple_json(tuple)
159
+ display_json = Hash[JSON.parse(tuple_json)["tuple"].map {|k,v| [Zillabyte::Runner::Operation.truncate_message(k), Zillabyte::Runner::Operation.truncate_message(v)]}].to_json
160
+ send_to_consumers(tuple_json)
156
161
  end
157
-
158
-
159
- # Check input for correct fields
160
- has_fields = true
161
- fields = @__node['fields'].flat_map {|h| h.keys}
162
- tuple.each_key do |field|
163
- if !fields.include? field
164
- cdisplay "Error: invalid schema for node"
165
- next
166
- end
167
- end
168
- tuple_json = build_tuple_json(tuple)
169
- display_json = Hash[JSON.parse(tuple_json)["tuple"].map {|k,v| [Zillabyte::Runner::Operation.truncate_message(k), Zillabyte::Runner::Operation.truncate_message(v)]}].to_json
170
- send_to_consumers(tuple_json)
171
162
  end
172
-
173
163
  end
174
-
175
164
  end
176
165
 
177
166
 
@@ -218,7 +218,7 @@ class Zillabyte::Runner::ComponentRunner < Zillabyte::Command::Base
218
218
  if source == ""
219
219
  source = name
220
220
  else
221
- display "Cannot run component with multiple input sources without input files"
221
+ display "Error: Cannot run component with multiple input sources without input files"
222
222
  return
223
223
  end
224
224
  end
@@ -231,11 +231,18 @@ class Zillabyte::Runner::ComponentRunner < Zillabyte::Command::Base
231
231
 
232
232
  while true
233
233
 
234
- # TODO this doesnt handle multiple sources
235
- #source = @operation_pipes["source_1"][:node]
236
-
237
- display "Enter an input tuple in JSON format i.e.{ \"url\" : \"foo.com\", \"html\" : \"bar.html\" }"
234
+ fields = @node_map[source]['fields'].map {|h| h.keys[0].upcase }
235
+ display "Enter an input tuple in the form : #{fields.join('1 ')}1 #{fields.join('2 ')}2 ..."
238
236
  msg = ask
237
+
238
+ if msg != "end"
239
+ args = msg.split(' ')
240
+ if (args.length % fields.length != 0)
241
+ display "Error: Argument length must be a multiple of the schema length"
242
+ next
243
+ end
244
+ end
245
+
239
246
  # Send tuple to source
240
247
  @operation_pipes[source]["wr_parent_1"].puts msg
241
248
  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.23
4
+ version: 0.1.24
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-31 00:00:00.000000000 Z
11
+ date: 2014-08-02 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,16 +173,9 @@ executables:
173
173
  extensions: []
174
174
  extra_rdoc_files: []
175
175
  files:
176
- - Gemfile
177
- - LICENSE
178
- - README.md
179
176
  - bin/zb
180
177
  - bin/zbd
181
178
  - bin/zillabyte
182
- - lib/#zillabyte-cli.rb#
183
- - lib/zillabyte-cli.rb
184
- - lib/zillabyte-cli/version.rb
185
- - lib/zillabyte/api.rb
186
179
  - lib/zillabyte/api/apps.rb
187
180
  - lib/zillabyte/api/base.rb
188
181
  - lib/zillabyte/api/components.rb
@@ -196,10 +189,8 @@ files:
196
189
  - lib/zillabyte/api/settings.rb
197
190
  - lib/zillabyte/api/sources.rb
198
191
  - lib/zillabyte/api/zillalogs.rb
192
+ - lib/zillabyte/api.rb
199
193
  - lib/zillabyte/auth.rb
200
- - lib/zillabyte/cli.rb
201
- - lib/zillabyte/cli/#logs.rb#
202
- - lib/zillabyte/cli/#repl.rb#
203
194
  - lib/zillabyte/cli/apps.rb
204
195
  - lib/zillabyte/cli/auth.rb
205
196
  - lib/zillabyte/cli/base.rb
@@ -224,68 +215,67 @@ files:
224
215
  - lib/zillabyte/cli/templates/apps/python/app.py
225
216
  - lib/zillabyte/cli/templates/apps/python/requirements.txt
226
217
  - lib/zillabyte/cli/templates/apps/python/zillabyte.conf.yaml
218
+ - lib/zillabyte/cli/templates/apps/ruby/app.rb.erb
227
219
  - lib/zillabyte/cli/templates/apps/ruby/Gemfile
228
220
  - lib/zillabyte/cli/templates/apps/ruby/README.md
229
- - lib/zillabyte/cli/templates/apps/ruby/app.rb.erb
230
221
  - lib/zillabyte/cli/templates/apps/ruby/zillabyte.conf.yaml
231
222
  - lib/zillabyte/cli/templates/components/js/simple_function.js
232
223
  - lib/zillabyte/cli/templates/components/js/zillabyte.conf.yaml
233
224
  - lib/zillabyte/cli/templates/components/python/component.py
234
225
  - lib/zillabyte/cli/templates/components/python/requirements.txt
235
226
  - lib/zillabyte/cli/templates/components/python/zillabyte.conf.yaml
236
- - lib/zillabyte/cli/templates/components/ruby/Gemfile
237
227
  - lib/zillabyte/cli/templates/components/ruby/component.rb.erb
228
+ - lib/zillabyte/cli/templates/components/ruby/Gemfile
238
229
  - lib/zillabyte/cli/templates/components/ruby/zillabyte.conf.yaml
239
- - lib/zillabyte/cli/templates/python/#simple_function.py#
240
230
  - lib/zillabyte/cli/untitled.md
241
231
  - lib/zillabyte/cli/version.rb
242
232
  - lib/zillabyte/cli/zillalogs.rb
233
+ - lib/zillabyte/cli.rb
243
234
  - lib/zillabyte/command.rb
244
- - lib/zillabyte/common.rb
245
235
  - lib/zillabyte/common/session.rb
246
236
  - lib/zillabyte/common/tar.rb
237
+ - lib/zillabyte/common.rb
247
238
  - lib/zillabyte/helpers.rb
248
239
  - lib/zillabyte/queries.rb
249
- - lib/zillabyte/runner.rb
250
240
  - lib/zillabyte/runner/app_runner.rb
251
241
  - lib/zillabyte/runner/component_operation.rb
252
242
  - lib/zillabyte/runner/component_runner.rb
253
243
  - lib/zillabyte/runner/multilang_operation.rb
254
244
  - lib/zillabyte/runner/operation.rb
255
- - zillabyte-cli.gemspec
245
+ - lib/zillabyte/runner.rb
246
+ - lib/zillabyte-cli/version.rb
247
+ - lib/zillabyte-cli.rb
248
+ - LICENSE
249
+ - README.md
256
250
  - zillabyte_emails.csv
257
251
  - zillaconf.json
252
+ - Gemfile
253
+ - zillabyte-cli.gemspec
258
254
  homepage: http://www.zillabyte.com
259
255
  licenses:
260
256
  - MIT
261
257
  metadata: {}
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
258
+ post_install_message: ! "\nGetting Started with Zillabyte\n==============================\n\n(1)
259
+ Register for an auth token at http://zillabyte.com\n(2) Log in by running 'zillabyte
260
+ login' in the command line\n(3) Build an empty app by running 'zillabyte apps:init'\n
261
+ \ Or... check out our Quick Starts by visiting http://docs.zillabyte.com/\n\nQuestions,
262
+ comments? Please visit us at http://docs.zillabyte.com\n"
273
263
  rdoc_options: []
274
264
  require_paths:
275
265
  - lib
276
266
  required_ruby_version: !ruby/object:Gem::Requirement
277
267
  requirements:
278
- - - ">="
268
+ - - ! '>='
279
269
  - !ruby/object:Gem::Version
280
270
  version: '0'
281
271
  required_rubygems_version: !ruby/object:Gem::Requirement
282
272
  requirements:
283
- - - ">="
273
+ - - ! '>='
284
274
  - !ruby/object:Gem::Version
285
275
  version: '0'
286
276
  requirements: []
287
277
  rubyforge_project:
288
- rubygems_version: 2.2.2
278
+ rubygems_version: 2.0.7
289
279
  signing_key:
290
280
  specification_version: 4
291
281
  summary: The Official Zillabyte CLI Gem
@@ -1,5 +0,0 @@
1
- require "zillabyte-cli/version"
2
- require "zillabyte/api"
3
- require "zillabyte/cli"
4
- require "zillabyte/common"
5
- require "zillabyte/queries"
@@ -1,12 +0,0 @@
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
@@ -1,43 +0,0 @@
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
@@ -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
- )