zillabyte-cli 0.9.45 → 0.9.46
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/zillabyte-cli/version.rb +1 -1
- data/lib/zillabyte/cli/data.rb +0 -2
- data/lib/zillabyte/cli/download.rb +1 -1
- data/lib/zillabyte/helpers.rb +26 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzcxYzBiOTMxYTBjOThhOTliNzFhNzFlMGMwZDM1YjY1ZWIzMDk4Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjAwODliYjIzNTAxODE4N2IwNGIzNjcwYjFhOWY5NTMwYTBjZGU3OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTU4OTg0Yjc1MGE1NWZlZTI5YTg2OTA3Y2E3OGEzZjdkZWM1ODIyODkwMGFl
|
10
|
+
ZjY1NjEwZjBkZWM1MzFlZmMxNjVmYzcxNGYyMjlhNTdkYzIwZjk1NjM2MWUz
|
11
|
+
MjE4MjE2ZDRhMTcwMzg0Nzk1OTdmMTk0NjBjNDJjNzY1OTI4YzE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWE2OGFjYmM3YWYxNGE4MWU3NjY3MzUyYWU4MmY2ZmRhYzViMzVmMjI0ZDg0
|
14
|
+
ZmM1ODA1ZjE4YzM0NGJkOGMxMjg2NGFiOGMwZjcwYTc4MTU4ZjE4ZWM0YTRk
|
15
|
+
YzBkNmMzZDBiMmQ2MzU5MDM4YzUxNDhhZjg0MTNjYzEwYjFiZTg=
|
data/lib/zillabyte/cli/data.rb
CHANGED
@@ -291,8 +291,6 @@ class Zillabyte::Command::Data < Zillabyte::Command::Base
|
|
291
291
|
error("no id given", type) if id.nil?
|
292
292
|
error("no file given", type) if file.nil?
|
293
293
|
|
294
|
-
file = "#{file}.gz" unless File.extname(file) == ".gz"
|
295
|
-
|
296
294
|
res = self.api.data.pull(id, options)
|
297
295
|
|
298
296
|
handle_downloading_manifest(file, res, type)
|
data/lib/zillabyte/helpers.rb
CHANGED
@@ -172,9 +172,32 @@ module Zillabyte
|
|
172
172
|
def handle_downloading_manifest(file, res, type = nil)
|
173
173
|
require("open-uri")
|
174
174
|
if res["manifest"]
|
175
|
-
|
176
|
-
|
177
|
-
|
175
|
+
num_parts = res["manifest"].size
|
176
|
+
if res["decoder"].nil? or (type.nil? and res["decoder"] == "json")
|
177
|
+
require("csv")
|
178
|
+
file = "#{file}.csv" unless File.extname(file) == ".csv"
|
179
|
+
display("writing to #{file}")
|
180
|
+
|
181
|
+
f = CSV.open(file, "w")
|
182
|
+
res["manifest"].each_with_index do |uri, index|
|
183
|
+
display "\tdownloading part #{index}/#{num_parts}" unless type == "json"
|
184
|
+
open(uri) do |gz|
|
185
|
+
Zlib::GzipReader.new(gz).each_line do |line|
|
186
|
+
hash = JSON.parse(line)
|
187
|
+
values = []
|
188
|
+
res["schema"].each do |col|
|
189
|
+
values << hash[col.keys.first]
|
190
|
+
end
|
191
|
+
f << values
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
f.close
|
196
|
+
elsif type == res["decoder"] or (type.nil? and res["decoder"] == "csv")
|
197
|
+
file = "#{file}.gz" unless File.extname(file) == ".gz"
|
198
|
+
display("writing to #{file}")
|
199
|
+
|
200
|
+
f = File.open(file, "w")
|
178
201
|
res["manifest"].each_with_index do |uri, index|
|
179
202
|
display "\tdownloading part #{index}/#{num_parts}" unless type == "json"
|
180
203
|
f.write open(uri).read
|
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.9.
|
4
|
+
version: 0.9.46
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zillabyte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|