arvados-cli 0.1.20160513152536 → 0.1.20160608142315
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/arv +44 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5fc889cbdad1ec1ac89ed8674cf1499e90c20d4
|
4
|
+
data.tar.gz: aed390277dc320517d93fd8ab7b14da48b3b0a2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92372e41f978b51561327fba6bf9107e1291aac4d8dd36de024e8714399a1a9cd904f4713a28bdf663a34049de94b82c4c67e718b27c277b686a4ed0e28f601e
|
7
|
+
data.tar.gz: 11bef7ffe6f6f12c0c10e3739727d7376457069b547ce1d80953d16c7079b00fa4518ff68cf668eb09719d6df404fc6e7a8142feecb390f9f4ed244bf6d5958c
|
data/bin/arv
CHANGED
@@ -568,7 +568,11 @@ def parse_arguments(discovery_document, subcommands)
|
|
568
568
|
if body_object["required"] == false
|
569
569
|
is_required = false
|
570
570
|
end
|
571
|
-
|
571
|
+
resource_opt_desc = "Either a string representing #{resource} as JSON or a filename from which to read #{resource} JSON (use '-' to read from stdin)."
|
572
|
+
if is_required
|
573
|
+
resource_opt_desc += " This option must be specified."
|
574
|
+
end
|
575
|
+
opt resource.to_sym, resource_opt_desc, {
|
572
576
|
required: is_required,
|
573
577
|
type: :string
|
574
578
|
}
|
@@ -634,6 +638,45 @@ end
|
|
634
638
|
request_parameters = {_profile:true}.merge(method_opts)
|
635
639
|
resource_body = request_parameters.delete(resource_schema.to_sym)
|
636
640
|
if resource_body
|
641
|
+
# check if resource_body is valid JSON by attempting to parse it
|
642
|
+
resource_body_is_json = true
|
643
|
+
begin
|
644
|
+
# we don't actually need the results of the parsing,
|
645
|
+
# just checking for the JSON::ParserError exception
|
646
|
+
JSON.parse resource_body
|
647
|
+
rescue JSON::ParserError => e
|
648
|
+
resource_body_is_json = false
|
649
|
+
end
|
650
|
+
resource_body_is_readable_file = false
|
651
|
+
# if resource_body is not valid JSON, it should be a filename (or '-' for stdin)
|
652
|
+
if resource_body == '-'
|
653
|
+
resource_body_is_readable_file = true
|
654
|
+
resource_body_file = $stdin
|
655
|
+
elsif File.readable? resource_body
|
656
|
+
resource_body_is_readable_file = true
|
657
|
+
resource_body_file = File.open(resource_body, 'r')
|
658
|
+
end
|
659
|
+
if resource_body_is_json and resource_body_is_readable_file
|
660
|
+
abort "Argument specified for option '--#{resource_schema.to_sym}' is both valid JSON and a readable file. Please consider renaming the file: '#{resource_body}'"
|
661
|
+
elsif !resource_body_is_json and !resource_body_is_readable_file
|
662
|
+
if File.exists? resource_body
|
663
|
+
# specified file exists but is not readable
|
664
|
+
abort "Argument specified for option '--#{resource_schema.to_sym}' is an existing file but is not readable. Please check permissions on: '#{resource_body}'"
|
665
|
+
else
|
666
|
+
# specified file does not exist
|
667
|
+
abort "Argument specified for option '--#{resource_schema.to_sym}' is neither valid JSON nor an existing file: '#{resource_body}'"
|
668
|
+
end
|
669
|
+
elsif resource_body_is_readable_file
|
670
|
+
resource_body = resource_body_file.read()
|
671
|
+
begin
|
672
|
+
# we don't actually need the results of the parsing,
|
673
|
+
# just checking for the JSON::ParserError exception
|
674
|
+
JSON.parse resource_body
|
675
|
+
rescue JSON::ParserError => e
|
676
|
+
abort "Contents of file '#{resource_body_file.path}' is not valid JSON: #{e}"
|
677
|
+
end
|
678
|
+
resource_body_file.close()
|
679
|
+
end
|
637
680
|
request_body = {
|
638
681
|
resource_schema => resource_body
|
639
682
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arvados-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.20160608142315
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arvados Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arvados
|
@@ -164,7 +164,7 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0.8'
|
167
|
-
description: Arvados command line tools, git commit
|
167
|
+
description: Arvados command line tools, git commit 548e0c54db524cb7317850d4dfd8f3ee0b93cdb0
|
168
168
|
email: gem-dev@curoverse.com
|
169
169
|
executables:
|
170
170
|
- arv
|