/
Rakefile
58 lines (49 loc) · 1.6 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require 'erb'
require 'tabulator'
require 'ostruct'
require 'yaml'
task :default => :index
desc "Rewrite index.html"
task :index do
AtomicObjectRb::Homepage.new.generate_index_html
end
task :clean do
rm_rf "assembled"
end
module AtomicObjectRb
class Homepage
def initialize
@title = "atomicobject.rb"
@header_html = File.read("page_header.html")
setup_generation_warning
@site = "http://atomicobject.github.com"
@projects = make_projects([
:name, :link, :description,
"Constructor", "#{@site}/constructor", "Initialization using named arguments",
"DIY", "#{@site}/diy", "Dependency injection using YAML",
# "Injection", "#{@site}/injection", "Dependency injection plugin for Rails",
"Publisher", "#{@site}/publisher", "Event firing and subscription management",
"Hardmock", "#{@site}/hardmock", "Strict, ordered mock objects and stubs",
"Minilab", "#{@site}/minilab", "Ruby interface to Measurement Computing's miniLAB 1008",
])
end
def generate_index_html
html = ERB.new(File.read("index.erb")).result(binding)
fname = "index.html"
File.open(fname,"w") do |f|
f.print html
end
puts "Wrote #{fname}"
end
private
def make_projects(args)
Tabulator.tabulate(3, args) do |p|
OpenStruct.new(p)
end
end
def setup_generation_warning
bar = "*" * 60
@generation_warning = "<!--\n#{bar}\n\nTHIS FILE GENERATED BY index.erb ... DO NOT EDIT\n\n#{bar}\n-->"
end
end
end