Cappuccino and Ruby question

5 views
Skip to first unread message

Calvin

unread,
Jan 4, 2010, 8:31:51 PM1/4/10
to Cappuccino & Objective-J
Hello again,

I am trying to get input from a CPTextField with a Ruby script. I have
learned how to do this with a CPURLRequest and a simple PHP script
(pasted below) and I want to do the same thing only with Ruby (and no
rails):

<?php
$input=$_GET["input"];
$output = "The number is: ".$input;
echo $output;
?>


I am having trouble figuring out what the Ruby equivalent to this PHP
code would be.

Any suggestions, hints, or links are greatly appreciated!

I would have posted this on the Ruby google group but I don't think
too many of those guys use Cappuccino.

Also- I'm not sure if this relevant but here is the link to the
Cappuccino/PHP tutorial:

http://fixinem.blogspot.com/2009/12/server-communication-tutorial-for.html


Thanks a bunch,

Calvin

Tom Robinson

unread,
Jan 4, 2010, 8:39:24 PM1/4/10
to objec...@googlegroups.com
PHP and Ruby are bit different in that there's not really a standard
way to execute Ruby files to render pages like you do with PHP (except
maybe CGI, but that's not recommended). Typically you have some kind
of framework like Rails or Sinatra (http://www.sinatrarb.com/) loaded
in a Ruby app server (Mongrel, etc, or something like Passenger), or
you can write applications that interface with a webserver via the raw
Rack (http://rack.rubyforge.org/) interface.

Sinatra is a nice simple framework. I'd recommend trying that if you
don't want the full Rails stack.

-tom

> --
>
> You received this message because you are subscribed to the Google
> Groups "Cappuccino & Objective-J" group.
> To post to this group, send email to objec...@googlegroups.com.
> To unsubscribe from this group, send email to objectivej+...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/objectivej?hl=en
> .
>
>

Calvin

unread,
Jan 4, 2010, 10:33:40 PM1/4/10
to Cappuccino & Objective-J

Thanks Tom! Have you seen any Cappuccino/Sinatra apps on Github that
are available to check out so I could get more of an idea on how to
get them to work well together?

It seems like you could do something like:

get '/:input' do
# some code here
end

in Sinatra and get something good going.


- Calvin

> >http://fixinem.blogspot.com/2009/12/server-communication-tutorial-for...

Reply all
Reply to author
Forward
0 new messages