Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > ruby without framework

Reply
Thread Tools

ruby without framework

 
 
Mohammed Rashad
Guest
Posts: n/a
 
      09-07-2010
[Note: parts of this message were removed to make it a legal post.]

Can I use ruby code running in web browser without any frameworks used?
Also anyone please tell me how to make framework, Please give me some tips
or spark to start with.
I need to make a new framework because I need to re-use the ruby code
(actually shares the code) for desktop version and the new framework.

Is that possible?

--
Rashad

 
Reply With Quote
 
 
 
 
saurabh purnaye
Guest
Posts: n/a
 
      09-07-2010
[Note: parts of this message were removed to make it a legal post.]

Hi Rashad,
For start you may use tiny frameworks, which you can use to study to create
framework.
Sinatra, Camping, Rack etc are the examples.
--
Thanks and Regards
Saurabh Purnaye
+91-9922071155
skype: sorab_pune
yahoo & gtalk: saurabh.purnaye
msn: http://www.velocityreviews.com/forums/(E-Mail Removed)
--
please don't print this e-mail unless you really need to.


On Tue, Sep 7, 2010 at 9:31 PM, Mohammed Rashad
<(E-Mail Removed)>wrote:

> Can I use ruby code running in web browser without any frameworks used?
> Also anyone please tell me how to make framework, Please give me some tips
> or spark to start with.
> I need to make a new framework because I need to re-use the ruby code
> (actually shares the code) for desktop version and the new framework.
>
> Is that possible?
>
> --
> Rashad
>


 
Reply With Quote
 
 
 
 
Martin DeMello
Guest
Posts: n/a
 
      09-07-2010
On Tue, Sep 7, 2010 at 9:31 PM, Mohammed Rashad
<(E-Mail Removed)> wrote:
> Can I use ruby code running in web browser without any frameworks used?
> Also anyone please tell me how to make framework, Please give me some tips
> or spark to start with.
> I need to make a new framework because I need to re-use the ruby code
> (actually shares the code) for desktop version and the new framework.


Check out rack [http://rack.rubyforge.org/] - it's not a framework so
much as an interface that lets your app communicate with a webserver.

Also, what I've done in the past when I needed to share ruby code
between a desktop and web ui is to put most of it in libraries, and
have a small sinatra app that used those libraries.

martin

 
Reply With Quote
 
Brian Candler
Guest
Posts: n/a
 
      09-07-2010
Mohammed Rashad wrote:
> Can I use ruby code running in web browser without any frameworks used?


The key thing to think about is, how does an incoming HTTP request end
up being processed by your ruby code? There are several options.

(1) Probably the most common option is to run a webserver written *in*
ruby (e.g. webrick), or in a combination of ruby and C (e.g. mongrel,
thin, unicorn). They will make a call to your code when the request
comes in.

Your app runs as a separate process, and listens on its own TCP socket.
So your URL might be something like http://x.x.x.x:4567/

If desired, you can proxy to this from another webserver in front.

(2) You can run Apache or Nginx with Phusion Passenger, a.k.a.
mod_rails. This integrates into the webserver, starting ruby processes
as necessary and passing HTTP requests to them using the Rack API.

(3) Your webserver can run your ruby script as a CGI, which means it
starts a new process running your script for each incoming request,
passing the request on STDIN and the headers in environment variables,
and getting the response on STDOUT. This is inefficient because it
involves starting a whole new ruby interpreter for each request. It
becomes extremely inefficient if your ruby code in turn loads lots of
other ruby libraries.

(4) There are some other options like FastCGI and SCGI, rarely used now.

Fortunately, all these options support mapping HTTP requests to the same
API: Rack. If you write your code using Rack, or any other framework
which sits on top of Rack (including Rails, Sinatra, Camping), then you
can run the same code under any of the above scenarios, just by changing
a config file.

> Also anyone please tell me how to make framework, Please give me some
> tips
> or spark to start with.
> I need to make a new framework because I need to re-use the ruby code
> (actually shares the code) for desktop version and the new framework.


That depends on what you mean by "framework". Normally "framework" means
code someone has already written, that you plug your customisations
into. You don't write a new framework from scratch, you just pick one
and extend it.

For code which is shared between a desktop app and a web app: just put
it in a library (lib/foo.rb) which can be used by either.

To be honest, if you write a good web app, you won't need a desktop one,
and it will save you a lot of pain installing graphic libraries and
frameworks. Everyone has a browser; just point it at localhost. This is
where the web server written *in* ruby comes into its own.

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete .NET FRAMEWORK 1.1 before installing .NET FRAMEWORK 2 ???? moi ASP .Net 3 09-26-2008 02:19 PM
Installing 1.1 Framework and 2.0 Framework on the same web server Mark ASP .Net 4 11-17-2005 03:30 PM
spring framework versus struts framework jrefactors@hotmail.com Java 2 09-11-2005 09:54 PM
microsoft.public.dotnet.faqs,microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.windowsforms,microsoft.public.dotnet.general,microsoft.public.dotnet.languages.vb Charles A. Lackman ASP .Net 1 12-08-2004 07:08 PM
COMInterop does not work in Framework 1.1 without Framework 1.0 Anatoly Volodko ASP .Net 1 08-14-2003 08:11 PM



Advertisments