I have wondered this same thing. Sometimes a web framework isn't the
best option, but I know Ruby very well and I don't know PHP at all.
What would I have to do that I can just create a file called somepage.rb
with this in it:
<html>
<body>
<p>This is counting to 10: <%= 10.times { |n| print n+1, " " } %></p>
</body>
</html>
And just have to dump it into any old folder that Apache servers pages
in and have it served properly? Can I just do "sudo aptitude -y install
mod_ruby" and will it Just Work(tm)?
Just FYI, I released a framework called Vintage last night that's
based on the original idea of Merb: Erb templates with Mongrel (though
I've expanded that concept to allow for more template renderers). No
MVC, no big infrastructure: just clean, simple templating that can be
used for simple or complex pages. I'm going to port it to Rack soon
so you can use some deployment setups that are a little simpler than
Mongrel, but if you're not scared of a little setup (proxying,
Mongrel, pretty easy) then give it a spin.
If what you want is PHP-like, why don't you use PHP? You certainly
sound more attuned to the PHP style of web development as it is.
Why do something half-assed with one language what you can do probably
better in another language that has much more support for that style
of development, etc. You won't find as much documentation for Ruby web
development not employing MVC paradigms... it's almost a de-facto
standard of Ruby web development (not to say that it is the ultimate
(tm) way to developm, but that it is the preferred way).
Don't try to struggle and do something awkward, just go with the
natural choice for the job.
If you do want to learn Ruby, consider that the reason why Ruby is
preferable to the likes of PHP is because of good style, flexibility,
and good libraries and tools doing the heavy lifting for us with some
standards.
Deploying on servers isn't impossible, it's just not the same as
Apache. There's plenty of documentation and suggestions where to get
it done and how, so it's not going to be difficult to do.
Rails is a lot to learn and it's certainly not small, but there are
other options. Merb is in the same area with Rails with regards to
being bigger than smaller, but it's very clean, light weight, and
shouldn't be too different from Rails. There are other frameworks like
Ramaze, Sinatra, IOWA, etc.
I would highly recommend you reconsider your decision to not go with
an MVC approach and also reconsider the facts.
I have wondered this same thing. Sometimes a web framework isn't the
best option, but I know Ruby very well and I don't know PHP at all.
What would I have to do that I can just create a file called somepage.rb
with this in it:
And the good news is ... FRAMEWORKS DON'T HAVE TO EAT YOUR SOUL!
RoR is the *Most Popular* web framework for Ruby.
It is *not* the only framework. Some others are:
I would recommend looking around and seeing if any one of the dozens
of current frameworks would work for you. They aren't all huge. They
aren't all slow. They don't all have the same (or any) notion of MVC.
In the end I would avoid using PHP at all costs (unless dictated due
to server resources or monetary pay) because I hate that wretched
language. And, I would look at a framework which offers--it doesn't
need to mandate--an MVC architecture or other method of separating
HTML and code. Even if you don't [want to] use it now, having the
option may allow for a cleaner transition....
Rails is a lot to learn and it's certainly not small, but there are
other options. Merb is in the same area with Rails with regards to
being bigger than smaller, but it's very clean, light weight, and
shouldn't be too different from Rails. There are other frameworks like
Ramaze, Sinatra, IOWA, etc.
Just wanted to highlight this bit. Also Camping, Nitro, and probably
others I've forgotten.
Let me come out clear. I do not know PHP, neither i am a Php guy.
I am just like James Dinkel, who has explained his requirement above.
I am totally into plain Ruby. Not even rails.
I am looking for a solution where i can place the codes inline the HTML
file just like classic asp and Php.
Currently Rails is placing the codes inside HTML with ERB. I want to
place the codes same way either with include file or some other way...
But... Without Ruby on rails.
It would be better, if some one can point me out a working tutorial or
blog based on my requirement. I do not want to get tied up initially
with any of MVC.
as far as the language you choose, it all depends on what you want to do and how much you want to do.
If you just need some simple, quick things, PHP might be a better choice to get started and make things work.
If you are interested in more complex things, you will want to use some existing framework in any language to help things be structured and easier to maintain and add to.
The problem is, without experiencing several frameworks in several languages, it is difficult to compare them or even choose the right one for a particular project.
The web hosting provider you use, and features you get for the paid service level will determine some things for you.
All frameworks and languages will have a learning curve.
But again, if you just need some little things here and there, PHP might be the best approach in the beginning, since many of it's functions are quick, one-trick-ponies, and PHP is widely supported and easy to get started with for web development.
But if you need a lot of features, spend some time investigating a language/framework combination that will work for you.
It all depends on the specifics.
If you need to do a lot of sophisticated things, you might find PHP quickly becomes tedious to work with. Then look into Ruby or Python based frameworks that save you a lot of work in the long-run.
Generally speaking, web sites are not set-it-and-forget-it, they often require regular updates and changes.
Let me come out clear. I do not know PHP, neither i am a Php guy.
I am just like James Dinkel, who has explained his requirement above.
I am totally into plain Ruby. Not even rails.
I am looking for a solution where i can place the codes inline the HTML file just like classic asp and Php.
Currently Rails is placing the codes inside HTML with ERB. I want to place the codes same way either with include file or some other way... But... Without Ruby on rails.
It would be better, if some one can point me out a working tutorial or blog based on my requirement. I do not want to get tied up initially with any of MVC.
Hope i have cleared myself.
Thanks
SoftMind.
You can just use Erubis + Ruby + Apache with mod_fcgi or Mongrel
On Jan 5, 2008, at 2:03 AM, Softmind Technology wrote:
Hello All,
Let me come out clear. I do not know PHP, neither i am a Php guy.
I am just like James Dinkel, who has explained his requirement above.
I am totally into plain Ruby. Not even rails.
I am looking for a solution where i can place the codes inline the HTML
file just like classic asp and Php.
Currently Rails is placing the codes inside HTML with ERB. I want to
place the codes same way either with include file or some other way...
But... Without Ruby on rails.
It would be better, if some one can point me out a working tutorial or
blog based on my requirement. I do not want to get tied up initially
with any of MVC.
Rails is a lot to learn and it's certainly not small, but there are
other options. Merb is in the same area with Rails with regards to
being bigger than smaller, but it's very clean, light weight, and
shouldn't be too different from Rails. There are other frameworks like
Ramaze, Sinatra, IOWA, etc.
Just wanted to highlight this bit. Also Camping, Nitro, and probably
others I've forgotten.
On Jan 5, 2008 11:28 AM, James Britt <james.britt@gmail.com> wrote:
Giles Bowkett wrote:
>> Rails is a lot to learn and it's certainly not small, but there are
>> other options. Merb is in the same area with Rails with regards to
>> being bigger than smaller, but it's very clean, light weight, and
>> shouldn't be too different from Rails. There are other frameworks like
>> Ramaze, Sinatra, IOWA, etc.
>
> Just wanted to highlight this bit. Also Camping, Nitro, and probably
> others I've forgotten.
>
Here is a forum post that tells you how to embed ruby script into
webpages just like php does. This uses mod_ruby and eruby. It's
basically just apt install a couple packages and then add some Apache
configuration.
Read all the way through it as I think the configuration in the last
post is the best version. But I have not tried this myself yet, but it
looks like it is all legit and nothing stupid or extraneous is being
done.
This is not much different than mod_php. Really, the only difference is
that the mod_php install takes care of the apache configuration for you.
I just wish that the mod_ruby installation did the same thing. Just
install mod_ruby and the apache configuration would be taken care of.
Really all it would need is one file added to the deb installation
package. But for the time being, I guess at least it is possible to do.
I suggest you stay away from mod_ruby because it is not as clean as it
should. The 1.8 interpreter cannot be reset, and as Apache reuses
processes some stuff may leak from one script into another. Using with
the multithreaded Apache also won't be a big win as multiple Ruby
threads cannot run concurrently. You probably can't even create
multiple threads running ruby safely (as opposed to creating multiple
ruby threads inside one native thread of execution as is done in the
interpreter). You can use ruby as cgi scripts or with Mongrel or
something but mod_ruby is not the right way.
Thanks
Michal
···
On 07/01/2008, James Dinkel <jdinkel@bucoks.com> wrote:
Here is a forum post that tells you how to embed ruby script into
webpages just like php does. This uses mod_ruby and eruby. It's
basically just apt install a couple packages and then add some Apache
configuration.
Read all the way through it as I think the configuration in the last
post is the best version. But I have not tried this myself yet, but it
looks like it is all legit and nothing stupid or extraneous is being
done.
This is not much different than mod_php. Really, the only difference is
that the mod_php install takes care of the apache configuration for you.
I just wish that the mod_ruby installation did the same thing. Just
install mod_ruby and the apache configuration would be taken care of.
Really all it would need is one file added to the deb installation
package. But for the time being, I guess at least it is possible to do.
I suggest you stay away from mod_ruby because it is not as clean as it
should. The 1.8 interpreter cannot be reset, and as Apache reuses
processes some stuff may leak from one script into another.
This statement is completely fallacious. If you exercise just the minimum of programming discipline, you can easily write mod_ruby applications that run for months without any appreciable leakage. You certainly must take precautions against using global variables and poorly-namespaced classes, and mod_ruby is probably not suitable for running in an untrusted or shared environment without additional partitioning, but that doesn't describe the majority of situations.
I've been running several mod_ruby applications for a year and a half where I work that require restarts only for new code or bugfixes. They've gotten over 3 million dynamic hits since they were first deployed, which isn't exactly as much of a stress-test as some other sites, but enough to demonstrate the error in your generalizations.
Using with
the multithreaded Apache also won't be a big win as multiple Ruby
threads cannot run concurrently.
In addition to being specious, this means nothing in the context of your point.
You probably can't even create
multiple threads running ruby safely (as opposed to creating multiple
ruby threads inside one native thread of execution as is done in the
interpreter).
Please, if you must post advice against using a particular piece of software, please provide concrete evidence of its unsuitability. Conjecture is mildly interesting in some situations, but when you impugn someone else's hard work you should at least have the courtesy to give examples, hard facts, or at the very least stick to points which you don't have to qualify with "probably".
I'd be happy to provide further details if anyone's interested. I'm just getting tired of the FUD and hastily-posted conjecture about what constitutes appropriate technology for building web applications.
···
On Jan 7, 2008, at 7:16 AM, Michal Suchanek wrote:
--
Michael Granger <ged@FaerieMUD.org>
Rubymage, Architect, Believer
The FaerieMUD Consortium <http://www.FaerieMUD.org/>