A while ago, PragDave wrote about using Rails migrations outside of Rails.
I wanted to be able to have things work ‘just like in rails’, so I hacked up a quick script that runs all the migrations in the
if ARGV =~ /VERSION=d+/
version = ARGV.split('=').to_i
version = nil
@logger = Logger.new $stderr
ActiveRecord::Base.logger = @logger
ActiveRecord::Base.colorize_logging = false
ActiveRecord::Base.establish_connection(:adapter => "mysql",
:username => "dbuser",
:host => "localhost",
:password => "xxx",
:database => "yyy")
It would be even nicer to have a config file, but that should be very easy to do with YML.
I run it like so:
ruby domigrations.rb. I believe that the
Migrator.migrate call isn’t documented, so I don’t know how safe it is to count on it, but for the moment things seem to work quite nicely…
I created a mobile phone shopping app a while ago with Hecl, and since it seems to have become fairly popular, I did a second, more polished version that is still very simple to use: ShopList.
I think it’s a good way of utilizing a mobile phone and the web together – you enter the list of things to get in a web page, then the phone fetches that list. Realistically, inputting a long grocery list on a phone would drive you mad, whereas with this application, it’s quite fast, and what’s more, it makes use cases like this possible and simple: I’m going to the store, so my wife creates a list on the web site, and sends me the list id, which I use to fetch the list when I’m at the store.
I received a very interesting email the other day from an individual who works for the state of Oregon seeking to forge ties with high tech companies abroad. They don’t have a great deal of resources, but they do have some contacts, and are open to dealing with even relatively small organizations.
I have to say that there is some really interesting stuff happening in Oregon in terms of open source lately (beyond Linus Torvalds living there), so if any European companies, or university professors are interested in going over to have a look, I’d be more than happy to pass the information along.