aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2021-10-16 21:57:17 -0400
committerPaul Duncan <pabs@pablotron.org>2021-10-16 21:57:17 -0400
commit41b1a847284d870b6a592d12dfff289fc7e7da2d (patch)
tree50de5678e801275ffc9824b9c9515af30b725288
parent43423bbd2a5a5fd6ab8556cdbd44cfea2d9b5983 (diff)
downloadpablotron.org-41b1a847284d870b6a592d12dfff289fc7e7da2d.tar.bz2
pablotron.org-41b1a847284d870b6a592d12dfff289fc7e7da2d.zip
add bin/gen-projects.rb and data/projects.yaml
-rw-r--r--bin/gen-projects.rb51
-rw-r--r--data/projects.yaml127
2 files changed, 178 insertions, 0 deletions
diff --git a/bin/gen-projects.rb b/bin/gen-projects.rb
new file mode 100644
index 0000000..ef4c547
--- /dev/null
+++ b/bin/gen-projects.rb
@@ -0,0 +1,51 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# gen-projects.rb: generate front matter from list of projects in
+# data/projects.yaml.
+#
+# Note: running this will blindly overwrite the contents of
+# content/projects/$PROJECT.md!
+#
+
+# load libraries
+require 'yaml'
+
+# build absolute paths to source projects.yaml and absolute path to
+# content/projects directory
+YAML_PATH = File.join(__dir__, '..', 'data', 'projects.yaml')
+PROJECTS_DIR = File.join(__dir__, '..', 'content', 'projects')
+
+PROJECT_TMPL = '
+---
+title: "%<name>s"
+slug: "%<slug>s"
+active: %<active>s
+repo: "%<repo>s"
+text: "%<text>s"
+---
+%<text>s
+'.strip
+
+#
+# write front matter for project to projects directory
+#
+def write_project(row)
+ # build absolute path to destination file
+ path = File.expand_path(File.join(PROJECTS_DIR, row['slug'])) + '.md'
+
+ # generate and write body
+ File.write(path, PROJECT_TMPL % {
+ name: row['name'],
+ slug: row['slug'],
+ active: !row['old'],
+ repo: row['repo'],
+ text: row['text'],
+ })
+end
+
+# write projects in green threads, then join threads
+YAML.load(File.read(YAML_PATH)).map do |row|
+ Thread.new(row) { |row| write_project(row) }
+end.each { |th| th.join }
diff --git a/data/projects.yaml b/data/projects.yaml
new file mode 100644
index 0000000..7614647
--- /dev/null
+++ b/data/projects.yaml
@@ -0,0 +1,127 @@
+---
+# list of projects projects
+# (shamelessly stolen from jekyll backend)
+- name: Luigi Template
+ slug: luigi-template
+ repo: https://github.com/pablotron/luigi-template
+ text: "String templating library for Java, JavaScript, PHP, and Ruby."
+
+- name: SHA2
+ slug: sha2
+ repo: https://github.com/pablotron/sha2
+ text: "Self-contained C11 SHA-2 implementation."
+
+- name: Weather Sage
+ slug: weather-sage
+ repo: https://github.com/pablotron/weather-sage
+ text: "Command-line tool and Ruby library to get the weather forecast and current weather observations for a domestic US street address."
+
+- name: ZipStream-PHP
+ slug: zipstream-php
+ repo: https://github.com/pablotron/zipstream-php
+ text: "Streaming zip file generator for PHP."
+
+- name: FreeType2-Ruby
+ slug: ft2-ruby
+ text: "Freetype2 bindings for Ruby."
+ old: true
+
+- name: Imlib2-Ruby
+ slug: imlib2-ruby
+ text: "Imlib2 bindings for Ruby."
+ old: true
+
+- name: Raggle
+ slug: raggle
+ text: "Command-line RSS aggregator."
+ old: true
+
+- name: Bash Tweaks
+ slug: bash-tweaks
+ text: "My Bash shell config."
+ old: true
+
+- name: Bling
+ slug: bling
+ text: "bling description"
+ old: true
+
+- name: DBD-Google-ruby
+ slug: dbd-google-ruby
+ text: "dbd-google-ruby description"
+ old: true
+
+- name: EasingJS
+ slug: easing-js
+ text: "Easing animations for JavaScript."
+ old: true
+
+- name: Easy Cookie
+ slug: easy-cookie
+ text: "Easy cookie manipulation in JavaScript"
+ old: true
+
+- name: FAM-ruby
+ slug: fam-ruby
+ text: "File Alteration Monitor (FAM) bindings for Ruby."
+ old: true
+
+- name: FreshMeat-Ruby
+ slug: freshmeat-ruby
+ text: "Freshmeat.net API bindings for Ruby."
+ old: true
+
+- name: HoneyPot-PHP
+ slug: honeypot-php
+ text: "honeypot-php description"
+ old: true
+
+- name: Joggle
+ slug: joggle
+ text: "joggle description"
+ old: true
+
+- name: Joystick-Ruby
+ slug: joystick-ruby
+ text: "joystick-ruby description"
+ old: true
+
+- name: LocalFark
+ slug: localfark
+ text: "localfark description"
+ old: true
+
+- name: MB-Ruby
+ slug: mb-ruby
+ text: "MusicBrainz bindings for Ruby."
+ old: true
+
+- name: PersistJS
+ slug: persist-js
+ text: "Persistent storage for JavaScript."
+ old: true
+
+- name: Rubilicious
+ slug: rubilicious
+ text: "del.icio.us API bindings for Ruby."
+ old: true
+
+- name: Syndic8-Ruby
+ slug: syndic8-ruby
+ text: "syndic8.net API bindings for Ruby."
+ old: true
+
+- name: Technorati-Ruby
+ slug: technorati-ruby
+ text: "technorati.net API bindings for Ruby."
+ old: true
+
+- name: Wirble
+ slug: wirble
+ text: "IRB syntax highlighting and saner defaults."
+ old: true
+
+- name: XMMS-Ruby
+ slug: xmms-ruby
+ text: "XMMS bindings for Ruby."
+ old: true