Hi,
I'm modifying the O'Reilly tutorial (
http://www.oreillynet.com/pub/a/ruby/2008/01/14/shoes-meets-merb-interfacing-a-gtk2-front-end-and-a-rails-web-service.html)
to
work with 'download' as a way to teach myself Shoes.

I've run into two small problems.
First, download doesn't seem to recognize 'localhost' in the URL (
http://localhost)
Second, download doesn't seem to recognize an alternate port in the URL (
http://0.0.0.0:4000)

And, the biggest problem, I can't figure out where 'download' is defined.

I'm running on Mac OS X 10.5, Shoes r925, and I've tried looking in the
Shoes.app package. Can someone point me in the right direction? I'd like to
be able to find where download is defined so I could understand what
parameters are permitted and how they need to be passed. Here's the code so
far. It works fine so long as the web server is using port 80. Any other
suggestions for how I should be doing this better are, of course,
appreciated.
Thanks,
Anthony

class ShoesPaste < Shoes

  class TooManyRedirects < StandardError; end

  BACKEND = 'http://localhost:4000'

  url '/', :index

  def index
    redirection_limit = 10
    stack :margin => 20 do
      title "Shoes Pastebin"
      download "http://127.0.0.1/pastes/index.yaml"; do |pasteyaml|
      # download "http://localhost/pastes/index.yaml"; do |pasteyaml|
      # download "http://127.0.0.1:4000/pastes/index.yaml"; do |pasteyaml|
      # download "http://localhost:4000/pastes/index.yaml"; do |pasteyaml|
        require 'yaml'
        para pasteyaml.response.body
        pastes = YAML.load(pasteyaml.response.body)

        pastes.sort_by{|p| p[:created_at]}.each do |paste|
          para link(paste[:title], :click => "/#{paste[:id]}")
        end
      end
    end
  end

  protected


end

Shoes.app :title => 'Shoes Pastebin Using Download', :width => 640, :height
=> 400

Reply via email to