Ruby on Rails OSX Console Aliases 2

Posted by Tony Buser Thu, 18 Jan 2007 15:07:00 GMT

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:

  1. open firefox
  2. open iTerm
  3. cd ~/Code/railsprojectx
  4. mate .
  5. script/server
  6. open another tab in iTerm
  7. svn update
  8. 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:

. ~/.profile

ruby-nxt 0.8.0 4

Posted by Tony Buser Thu, 28 Sep 2006 02:53:00 GMT

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)
end

Now 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

Posted by Tony Buser Mon, 07 Aug 2006 03:11:00 GMT

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

end

Once I get it a little more polished, I plan on also creating a Ruby On Rails plugin. Forget Microsoft Robotics Studio. ;)