Posted
on 06/21/2008, 6:11 pm,
by warren,
under All.
Rails automatically adds the File.mtime to static assets when using stylesheet_link_tag and javascript_include_tag. The file’s mtime is cached to prevent excessive file system access… even in development mode. This is problematic in a Facebook canvas during development mode because often you won’t immediately see the changes you make to your stylesheets and javascripts.
Here is a monkey patch you can throw into a config/initializers/break_asset_cache_in_dev_mode.rb to fix this:
Posted
on 06/04/2008, 8:12 pm,
by val,
under All, Ops, Rails.
Instead of relaying on running cleanup of old releases via capistrano, we have a cron job to only keep releases for last two days (but at least three latest).
Posted
on 06/04/2008, 4:00 pm,
by warren,
under All.
Here’s a quick rake file that will crawl through your Rails project and syntax check ruby, erb, and yml files. You should always run this before doing a “cap deploy” and it even doesn’t hurt to run it before a “svn commit”.
require 'erb'
require 'open3'
require 'yaml'
task :check_syntax => [:check_ruby, :check_erb, :check_yaml]
task :check_erbdo
(Dir["**/*.erb"] + Dir["**/*.rhtml"]).each do |file|
nextif file.match("vendor/rails")
Open3.popen3('ruby -c') do |stdin, stdout, stderr|
stdin.puts(ERB.new(File.read(file), nil, '-').src)
stdin.close
if error = ((stderr.readline rescuefalse))
puts file + error[1..-1]
end
stdout.close rescuefalse
stderr.close rescuefalseendendend
task :check_rubydoDir['**/*.rb'].each do |file|
nextif file.match("vendor/rails")
nextif file.match("vendor/plugins/.*/generators/.*/templates")
Open3.popen3("ruby -c #{file}") do |stdin, stdout, stderr|
if error = ((stderr.readline rescuefalse))
puts error
end
stdin.close rescuefalse
stdout.close rescuefalse
stderr.close rescuefalseendendend
task :check_yamldoDir['**/*.yml'].each do |file|
nextif file.match("vendor/rails")
beginYAML.load_file(file)
rescue => e
puts "#{file}:#{(e.message.match(/on line (\d+)/)[1] + ':') rescuenil}#{e.message}"endendend
And here’s what the output looks like:
warren:tmp_project$ rake check_syntax
(in /Users/warren/tmp_project)
app/controllers/application.rb:37: syntax error, unexpected '='
app/views/people/home.html.erb:60: syntax error, unexpected '<', expecting $end
vendor/plugins/will_paginate/test/fixtures/users.yml:13: syntax error on line 13, col 0: `dev_<%= digit %>:'
This could probably be expanded to support lots of other types of files as well (css, javascripts, etc).
Posted
on 06/04/2008, 3:59 pm,
by aaron,
under All.
The Railsconf08 talk on ESI & Rails has sparked some interest in the community, and Todd, the core mongrel-esi maintainer, is asking for feedback on the mongrel-esi mailing list.
The latest rumor is he is working on a nginx port of mongrel-esi, which I have to admit sounds very interesting…
How are people planning to use ESI? Can anyone provide Todd with some feedback?
I'm wondering what is the main set of features preventing folks
today from using mongrel-esi in production? Is it :
* performance
* documentation
* stability
If it's performance, can someone do some load testing maybe provide
some numbers and even some target numbers? I am working on an
improved concurrency model, that should help improve page performance
for pages with lots of esi:include tags
if it's documentation, what's the missing bits, and can any of you
help out by filling in the gaps?
if it's stability, can you provide some samples that fail?
-Todd
People asked some awesome questions, caught the edge cases I didnt want to cover which were complicated, like authorization/security, multi-level ESI includes, per page include limits, etc. The people at RailsConf are awesome. Thats totally why I enjoy these events.
Posted
on 05/13/2008, 9:29 pm,
by aaron,
under All, Facebook, Rails.
UPDATE: Animoto just raised a round of investment from Amazon! Congrats Guys!
Animoto is a great idea. They take your photos and create a production quality video to the music of your choice. Its the end of those boring slide shows, for good.
We had the pleasure to work with the Animoto guys to launch their Facebook application, “Animoto Videos”, which leveraged all of the existing photos on Facebook. The growth was amazing.
Scaling an application from a few hundred users to over a million in just a few days isnt easy, but we had a great team. Their backend rendering farm lived in Amazon’s Cloud, and the growth was so impressive, Jeff Bezos even spoke about them at Y Combinator’s Startup School just a few weeks ago. From 50 EC2 instances to over 4k in only a few days. See the video below.
It was a pleasure working with the entire team from Animoto, RightScale, and Amazon. See their blog posts about the application here, here, and here.
I’m sure I’ll cross paths with many of you at RailsConf. First round of beers is on me.