The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Generating the home page

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Adam Green

Posts: 102
Nickname: darwinian
Registered: Dec, 2005

Adam Green is the author of Ruby.Darwinianweb.com
Generating the home page Posted: Jan 10, 2006 8:11 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Adam Green.
Original Post: Generating the home page
Feed Title: ruby.darwinianweb.com
Feed URL: http://www.nemesis-one.com/rss.xml
Feed Description: Adam Green's Ruby development site
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Adam Green
Latest Posts From ruby.darwinianweb.com

Advertisement
The RubyRiver home page can now be assembled from the page.html template.

gen_home.rb

 #! /usr/bin/ruby
require 'get_param'
require 'gen_items'
require 'gen_feedlist'



require "open-uri"
require "rexml/document"
include REXML
# Read the page template into memory.
pagestr = File.read("page.html")



# Replace the template tokens with the proper data.
pagestr = pagestr.gsub("<*sitetitle*>", get_param("rubyriver.yml","sitetitle"))
pagestr = pagestr.gsub("<*publishedfeed*>", get_param("rubyriver.yml","publishedfeed"))
pagestr = pagestr.gsub("<*sitedescription*>", get_param("rubyriver.yml","sitedescription"))
pagestr = pagestr.gsub("<*content*>", gen_items)
pagestr = pagestr.gsub("<*feedlist*>", gen_feedlist)



# Write the filled template out as the home page.
pagefile = File.new(get_param("rubyriver.yml","webdir")+"index.html", "w+")
pagefile.puts(pagestr)
pagefile.close



# Copy the current RSS file into the home directory.
feedname = get_param("rubyriver.yml","publishedfeed") + ".xml"
require 'ftools'
File.copy(feedname,get_param("rubyriver.yml","webdir") + feedname)

Read: Generating the home page

Topic: Revised config file Previous Topic   Next Topic Topic: The Slice Matcher

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use