arvados-cli 0.1.20140117103233 → 0.1.20140127131755
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/arv +64 -36
- metadata +103 -134
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 70b66c41cd68bee38374544c42e1aa3f0ce48ce8
|
4
|
+
data.tar.gz: 70a9c5b4e4bd49af7ad8329369ba1de5d99f828e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b34407028dfdc9492b41b057a0e729ef3674cda5f496e88045d694313d8c56bbbf0bdd551558a22dedadd7d8e74e9d39c946967f6d4a7fe2232d83450e6155aa
|
7
|
+
data.tar.gz: 9d0b7e520f0107c735854e0478de8b3499491d528209c645a5d751d92e834bbeee6aa1be3287482f85aecd78f0c60a523288fe58d9ea0828f342dd8a48b2d2d5
|
data/bin/arv
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
#
|
5
5
|
# Ward Vandewege <ward@clinicalfuture.com>
|
6
6
|
|
7
|
+
require 'fileutils'
|
8
|
+
|
7
9
|
if RUBY_VERSION < '1.9.3' then
|
8
10
|
abort <<-EOS
|
9
11
|
#{$0.gsub(/^\.\//,'')} requires Ruby version 1.9.3 or higher.
|
@@ -12,7 +14,7 @@ end
|
|
12
14
|
|
13
15
|
# read authentication data from ~/.config/arvados if present
|
14
16
|
lineno = 0
|
15
|
-
config_file = File.expand_path('~/.config/arvados')
|
17
|
+
config_file = File.expand_path('~/.config/arvados/settings.conf')
|
16
18
|
if File.exist? config_file then
|
17
19
|
File.open(config_file, 'r').each do |line|
|
18
20
|
lineno = lineno + 1
|
@@ -116,15 +118,23 @@ end
|
|
116
118
|
|
117
119
|
class Google::APIClient
|
118
120
|
def discovery_document(api, version)
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
121
|
+
api = api.to_s
|
122
|
+
return @discovery_documents["#{api}:#{version}"] ||=
|
123
|
+
begin
|
124
|
+
# fetch new API discovery doc if stale
|
125
|
+
cached_doc = File.expand_path '~/.cache/arvados/discovery_uri.json'
|
126
|
+
if not File.exist?(cached_doc) or (Time.now - File.mtime(cached_doc)) > 86400
|
127
|
+
response = self.execute!(:http_method => :get,
|
128
|
+
:uri => self.discovery_uri(api, version),
|
129
|
+
:authenticated => false)
|
130
|
+
FileUtils.makedirs(File.dirname cached_doc)
|
131
|
+
File.open(cached_doc, 'w') do |f|
|
132
|
+
f.puts response.body
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
File.open(cached_doc) { |f| JSON.load f }
|
137
|
+
end
|
128
138
|
end
|
129
139
|
end
|
130
140
|
|
@@ -152,7 +162,10 @@ def help_methods(discovery_document, resource, method=nil)
|
|
152
162
|
discovery_document["resources"][resource.pluralize]["methods"].
|
153
163
|
each do |k,v|
|
154
164
|
description = ''
|
155
|
-
|
165
|
+
if v.include? "description"
|
166
|
+
# add only the first line of the discovery doc description
|
167
|
+
description = ' ' + v["description"].split("\n").first.chomp
|
168
|
+
end
|
156
169
|
banner += " #{sprintf("%20s",k)}#{description}\n"
|
157
170
|
end
|
158
171
|
banner += "\n"
|
@@ -171,9 +184,10 @@ def help_resources(discovery_document, resource)
|
|
171
184
|
banner += "\n\n"
|
172
185
|
discovery_document["resources"].each do |k,v|
|
173
186
|
description = ''
|
174
|
-
|
175
|
-
|
176
|
-
|
187
|
+
resource_info = discovery_document["schemas"][k.singularize.capitalize]
|
188
|
+
if resource_info and resource_info.include?('description')
|
189
|
+
# add only the first line of the discovery doc description
|
190
|
+
description = ' ' + resource_info["description"].split("\n").first.chomp
|
177
191
|
end
|
178
192
|
banner += " #{sprintf("%30s",k.singularize)}#{description}\n"
|
179
193
|
end
|
@@ -188,25 +202,37 @@ end
|
|
188
202
|
|
189
203
|
def parse_arguments(discovery_document)
|
190
204
|
resource_types = Array.new()
|
191
|
-
resource_types << '--help'
|
192
205
|
discovery_document["resources"].each do |k,v|
|
193
206
|
resource_types << k.singularize
|
194
207
|
end
|
195
208
|
|
196
209
|
global_opts = Trollop::options do
|
197
|
-
|
210
|
+
version __FILE__
|
211
|
+
banner "arv: the Arvados CLI tool"
|
198
212
|
opt :dry_run, "Don't actually do anything", :short => "-n"
|
199
|
-
opt :verbose, "Print some things on stderr"
|
200
|
-
opt :
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
opt :
|
213
|
+
opt :verbose, "Print some things on stderr"
|
214
|
+
opt :format,
|
215
|
+
"Set the output format. Must be one of json (default), yaml or uuid.",
|
216
|
+
:type => :string,
|
217
|
+
:default => 'json'
|
218
|
+
opt :short, "Return only UUIDs (equivalent to --format=uuid)"
|
219
|
+
opt :resources, "Display list of resources known to this Arvados instance."
|
220
|
+
conflicts :short, :format
|
205
221
|
stop_on resource_types
|
206
222
|
end
|
207
|
-
|
223
|
+
|
224
|
+
unless %w(json yaml uuid).include?(global_opts[:format])
|
225
|
+
$stderr.puts "#{$0}: --format must be one of json, yaml or uuid."
|
226
|
+
$stderr.puts "Use #{$0} --help for more information."
|
227
|
+
abort
|
228
|
+
end
|
229
|
+
|
230
|
+
if global_opts[:short]
|
231
|
+
global_opts[:format] = 'uuid'
|
232
|
+
end
|
233
|
+
|
208
234
|
resource = ARGV.shift
|
209
|
-
if
|
235
|
+
if global_opts[:resources] or not resource_types.include?(resource)
|
210
236
|
help_resources(discovery_document, resource)
|
211
237
|
end
|
212
238
|
|
@@ -244,7 +270,6 @@ def parse_arguments(discovery_document)
|
|
244
270
|
required: is_required,
|
245
271
|
type: :string
|
246
272
|
}
|
247
|
-
discovered_params[resource.to_sym] = body_object
|
248
273
|
end
|
249
274
|
end
|
250
275
|
|
@@ -323,18 +348,21 @@ if results["errors"] then
|
|
323
348
|
abort "Error: #{results["errors"][0]}"
|
324
349
|
end
|
325
350
|
|
326
|
-
|
351
|
+
case global_opts[:format]
|
352
|
+
when 'json'
|
327
353
|
puts Oj.dump(results, :indent => 1)
|
328
|
-
|
354
|
+
when 'yaml'
|
329
355
|
puts results.to_yaml
|
330
|
-
elsif global_opts[:json] then
|
331
|
-
puts Oj.dump(results)
|
332
|
-
elsif results["items"] and results["kind"].match /list$/i
|
333
|
-
results['items'].each do |i| puts i['uuid'] end
|
334
|
-
elsif results['uuid'].nil?
|
335
|
-
abort("Response did not include a uuid:\n" +
|
336
|
-
Oj.dump(results, :indent => 1) +
|
337
|
-
"\n")
|
338
356
|
else
|
339
|
-
|
357
|
+
if results["items"] and results["kind"].match /list$/i
|
358
|
+
results['items'].each do |i| puts i['uuid'] end
|
359
|
+
elsif results['uuid'].nil?
|
360
|
+
abort("Response did not include a uuid:\n" +
|
361
|
+
Oj.dump(results, :indent => 1) +
|
362
|
+
"\n")
|
363
|
+
else
|
364
|
+
puts results['uuid']
|
365
|
+
end
|
340
366
|
end
|
367
|
+
|
368
|
+
|
metadata
CHANGED
@@ -1,181 +1,150 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: arvados-cli
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 20140117103233
|
10
|
-
version: 0.1.20140117103233
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.20140127131755
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Arvados Authors
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: google-api-client
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 1
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 6
|
32
|
-
- 3
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
33
19
|
version: 0.6.3
|
34
20
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: activesupport
|
38
21
|
prerelease: false
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.6.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
49
33
|
version: 3.2.13
|
50
34
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: json
|
54
35
|
prerelease: false
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.2.13
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
65
47
|
version: 1.7.7
|
66
48
|
type: :runtime
|
67
|
-
version_requirements: *id003
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: trollop
|
70
49
|
prerelease: false
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.7.7
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: trollop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
81
62
|
type: :runtime
|
82
|
-
version_requirements: *id004
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: andand
|
85
63
|
prerelease: false
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: andand
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
96
75
|
version: 1.3.3
|
97
76
|
type: :runtime
|
98
|
-
version_requirements: *id005
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: oj
|
101
77
|
prerelease: false
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.3.3
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: oj
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
112
89
|
version: 2.0.3
|
113
90
|
type: :runtime
|
114
|
-
version_requirements: *id006
|
115
|
-
- !ruby/object:Gem::Dependency
|
116
|
-
name: curb
|
117
91
|
prerelease: false
|
118
|
-
|
119
|
-
|
120
|
-
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.0.3
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: curb
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
121
101
|
- - ~>
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
|
124
|
-
segments:
|
125
|
-
- 0
|
126
|
-
- 8
|
127
|
-
version: "0.8"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.8'
|
128
104
|
type: :runtime
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.8'
|
111
|
+
description: This is the Arvados SDK CLI gem, git revision 7c99060e90f027b77c82fd8c66902095197261af
|
112
|
+
email: gem-dev@curoverse.com
|
113
|
+
executables:
|
133
114
|
- arv
|
134
115
|
- arv-run-pipeline-instance
|
135
116
|
- arv-crunch-job
|
136
117
|
- arv-tag
|
137
118
|
extensions: []
|
138
|
-
|
139
119
|
extra_rdoc_files: []
|
140
|
-
|
141
|
-
files:
|
120
|
+
files:
|
142
121
|
- bin/arv
|
143
122
|
- bin/arv-run-pipeline-instance
|
144
123
|
- bin/arv-crunch-job
|
145
124
|
- bin/arv-tag
|
146
125
|
- bin/crunch-job
|
147
126
|
homepage: http://arvados.org
|
148
|
-
licenses:
|
127
|
+
licenses:
|
149
128
|
- Apache License, Version 2.0
|
129
|
+
metadata: {}
|
150
130
|
post_install_message:
|
151
131
|
rdoc_options: []
|
152
|
-
|
153
|
-
require_paths:
|
132
|
+
require_paths:
|
154
133
|
- lib
|
155
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
none: false
|
166
|
-
requirements:
|
167
|
-
- - ">="
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
hash: 3
|
170
|
-
segments:
|
171
|
-
- 0
|
172
|
-
version: "0"
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
173
144
|
requirements: []
|
174
|
-
|
175
145
|
rubyforge_project:
|
176
|
-
rubygems_version: 1.
|
146
|
+
rubygems_version: 2.1.11
|
177
147
|
signing_key:
|
178
|
-
specification_version:
|
148
|
+
specification_version: 4
|
179
149
|
summary: Arvados SDK CLI
|
180
150
|
test_files: []
|
181
|
-
|