nist-pubid 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6cbdcaa4e1cfa7c75b6709f34cfd19670e8a3b2d3bd31473cbc5a5d439843b7
4
- data.tar.gz: 4dcb0a4b147990872fe4f72c8eecac96ba3a865bcaa477a5158404ab04fc8e42
3
+ metadata.gz: 1f6379a8019bfb88a5197b581ff3e479f76e4bc9d3c5c7305b8875c88aee54de
4
+ data.tar.gz: 8f6be1a669a2f215b846360fd7d475872a0ae084ba39b251e1a264636c2afc8c
5
5
  SHA512:
6
- metadata.gz: b6331d9887c149a7dbcf49c46a0ce7c121bf973cd239e3467658065820daf8c18f752e68b977d52e08155dfa2d947d9be5fa80bb431f462453ed337e02fc1616
7
- data.tar.gz: 35660adeef1ec90862ada64b2150162008d0b25cf01a8e9a7b15f909b6ac64265a04cc2bdf1da7ea9a7d08e99754eb8d49910de9d19119b4548b40f3870876db
6
+ metadata.gz: a3f46dfe0b0123faccd91f54133870800da21671b1487858e4121187eb15785d567303ab1e3883e6dc4f94e40b4b54ac8900745987c0c8c6ac79b4b6a8c294c8
7
+ data.tar.gz: 87c323d372da641c4d1ba4c1a8c7c7b7c15324b1a84ca8b31ca419b6debfe611f924d73f7299184ce55abf1f90a9b35baeedd62354f55b8319024975c9f9eac1
data/exe/nist-pubid CHANGED
@@ -10,17 +10,42 @@ class NistPubidCLI < Thor
10
10
  desc "report", "Create report for NIST Tech Pubs database (fetches from GitHub)"
11
11
  option :csv, type: :boolean, desc: "Export to CSV format"
12
12
  def report
13
+ heading = %w(
14
+ ID\ changed?
15
+ New\ PubID
16
+ Document\ ID
17
+ DOI\ changed?
18
+ New\ PubID-MR
19
+ DOI
20
+ Title
21
+ )
13
22
  if options[:csv]
23
+ puts heading.to_csv
24
+
14
25
  NistPubid::NistTechPubs.status.each do |doc|
15
- puts [doc[:finalPubId] == doc[:id] && doc[:mr] == doc[:doi] ? "-" : "+",
16
- doc[:finalPubId], doc[:id], doc[:doi], doc[:mr], doc[:title]]
17
- .to_csv
26
+ puts [
27
+ doc[:finalPubId] == doc[:id] ? false : true,
28
+ doc[:finalPubId],
29
+ doc[:id],
30
+ doc[:mr] == doc[:doi] ? false : true,
31
+ doc[:mr],
32
+ doc[:doi],
33
+ doc[:title]
34
+ ].to_csv
18
35
  end
19
36
  else
20
- puts "Changed | New PubID | Document ID | DOI | New MR | Title + subtitle"
37
+ puts heading.join(' | ')
38
+
21
39
  NistPubid::NistTechPubs.status.each do |doc|
22
- puts "#{doc[:finalPubId] == doc[:id] && doc[:mr] == doc[:doi] ? ' -' : '✅'}"\
23
- " | #{doc[:finalPubId]} | #{doc[:id]} | #{doc[:doi]} | #{doc[:mr]} | #{doc[:title]}"
40
+ puts [
41
+ doc[:finalPubId] == doc[:id] ? ' -' : '✅',
42
+ doc[:finalPubId],
43
+ doc[:id],
44
+ doc[:mr] == doc[:doi] ? ' -' : '✅',
45
+ doc[:mr],
46
+ doc[:doi],
47
+ doc[:title]
48
+ ].join(' | ')
24
49
  end
25
50
  end
26
51
  end
@@ -30,14 +55,14 @@ class NistPubidCLI < Thor
30
55
  desc: "Convert to PubID style (short|long|mr|abbrev)",
31
56
  default: "short"
32
57
  option :format, aliases: "-f", type: :string,
33
- desc: "Render in format (JSON, string)",
58
+ desc: "Render in format (json|string)",
34
59
  default: "string"
35
60
  def convert(code)
36
- unless %w[mr long short abbrev].include?(options[:style])
61
+ unless %w[mr long short abbrev].include?(options[:style].downcase)
37
62
  raise "Invalid PubID style"
38
63
  end
39
64
 
40
- raise "wrong conversion format" unless %w[string json].include? options[:format]
65
+ raise "Invalid render format" unless %w[string json].include? options[:format].downcase
41
66
 
42
67
  unless code.empty?
43
68
  if options[:format] == "string"
@@ -1,3 +1,3 @@
1
1
  module NistPubid
2
- VERSION = "0.1.6".freeze
2
+ VERSION = "0.1.7".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nist-pubid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.