Sven Fuchs
Recent Posts
-
Travis - an experimental, distributed CI server on Heroku
June 2010
We had the I18n gem tested on runcoderun, a great service for open source projects to run continous integration on the web, and this was working very well for us. Unfortunately runcoderun was taken down.
So I figured it should be easy to setup a few apps on Heroku and have them run the I18n test suite on different stacks (i.e. Ruby configurations on Heroku). It turns out it is not, apparently. Or I'm just too stupid to do it. Anyway I though I'd write things down so maybe someone else can pi...
-
Release your Gems with ease
April 2010
After the recent, somewhat heated discussion about whether or not to check in gemspecs to a repository, manually crafting versus autogenerating them, using a dynamic piece of code to collect relevant files versus maintaining a static files list in the gemspec file ... I've felt motivated to polish my own gem plugin that I've been using to publish my gems and finally add some of the functionality that I've been missing myself.
In short, I'm a happy resident in the camp of manually maintained ...
-
Aligning rubygems + bundler through rubylib environment variable
March 2010
Put this into your ~/.zprofile (or ~/.profile or whatever makes sense for your shell):
export RUBYLIB=$RUBYLIB:~/.ruby
Source the file:
$ source ~/.zprofile
Put this to ~/.ruby/b.rb
begin
# should probably check parent directories, too?
require File.expand_path('../.bundle/environment')
rescue LoadError
require 'rubygems'
require 'bundler'
Bundler.setup
end
Done.
You can now:
$ ruby -rb test/all.rb # run test/all.rb in the context of your bundle
$ ruby -rubygems t...
-
Experimental Ruby I18n extensions: Pluralization, Fallbacks, Gettext, Cache and Chained backend
July 2009
Backend::Simple < Backend::Base
In Ruby what is the most obvious, elegant and maintainable pattern to extend an existing class' or object's functionality? No, the answer to that is definitely *not* in using alias_method_chain. It's simply including a module to that class. You probably knew that already ;)
We've done this with the I18n Simple backend before but one needs to extend the Simple backend first in order to then inject additional modules to the inheritance chain so that thes...
-
Ruby I18n Gem hits 0.2.0
July 2009
Here's the release announcement on the rails-i18n mailinglist:
I've bumped the gem version to 0.2.0 and tagged v0.2.0 today.
Most importantly it includes:
* Lambda support (aka Yaroslav-prevails edition)
* Custom separators (aka Gettext-p0wned edition)
* Ruby 1.9 interpolation syntax (aka Masao-Mutoh-rocks edition)
For more details check out the changelog.
Thanks to everybody involved!
We still haven't managed to get the inclusion of Rails' vendorized gem right.
Thus i...
-
Ripper2Ruby: modify and recompile your Ruby code
July 2009
So, the combination Ripper/Ripper2Ruby lets you do similar things as you can do with ParseTree or RubyParser and Ruby2Ruby. The differences are:
Ripper requires Ruby 1.9 (I was told it possibly could be compiled to work with Ruby 1.8.x but I don’t know anything further. Please drop me a note if you know how to do this.)
Ripper2Ruby builds a full object-oriented representation of Ruby code. That means you can modify the representation much more easily compared to the rough sexp t...
-
Using Ruby 1.9 Ripper
July 2009
While Ripper parses your code it continously fires events (or “calls callbacks”) when it finds something interesting. There are two types of events: scanner (lexer) and parser events.
The scanner basically goes through the code from the left to the right character by character. When it finds known things (such as a keyword, whitespace or a semicolon) it fires a corresponding even that you can react to. The parser works on a higher level and watches for known Ruby constructs (su...
-
Rails I18n revs up: Globalize2 preview released!
September 2008
Please note: the following explanations assume that you're familiar with the new I18n API in Rails and might leave some unanswered questions otherwise :-). Also note that this is a preview release targeted at Rails I18n developers. We'll do at least one more release and provide more complete documentation about how Globalize2 can be used by end users then.
Globalize2 preview
The first preview release of Globalize2 includes the following features and tools. Most of them can be used i...
-
The Future of I18n in Ruby on Rails - RailsConf Europe 2008
September 2008
#talk img {
width: 100%;
border: 4px solid #ddd;
}
#talk p {
margin-top: 1em !important;
margin-bottom: 1em !important;
font-size: 18px !important;
line-height: 140% !important;
}
Welcome everybody!
I'm very happy to talk about "The future of Internationalization in Ruby on Rails" today.
So, who’s me?
This never occurred to me before but in a recent RailsEnvy podcast I’ve learned that my name could be pronounced like thi...
-
Ruby on Rails I18n, RailsConf Europe and Globalize2
August 2008
RailsConf Europe talk: "The future of I18n in Ruby on Rails"
I'll be giving a talk about "The future of I18n in Ruby on Rails" on RailsConf Europe next week together with Marko Seppae.
Am I excited about it? You bet! Will that be an interesting talk for everyone involved into Rails I18n? Of course, I'm sure :)
Also, there are some plans to also work on I18n/Rails during the Code Community Drive but I'm not sure what the status of this is right now.
I'm personally planning to t...
-
The Ruby on Rails I18n core api
July 2008
The pivotal point of the new I18n api in Rails is the I18n
module which is provided as a gem and shipped with Rails in ActiveSupport's
vendor directory. This module comes with the following features:
The main translation method #translate which is used to lookup translations.
The #localize method which is used to localize Date, DateTime and Time objects.
It stores the current locale in Thread.current.
It stores a default locale which is used when no locale has been passed or set.
...
-
Finally. Ruby on Rails gets internationalized
July 2008
In hindsight we've initially tried to accomplish way to much. Everybody
brought their experience and thinking about "good I18n practices" to the table
- which proved extremely valuable because it forced everbody to push their own
horizon. But it also resulted in something that would have been "just another
Rails I18n solution" ... build right into Rails. As such it would not have
fully satisfied every one of us. Too heavyweight, too complicated, just too
much of everything.
So with t...
-
Expecting arbitrary method calls in a particular order in RSpec
July 2008
For a spam protection feature in a project I'm currently working on I started out specifying the behaviour of a filter chain that I was planning to implement. Specifically, I wanted to specify that the filter chain would call the filters in the expected order.
Looking at the RSpec documentation for expecting method calls on mock objects I didn't found this usecase mentioned at first. It turns out to be pretty easy with RSpec mocks though.
#should_receive takes a block that (according to...
-
Scriptaculous SortableTree
May 2008
#tree, #tree ul {
font: normal 12px Helvetica,Arial,Verdana,sans-serif;
line-height: 28px;
color: #444;
padding-left: 20px !important;
margin: 0px;
list-style-type: none !important;
cursor: move;
}
#tree {
padding: 10px 10px 2px 3px !important;
border: 1px solid #aaa;
}
#tree li {
margin-top: -6px;
}
#tree li a {
border-width: 0px !important;
padding: 2px 0 0 18px;
background: url(http://files.ar...
-
Oops! Rails already has something better than Engines
May 2008
To check that out I've reassemled an application that I'm currently working on and that uses Engines to modularize things and added this line to config/environment.rb:
config.plugin_paths << 'vendor/engines'
Now I have a working application with a directory layout like this:
vendor/
engines/
adva_blog/
app/
controllers/
helpers/
models/
views/
db/
migrate/
init.rb
routes.rb
adva_cms/
...
Older posts →