ietf-data-importer 0.3.0
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 +7 -0
- data/.github/workflows/check_update.yml +44 -0
- data/.github/workflows/rake.yml +15 -0
- data/.github/workflows/release.yml +25 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +10 -0
- data/Gemfile +11 -0
- data/README.adoc +220 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/exe/ietf-data-importer +6 -0
- data/ietf-data-importer.gemspec +37 -0
- data/lib/ietf/data/importer/cli.rb +47 -0
- data/lib/ietf/data/importer/group.rb +42 -0
- data/lib/ietf/data/importer/group_collection.rb +19 -0
- data/lib/ietf/data/importer/groups.yaml +1745 -0
- data/lib/ietf/data/importer/scrapers/base_scraper.rb +33 -0
- data/lib/ietf/data/importer/scrapers/ietf_scraper.rb +272 -0
- data/lib/ietf/data/importer/scrapers/irtf_scraper.rb +350 -0
- data/lib/ietf/data/importer/scrapers.rb +64 -0
- data/lib/ietf/data/importer/version.rb +9 -0
- data/lib/ietf/data/importer.rb +93 -0
- metadata +126 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "scrapers/base_scraper"
|
4
|
+
require_relative "scrapers/ietf_scraper"
|
5
|
+
require_relative "scrapers/irtf_scraper"
|
6
|
+
require_relative "group_collection"
|
7
|
+
|
8
|
+
module Ietf
|
9
|
+
module Data
|
10
|
+
module Importer
|
11
|
+
# Module for IETF/IRTF web scrapers
|
12
|
+
module Scrapers
|
13
|
+
# Fetch all IETF and IRTF groups
|
14
|
+
# @return [Ietf::Data::Importer::GroupCollection] Collection of all groups
|
15
|
+
def self.fetch_all
|
16
|
+
puts "Starting to fetch IETF and IRTF group data..."
|
17
|
+
|
18
|
+
# Fetch IETF groups
|
19
|
+
ietf_groups = IetfScraper.new.fetch
|
20
|
+
puts "Fetched #{ietf_groups.size} IETF groups"
|
21
|
+
|
22
|
+
# Fetch IRTF groups
|
23
|
+
irtf_groups = IrtfScraper.new.fetch
|
24
|
+
puts "Fetched #{irtf_groups.size} IRTF groups"
|
25
|
+
|
26
|
+
# Combine all groups and return as a collection
|
27
|
+
all_groups = ietf_groups + irtf_groups
|
28
|
+
puts "Total: #{all_groups.size} groups"
|
29
|
+
|
30
|
+
Importer::GroupCollection.new(groups: all_groups)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Fetch IETF groups only
|
34
|
+
# @return [Array<Ietf::Data::Importer::Group>] Array of IETF groups
|
35
|
+
def self.fetch_ietf
|
36
|
+
IetfScraper.new.fetch
|
37
|
+
end
|
38
|
+
|
39
|
+
# Fetch IRTF groups only
|
40
|
+
# @return [Array<Ietf::Data::Importer::Group>] Array of IRTF groups
|
41
|
+
def self.fetch_irtf
|
42
|
+
IrtfScraper.new.fetch
|
43
|
+
end
|
44
|
+
|
45
|
+
# Save group collection to a file
|
46
|
+
# @param collection [Ietf::Data::Importer::GroupCollection] Group collection to save
|
47
|
+
# @param file_path [String] Path to the output file
|
48
|
+
# @param format [Symbol] Output format (:yaml or :json)
|
49
|
+
def self.save_to_file(collection, file_path, format = :yaml)
|
50
|
+
case format.to_sym
|
51
|
+
when :yaml
|
52
|
+
File.write(file_path, collection.to_yaml)
|
53
|
+
when :json
|
54
|
+
File.write(file_path, collection.to_json)
|
55
|
+
else
|
56
|
+
raise ArgumentError, "Unsupported format: #{format}"
|
57
|
+
end
|
58
|
+
|
59
|
+
puts "Saved #{collection.groups.size} groups to #{file_path}"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
require_relative "importer/version"
|
5
|
+
require_relative "importer/group_collection"
|
6
|
+
require_relative "importer/scrapers"
|
7
|
+
require_relative "importer/cli"
|
8
|
+
|
9
|
+
module Ietf
|
10
|
+
module Data
|
11
|
+
# Main module for IETF/IRTF group data importer
|
12
|
+
module Importer
|
13
|
+
class Error < StandardError; end
|
14
|
+
|
15
|
+
# Path to the groups data file
|
16
|
+
GROUPS_PATH = File.join(File.dirname(__FILE__), "importer", "groups.yaml")
|
17
|
+
|
18
|
+
# Load the groups if the file exists, otherwise return empty collection
|
19
|
+
def self.load_groups
|
20
|
+
if File.exist?(GROUPS_PATH)
|
21
|
+
GroupCollection.from_yaml(File.read(GROUPS_PATH))
|
22
|
+
else
|
23
|
+
GroupCollection.new(groups: [])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# All available groups
|
28
|
+
def self.groups
|
29
|
+
load_groups.groups
|
30
|
+
end
|
31
|
+
|
32
|
+
# Check if a group exists by abbreviation
|
33
|
+
def self.group_exists?(abbreviation)
|
34
|
+
!find_group(abbreviation).nil?
|
35
|
+
end
|
36
|
+
|
37
|
+
# Find a group by its abbreviation (case insensitive)
|
38
|
+
def self.find_group(abbreviation)
|
39
|
+
groups.find { |g| g.abbreviation.downcase == abbreviation.to_s.downcase }
|
40
|
+
end
|
41
|
+
|
42
|
+
# Get all IETF groups
|
43
|
+
def self.ietf_groups
|
44
|
+
groups.select { |g| g.organization == "ietf" }
|
45
|
+
end
|
46
|
+
|
47
|
+
# Get all IRTF groups
|
48
|
+
def self.irtf_groups
|
49
|
+
groups.select { |g| g.organization == "irtf" }
|
50
|
+
end
|
51
|
+
|
52
|
+
# Get all working groups (IETF)
|
53
|
+
def self.working_groups
|
54
|
+
groups.select { |g| g.type == "wg" }
|
55
|
+
end
|
56
|
+
|
57
|
+
# Get all research groups (IRTF)
|
58
|
+
def self.research_groups
|
59
|
+
groups.select { |g| g.type == "rg" }
|
60
|
+
end
|
61
|
+
|
62
|
+
# Get groups by type
|
63
|
+
def self.groups_by_type(type)
|
64
|
+
groups.select { |g| g.type.downcase == type.to_s.downcase }
|
65
|
+
end
|
66
|
+
|
67
|
+
# Get groups by area
|
68
|
+
def self.groups_by_area(area)
|
69
|
+
groups.select { |g| g.area&.downcase == area.to_s.downcase }
|
70
|
+
end
|
71
|
+
|
72
|
+
# Get active groups
|
73
|
+
def self.active_groups
|
74
|
+
groups.select { |g| g.status == "active" }
|
75
|
+
end
|
76
|
+
|
77
|
+
# Get concluded groups
|
78
|
+
def self.concluded_groups
|
79
|
+
groups.select { |g| g.status == "concluded" }
|
80
|
+
end
|
81
|
+
|
82
|
+
# Get all available group types
|
83
|
+
def self.group_types
|
84
|
+
groups.map(&:type).uniq.sort
|
85
|
+
end
|
86
|
+
|
87
|
+
# Get all available areas
|
88
|
+
def self.areas
|
89
|
+
groups.map(&:area).compact.uniq.sort
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ietf-data-importer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ribose Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-03-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lutaml-model
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.18'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.18'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yaml
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: |
|
70
|
+
ietf-data-importer offers reliable offline access to metadata for IETF working groups
|
71
|
+
and IRTF research groups. This provides a dependable alternative to the official
|
72
|
+
resources at https://tools.ietf.org/wg/ and https://irtf.org/groups, which may
|
73
|
+
experience downtime or connectivity issues.
|
74
|
+
email:
|
75
|
+
- open.source@ribose.com
|
76
|
+
executables:
|
77
|
+
- ietf-data-importer
|
78
|
+
extensions: []
|
79
|
+
extra_rdoc_files: []
|
80
|
+
files:
|
81
|
+
- ".github/workflows/check_update.yml"
|
82
|
+
- ".github/workflows/rake.yml"
|
83
|
+
- ".github/workflows/release.yml"
|
84
|
+
- ".gitignore"
|
85
|
+
- ".rubocop.yml"
|
86
|
+
- Gemfile
|
87
|
+
- README.adoc
|
88
|
+
- Rakefile
|
89
|
+
- bin/console
|
90
|
+
- bin/setup
|
91
|
+
- exe/ietf-data-importer
|
92
|
+
- ietf-data-importer.gemspec
|
93
|
+
- lib/ietf/data/importer.rb
|
94
|
+
- lib/ietf/data/importer/cli.rb
|
95
|
+
- lib/ietf/data/importer/group.rb
|
96
|
+
- lib/ietf/data/importer/group_collection.rb
|
97
|
+
- lib/ietf/data/importer/groups.yaml
|
98
|
+
- lib/ietf/data/importer/scrapers.rb
|
99
|
+
- lib/ietf/data/importer/scrapers/base_scraper.rb
|
100
|
+
- lib/ietf/data/importer/scrapers/ietf_scraper.rb
|
101
|
+
- lib/ietf/data/importer/scrapers/irtf_scraper.rb
|
102
|
+
- lib/ietf/data/importer/version.rb
|
103
|
+
homepage: https://github.com/metanorma/ietf-data-importer
|
104
|
+
licenses:
|
105
|
+
- BSD-2-Clause
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 3.0.0
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubygems_version: 3.5.22
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Offline access to IETF working groups and IRTF research groups metadata
|
126
|
+
test_files: []
|