# ditzyshoes.rb
# Yo. I ended up a bit distracted by all the fun metaprogramming
# stuff and (as usual) completely failed to make anything useful
# but this could be the start of something cool.
# Dont forget to fill out the two constants at the top. >:)
class Ditz < Shoes
SHOES_DIR = "d:\\code\\shoes"
DITZ_COMMAND = "rubyw c:\\ruby\\bin\\ditz"
COMMANDS = ["log", "todo", "releases", "help"]
url '/', :index
COMMANDS.each do |command|
url "/#{command}", command.to_sym
end
def index
stack do
banner "Shoes - ditz!"
COMMANDS.each do |command|
para link( command, :click => "/#{command}")
end
end
end
COMMANDS.each do |command|
self.class_eval <<-EOS
def #{command}
stack do
para link("back", :click => "/")
para generate("#{command}"), :font => "Monospace 12px"
para link("back", :click => "/")
end
end
EOS
end
def generate command
output = []
Dir.chdir SHOES_DIR
IO.popen( "#{DITZ_COMMAND} #{command}", "rb" ) do |pipe|
pipe.each_line {|line| output.push line}
end
return output.join.chomp!
end
end
Shoes.app :title => "ditz"
# -Harold