Skip to content

Commit

Permalink
Generate projects.json and projects.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
artob committed Nov 12, 2024
1 parent 557f4e3 commit 3244dff
Show file tree
Hide file tree
Showing 3 changed files with 603 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require 'json'

PROJECTS = Dir['projects/**/*.json'].sort.freeze

task default: %w(projects.json projects.md)

file 'projects.json': PROJECTS do |t|
File.open(t.name, 'w') do |out|
out.puts JSON.pretty_unparse(projects(t.prerequisites))
end
end

file 'projects.md': PROJECTS do |t|
File.open(t.name, 'w') do |out|
out.puts "| Name | Description |"
out.puts "| :--- | :---------- |"
projects(t.prerequisites).each do |project|
project_name = project['name']
project_link = "[#{project_name}](#{project['homepage']})"
project_desc = project['shortdesc']['en']
out.puts "| " + [project_link, project_desc].join(" | ") + " |"
end
end
end

def projects(project_paths = PROJECTS)
project_paths.map do |project_path|
JSON.parse(File.read(project_path))
end
end
Loading

0 comments on commit 3244dff

Please sign in to comment.