relaton-cli 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaton/cli/command.rb +11 -1
- data/lib/relaton/cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b8db31870f272c13e8704dfb09b08a7e56ea703478db5683d72fccb3c92981a
|
4
|
+
data.tar.gz: 15fa2d2786a1c0d0f50054da7e7b0eb8a87a06b64cef492693938243534d9b75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ab548b6a6ffd205c9f549bea24e9620a13a8faa3dc9928b88368b085c2b7147add716e59c1efe8aa8137809a79c040ef305d6eb0529b9dfb131a419f24d76d3
|
7
|
+
data.tar.gz: fbb82682d1f7917d10148404ffa046adaed0048bbb330c840cad22a9f0c08fc80cc9c508febedb5355fe51c34656e24d28af6bf587a6d6a8f7585caa3695b06a
|
data/lib/relaton/cli/command.rb
CHANGED
@@ -8,6 +8,7 @@ module Relaton
|
|
8
8
|
class Command < Thor
|
9
9
|
desc "fetch CODE", "Fetch Relaton XML for Standard identifier CODE"
|
10
10
|
option :type, aliases: :t, required: true, desc: "Type of standard to get bibliographic entry for"
|
11
|
+
option :format, aliases: :f, desc: "Output format (xml, bibtex). Default xml."
|
11
12
|
option :year, aliases: :y, type: :numeric, desc: "Year the standard was published"
|
12
13
|
|
13
14
|
def fetch(code)
|
@@ -92,10 +93,19 @@ module Relaton
|
|
92
93
|
|
93
94
|
private
|
94
95
|
|
96
|
+
# @param code [String]
|
97
|
+
# @param options [Hash]
|
98
|
+
# @option options [String] :type
|
99
|
+
# @option options [String, NilClass] :format
|
100
|
+
# @option options [Integer, NilClass] :year
|
95
101
|
def fetch_document(code, options)
|
96
102
|
if registered_types.include?(options[:type])
|
97
103
|
doc = Cli.relaton.fetch(code, options[:year]&.to_s)
|
98
|
-
|
104
|
+
if doc
|
105
|
+
options[:format] == "bibtex" ? doc.to_bibtex : doc.to_xml
|
106
|
+
else
|
107
|
+
"No matching bibliographic entry found"
|
108
|
+
end
|
99
109
|
end
|
100
110
|
rescue RelatonBib::RequestError => e
|
101
111
|
e.message
|
data/lib/relaton/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|