A curated list of libraries & SDKs for the Bluesky API and AT Protocol

added an option to refresh metadata only for one section

+13 -7
+1 -1
Rakefile
··· 2 3 task :fetch_metadata do 4 import = MetadataImport.new 5 - import.run 6 end
··· 2 3 task :fetch_metadata do 4 import = MetadataImport.new 5 + import.run(language: ENV['LANGUAGE']) 6 end
+12 -6
lib/metadata_import.rb
··· 4 OUTPUT_FILE = '_data/github_info.yml' 5 PROJECTS_DIR = '_data/projects' 6 7 - def run 8 - urls = get_repo_urls 9 importers = [GithubImport.new] 10 - data = {} 11 12 urls.each do |url| 13 if imp = importers.detect { |i| i.url_matches?(url) } ··· 18 end 19 end 20 21 - output_path = File.join(__dir__, '..', OUTPUT_FILE) 22 File.write(output_path, YAML.dump(data)) 23 end 24 25 - def get_repo_urls 26 - yamls = Dir[File.join(__dir__, '..', '_data', 'projects', '*.yml')] 27 yamls.map { |x| YAML.load(File.read(x))['repos'] }.flatten.map { |x| x['url'] } 28 end 29 end
··· 4 OUTPUT_FILE = '_data/github_info.yml' 5 PROJECTS_DIR = '_data/projects' 6 7 + def run(language: nil) 8 + output_path = File.join(__dir__, '..', OUTPUT_FILE) 9 + 10 + if language 11 + data = YAML.load_file(output_path, permitted_classes: [Time]) 12 + else 13 + data = {} 14 + end 15 + 16 + urls = get_repo_urls(language) 17 importers = [GithubImport.new] 18 19 urls.each do |url| 20 if imp = importers.detect { |i| i.url_matches?(url) } ··· 25 end 26 end 27 28 File.write(output_path, YAML.dump(data)) 29 end 30 31 + def get_repo_urls(language = nil) 32 + yamls = Dir[File.join(__dir__, '..', '_data', 'projects', language ? "#{language}.yml" : '*.yml')] 33 yamls.map { |x| YAML.load(File.read(x))['repos'] }.flatten.map { |x| x['url'] } 34 end 35 end