<% REPOSITORY_FS_ROOT = '/var/www/code.l3ib.org/git' REPOSITORY_URL_ROOT = 'http://code.l3ib.org/?p=%s' TRAC_FS_ROOT = '/var/subversion/trac' TRAC_URL_ROOT = 'http://projects.l3ib.org/trac/%s' require 'etc' # returns an array of hashes; each hash has 'name', 'repository', 'description', # 'owner', 'trac' keys. def get_projects projects = [] Dir.entries(REPOSITORY_FS_ROOT).each do |entry| next if entry =~ /^\.\.?$/ fs_path = File.join(REPOSITORY_FS_ROOT, entry) next unless File.ftype(fs_path) == 'directory' project = {} project['name'] = entry.sub(/\.git$/, '') project['repository'] = sprintf(REPOSITORY_URL_ROOT, entry) project['owner'] = Etc.getpwuid(File.stat(fs_path).uid).name begin File.open File.join(fs_path, 'description') do |f| description = f.read.strip.sub(/\.$/, '') project['description'] = description end rescue Errno::ENOENT project['description'] = 'no description' end trac_fs_path = File.join(TRAC_FS_ROOT, project['name']) if File.exist? trac_fs_path project['trac'] = sprintf(TRAC_URL_ROOT, project['name']) end projects << project end projects end %> l3ib.org projects
a l3ib.org project list
<% projects = get_projects.sort do |a, b| a['name'] <=> b['name'] end projects.each do |project| puts "" puts "" puts "" puts "" end %>
" if File.exist? File.join("images", "#{project['name']}.png") puts "" end puts "" puts "#{project['name']}" puts "[repository]" if project.has_key? 'trac' puts "[trac]" end puts "

#{project['description']}

" puts "