Recently, Ruby
began to be thought of only as
Ruby on Rails . But in the world of Ruby there are still many beautiful and sometimes unique things. Therefore, in order to combat prejudice, I want to briefly tell you about the excellent and unusual Ruby projects.
Web
Nevertheless, Ruby is better known as a language for the Web. But Ruby on Rails is not the only framework.
Merb
Its main competitor is considered to be
Merb . It is
believed that he has a cleaner development and a beautiful API.
')
Firstly, it is not tied to any ORM or JavaScript framework. You can use jQuery or ExtJS. You can create websites without a database or use
Sequel to squeeze more speed. And this agnosticity immediately incorporated into the architecture and ideology.
Secondly, it is divided into sub-projects:
merb-core with the most important and
packages for specific tasks. Why do you need a script for generating a project on the server?
Third, it's a bit
faster than Ruby on Rails. There is even an opinion that its speed can already be compared with the speed of PHP
with the framework . Of course this is debatable, but maybe it will be faster on your task? :)
Many people like the implementation of
slice when you need to write an MVC module and an implementation of
authentication . Plus, plug-ins for Merb are just gems.
Of course, holy war «Rails vs. Merb ”is a meaningless undertaking, but it’s worth seeing Merb anyway — what if you like it.
Sinatra
Sinatra is
DSL for the Web. Formally, only the routing system is ideal for a minimalist :). Let the code say for me:
require 'rubygems'
require 'sinatra'
get '/' do
@name = request.cookies ["name"]
erb: index
end
post '/: name' do
set_cookie "name", params [: name]
redirect '/'
end
Its
speed is quite consistent with the amount of code;). If you are writing a small project, take a look at Sinatra.
Other
Ramaze ,
Camping and
many others will remain outside the article. See them yourself :).
ORM
Here in brief:
DataMapper refers to ActiveRecord, like Merb to Ruby on Rails. Slightly faster,
more beautiful in places, also divided into sub-projects. With Merb, they even "share" part of the code -
extlib .
Sequel is not even ORM, but rather
DSL for easier SQL writing. Therefore, it is much faster.
Scripts
Of course, most of the Linux scripts are written in Bash. But Ruby is a great candidate for writing your own personal scripts (for example, for some special photo album organization). It has a concise syntax and a convenient API for working with the environment: to call a command, you only need to specify it inside
`` , and
IO.popen is very convenient to read the command response. And the presence of an interactive Ruby-console is very useful for development and debugging.
Rake is a beautiful syntax for building applications - more compact and understandable Ant'a and Make.
Also look at
Sake and
Thor , as an “alternative” to Rake.
Java
If you have tedious and speed-critical Java code (for example, a GUI description or tests), then why not take a look at
JRuby ? Often, you can write 40–60% of the code in Ruby and especially without losing its execution speed (but at the same time increasing the programming speed and moral pleasure). At least for prototyping it will be very convenient. For example, beautiful
APIs were created for the GUI, and for testing you can use the good old
DSL RSpec .
The guys from pure Ruby can also take a look across the bridge. JRuby: Swing is a very good cross-platform GUI, and in the Java world there are many already well-functioning
Processing type libraries.
Shoes
Once we touched on the topic of GUI, we can not recall
Shoes . It
does not confess that the interface for each OS should look like its own. On the contrary, as in the Web, each program must have its own. There are a
lot of apps on Shoes
, but I especially liked the Hackety Hack .
Hackety Hack is still cool, albeit on XUL :).
Ruby Arduino Development
Well, at the end of the most unexpected - embedded applications :). I do not know how, but the guys were using
RAD to write under the
Arduino microcontrollers. Of course with the help of beautiful
DSL .
The craziest project on RAD is the
bartender with a nice Ruby syntax:
drink 'Screwdriver' do
serve_in 'Highball Glass'
ingredients do
2.ounces: vodka
5.ounces: orange_juice
end
end
PS: Of course, these are not all interesting projects. If you know a couple of interesting things - write about them, their developers will be glad you :).