April 10th, 2008
Nice title, right? Original. And hilarious.
So Rails is officially on GitHub. This is great if you’re a contributor: No more tracking unofficial repositiories (or maintaining your own), keeping backlogs of patches, or any of the million other frustrations that come along with not having the keys to the kingdom. Get over there, fork Rails, and integrate your awesome feature hotness!
Here’s how I’m tracking the Rails repository:
First, I forked rails/rails on GitHub. No GitHub account? They’re out of beta, you know.
git clone git@github.com:yournick/rails.git
git remote add upstream git://github.com/rails/rails.git
git fetch upstream
git checkout -b upstream upstream/master
Now I have my own forked master, from which I can branch features as I work on ‘em, plus I have an upstream branch, which tracks the Almighty Official Rails Tree. I can pull on the upstream branch and easily merge it into my forked master.
One quick note: I have branch.autosetupmerge set in my global configuration, which means that my upstream branch will automatically track changes. A little Google work should tell you whether you need to add --track to your incantations.
Have a different method for tracking? Think this is dumb? Hit the comments. I’ll update this article if a generally acclaimed Better Way emerges.
Posted in Code | No Comments »
February 26th, 2008
Love defaults write? Check it out.
Posted in Mac | No Comments »
January 14th, 2008
Thanks to Diego Algorta Casamayou, the foxy fixtures plugin for 1.2.x now supports PostgreSQL.
Posted in Code | No Comments »
January 9th, 2008
I’m trying out a few kinda hairy directory reorganizations in the Rails source tree, and it’s madness trying to track them with patches. Until I set up a reasonable git server, I’ve half-assed a public repository here:
http://git.geeksomnia.com/rails
Check out the activerecord/test subdirectory in the ar-test-cleanup branch if you’re interested in seeing what I’m trying out.
Posted in Code | No Comments »
December 24th, 2007
GChart wraps Google’s Chart API with a friendly Ruby interface. This release doesn’t add any significant features (though :label is now :legend in all option sets), but it refactors the internals quite a bit. Enjoy.
Posted in Code | No Comments »
December 20th, 2007
Looks like I’m not the only one that’s tired of munging ENV when I pass parameters to rake tasks. Along with a handful of other fixes, Rake 0.8.0 added the ability to pass parameters to your tasks without mucking with environment variables.
What used to be:
# rake invoke COMMAND=foo
task :invoke do
puts "Invoking #{ENV['COMMAND']}
end
Can become:
# rake invoke[foo]
task :invoke, :command do |task, args|
puts "Invoking #{args[:command]}"
end
If your task has prerequisites, they come after the parameter names in the declaration:
task :invoke, :command => :prerequisite do |task, args|
# ...
end
Looks like the args are comma-separated and purely positional, no named or default arguments. It’s possible that there’s a better way to access argument values than this, too: I haven’t run across any documentation yet.
Posted in Tools | No Comments »
December 20th, 2007
I’ve posted a tiny update to Greedy, a little utility that makes it easy to subscribe to feeds with Google Reader via Safari’s “RSS” button. Recent Google Reader changes switched some URL’s around, which broke the world.
Download the new release. Installation is a drag-and-drop to your Applications folder. If you haven’t used Greedy before, just set it as your “Default RSS Reader” in Safari’s preferences.
Posted in Tools | 2 Comments »
December 10th, 2007
The Foxy Fixtures plugin for 1.2.x has been updated to match the final features from Rails 2.0. If you can get your fixtures to work with the plugin, they should be just ducky when you upgrade. Enjoy!
Posted in Code | No Comments »
December 10th, 2007
GChart wraps Google’s Chart API with a friendly Ruby interface. This initial release is pretty bare, but it works! I hope to support the rest of the API’s features soon, but patches (and bugs, and feature requests) are always welcome. Enjoy.
Posted in Code | No Comments »
November 7th, 2007
Time.now # => Tue Nov 06 23:50:31 -0800 2007
Time.travel_to(1.day.ago) { Time.now } # => Mon Nov 05 23:50:47 -0800 2007
class Time
class << self
def travel_to(value, &block)
self.offset = Time.now.utc - value.to_time.utc
yield if block_given?
ensure
self.offset = nil
end
def now_with_time_travel
now_without_time_travel - (traveling? ? offset : 0)
end
alias_method_chain :now, :time_travel
private
def traveling?
offset
end
def offset
Thread.current[:time_travel_offset]
end
def offset=(value)
Thread.current[:time_travel_offset] = value
end
end # of class methods
end
Posted in Code | No Comments »