Ruby on Rails OSX Console Aliases 2
I found that every day when I goto work in the morning I do the same things whenever I go to work on a rails project:
- open firefox
- open iTerm
- cd ~/Code/railsprojectx
- mate .
- script/server
- open another tab in iTerm
- svn update
- goto http://localhost:3000
Sure it only takes a few seconds, but it wasn't very DRY. :) I figured I could create a shell alias to basically reduce all that to a single command. I also thought I'd finally start giving mongrel a try. So this is what I came up with for an rdev command (along with a bunch of my other rails related aliases):
alias rdev='svn update;mate .;mongrel_rails start -d;sleep 2;open http://localhost:3000;tail -f log/development.log'
alias ss='script/server'
alias sc='script/console'
alias sg='script/generate'
alias sp='script/plugin'
alias sr='script/runner'
alias rt='rake test'
alias rtu='rake test:units'
alias rtr='rake test:recent'
alias mr='mongrel_rails start -d'
alias mrs='mongrel_rails stop'Just stick that in your ~/.profile file and either reopen your console or run:
. ~/.profileruby-nxt 0.8.0 4
We've made quite a lot of progress on ruby-nxt. The new version is a pretty complete implementation of the NXT direct command set. Almost everything is pretty well documented now, too. One of the more interesting things I've been working on is a high level api based on the "blocks" in NXT-G. So if you're familiar with the way NXT-G works, you should be able to pick it up pretty easily with code such as:
t = Commands::TouchSensor.new(@nxt)
t.port = 1
t.action = :pressed
while t.logic == false
puts "Hold down the button..."
sleep(0.5)
endNow that it's pretty complete and usable, I think I'll finally get around to making a Ruby on Rails plugin, which was the original reason I started all this! :)
ruby-nxt 6
I made a lot of progress this weekend on ruby-nxt. I got most of the Direct Commands completed. Update: ruby-nxt can now be found at rubyforge.
It makes programming the NXT as simple as:
require 'nxt.rb'
NXT.exec("/dev/tty.NXT-B") do |cmd|
puts "Battery Level: #{cmd.GetBatteryLevel[0]/1000.0} V"
cmd.PlaySoundFile(true,"Good Job.rso")
sleep(3)
cmd.StopSoundPlayback
endOnce I get it a little more polished, I plan on also creating a Ruby On Rails plugin. Forget Microsoft Robotics Studio. ;)
Juju