File: make_www.rb

package info (click to toggle)
ruby-sequel 5.63.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,408 kB
  • sloc: ruby: 113,747; makefile: 3
file content (12 lines) | stat: -rwxr-xr-x 491 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env ruby
require 'erb'
$: << File.join(File.dirname(__FILE__), '..','lib', 'sequel')
require 'version'
Dir.chdir(File.dirname(__FILE__))
erb = ERB.new(File.read('layout.html.erb'))
Dir['pages/*.html.erb'].each do |page|
  public_loc = "#{page.gsub(/\Apages\//, 'public/').sub('.erb', '')}"
  content = content = ERB.new(File.read(page)).result(binding)
  title = title = File.basename(page.sub('.html.erb', ''))
  File.open(public_loc, 'wb'){|f| f.write(erb.result(binding))}
end