Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew2net committed Oct 14, 2023
1 parent 4b64892 commit a0f08fa
Show file tree
Hide file tree
Showing 15 changed files with 52,153 additions and 51,962 deletions.
12 changes: 6 additions & 6 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,22 @@ end
----
# Fetch RFC document
item = RelatonIetf::IetfBibliography.get 'IETF RFC 8341'
[relaton-ietf] (IETF RFC 8341) fetching...
[relaton-ietf] (IETF RFC 8341) found `RFC 8341`
[relaton-ietf] (IETF RFC 8341) Fetching from Relaton repository ...
[relaton-ietf] (IETF RFC 8341) Found: `RFC 8341`
=> #<RelatonIetf::IetfBibliographicItem:0x007fd1875e7f58
...
# Fetch Internet-Draft document
RelatonIetf::IetfBibliography.get 'IETF I-D.draft-abarth-cake-01'
[relaton-ietf] (IETF I-D.draft-abarth-cake-01) fetching...
[relaton-ietf] (IETF I-D.draft-abarth-cake-01) found `draft-abarth-cake-01`
[relaton-ietf] (IETF I-D.draft-abarth-cake-01) Fetching from Relaton repository ...
[relaton-ietf] (IETF I-D.draft-abarth-cake-01) Found: `draft-abarth-cake-01`
=> #<RelatonIetf::IetfBibliographicItem:0x00007fdd129bbeb8
...
# Return nil if a document doesn't exist.
RelatonIetf::IetfBibliography.get 'IETF 1111'
[relaton-ietf] (IETF 1111) fetching...
[relaton-ietf] (IETF 1111) not found
[relaton-ietf] (IETF 1111) Fetching from Relaton repository ...
[relaton-ietf] (IETF 1111) Not found.
=> nil
----

Expand Down
2 changes: 1 addition & 1 deletion lib/relaton_ietf/ietf_bibliographic_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class IetfBibliographicItem < RelatonBib::BibliographicItem
# @param stream [String, nil]
def initialize(**args)
if args[:doctype] && !DOCTYPES.include?(args[:doctype])
Util.warn "WARNING: invalid doctype `#{args[:doctype]}`"
Util.warn "WARNING: Invalid doctype: `#{args[:doctype]}`"
end
@stream = args.delete(:stream)
super
Expand Down
6 changes: 3 additions & 3 deletions lib/relaton_ietf/ietf_bibliography.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ def search(text)
# reference is required
# @return [RelatonIetf::IetfBibliographicItem] Relaton of reference
def get(code, _year = nil, _opts = {})
Util.warn "(#{code}) fetching..."
Util.warn "(#{code}) Fetching from Relaton repository ..."
result = search code
if result
docid = result.docidentifier.detect(&:primary) || result.docidentifier.first
Util.warn "(#{code}) found `#{docid.id}`"
Util.warn "(#{code}) Found: `#{docid.id}`"
else
Util.warn "(#{code}) not found"
Util.warn "(#{code}) Not found."
end
result
end
Expand Down
2 changes: 1 addition & 1 deletion lib/relaton_ietf/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module RelatonIetf
VERSION = "1.16.1".freeze
VERSION = "1.16.2".freeze
end
2 changes: 1 addition & 1 deletion spec/relaton_ietf/ietf_bibliographic_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
it "warn if doctype is invalid" do
expect do
described_class.new doctype: "type"
end.to output(/\[relaton-ietf\] WARNING: invalid doctype `type`/).to_stderr
end.to output(/\[relaton-ietf\] WARNING: Invalid doctype: `type`/).to_stderr
end

context "render BibXML" do
Expand Down
8 changes: 4 additions & 4 deletions spec/relaton_ietf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@
end
end

it "get FYI" do
VCR.use_cassette "fyi_2" do
it "get FYI", vcr: "fyi_2" do
expect do
item = RelatonIetf::IetfBibliography.get "FYI 2"
expect(item.docidentifier[0].id).to eq "FYI 2"
end
end.to output(/\[relaton-ietf\] \(FYI 2\) Fetching from Relaton repository \.\.\./).to_stderr
end

it "get STD" do
Expand All @@ -99,7 +99,7 @@
VCR.use_cassette "error" do
expect do
RelatonIetf::IetfBibliography.get "CN 8341"
end.to output(/not found/).to_stderr
end.to output(/Not found\./).to_stderr
end
end

Expand Down
1 change: 1 addition & 0 deletions spec/support/vcr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
preserve_exact_body_bytes: true,
}
config.hook_into :webmock
config.configure_rspec_metadata!
end
38 changes: 19 additions & 19 deletions spec/vcr_cassettes/bcp_47.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions spec/vcr_cassettes/fyi_2.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions spec/vcr_cassettes/i_d_abarth_cake_01.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a0f08fa

Please sign in to comment.