Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Generate page from yaml file

  • Loading branch information...
commit 38c9f65a55dea9aada3c9f51536e71193eae9967 1 parent e6b1f3e
@weavejester authored
View
1  .gitignore
@@ -1,2 +1,3 @@
.sass-cache
css
+index.html
View
18 generate.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+require 'yaml'
+require 'erb'
+require 'set'
+
+projects = YAML.load_file("projects.yml").values
+
+@categories = Hash.new { |h, k| h[k] = [] }
+
+projects.each do |project|
+ @categories[project['category']] << project
+end
+
+template = ERB.new(File.read("src/index.html.erb"))
+
+File.open("index.html", "w") do |f|
+ f.write(template.result)
+end
View
34 projects.yml
@@ -0,0 +1,34 @@
+leiningen:
+ name: Leiningen
+ url: https://github.com/technomancy/leiningen
+ category: Build Tools
+
+cake:
+ name: Cake
+ url: https://github.com/ninjudd/cake
+ category: Build Tools
+
+ring_json_params:
+ name: ring-json-params
+ url: https://github.com/mmcgrana/ring-json-param
+ category: Ring Middleware
+
+ring_basic_authentication:
+ name: ring-basic-authentication
+ url: https://github.com/remvee/ring-basic-authenticatio
+ category: Ring Middleware
+
+ring_gzip_middleware:
+ name: ring-gzip-middleware
+ url: https://github.com/mikejs/ring-gzip-middleware
+ category: Ring Middleware
+
+enlive:
+ name: Enlive
+ url: https://github.com/cgrand/enlive
+ category: Template Languages
+
+hiccup:
+ name: Hiccup
+ url: https://github.com/weavejester/hiccup
+ category: Template Languages
View
26 index.html → src/index.html.erb
@@ -31,30 +31,16 @@
</div>
</header>
<div id="main">
+ <% @categories.sort.each do |category, projects| %>
<div class="category">
- <h2>Build Tools</h2>
+ <h2><%= category %></h2>
<ul>
- <li><a href="https://github.com/technomancy/leiningen">Leiningen</a></li>
- <li><a href="https://github.com/ninjudd/cake">Cake</a></li>
- </ul>
- </div>
-
- <div class="category">
- <h2>Ring Middleware</h2>
- <ul>
- <li><a href="https://github.com/mmcgrana/ring-json-params">ring-json-params</a></li>
- <li><a href="https://github.com/remvee/ring-basic-authentication">ring-basic-authentication</a></li>
- <li><a href="https://github.com/mikejs/ring-gzip-middleware">ring-gzip-middleware</a></li>
- </ul>
- </div>
-
- <div class="category">
- <h2>Templating Libraries</h2>
- <ul>
- <li><a href="https://github.com/cgrand/enlive">Enlive</a></li>
- <li><a href="https://github.com/weavejester/hiccup">Hiccup</a></li>
+ <% projects.each do |project| %>
+ <li><a href="<%= project['url'] %>"><%= project['name'] %></a></li>
+ <% end %>
</ul>
</div>
+ <% end %>
</div>
<footer></footer>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.