OSX

Getting Started With iCuke

June 1st, 2010 1 Comments

Tonight I decided to give iCuke a try but I couldn’t find any good getting started guides.  iCuke is a BDD gem for cucumber that enables integration testing for the iPhone.  I’m familiar with using cucumber with Rails so getting going wasn’t terribly difficult but thought the pre-reqs should be a little more clear.

Here are five simple steps for getting started:

Step 1: Setup directories

$ cd path/to/your/iphone/app
$ mkdir features
$ cd features
$ mkdir support step_definitions

Step 2: Create cucumber.yml with the following content:
default: -r support -r step_definitions .

Step 3: Create support/iphone.rb with the following content:
require 'icuke/cucumber'

Step 4: Enable the iPhone Simulator Accessibility Inspector in System Preferences
Step 5:  Create app.feature with the following content:

Background:  Given "MyApp" from "../MyApp.xcodeproj" is loaded in the simulator
Scenario: User views the Home screen When I tap "Home"   Then I should see "Welcome"

Show Path in Finder Window Title Bars

March 26th, 2010 0 Comments

Here’s a quick way to show your path in Finder windows.  Open a Terminal window and enter the following:

To enable:

$ defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
$ killall Finder

To disable:

$ defaults write com.apple.finder _FXShowPosixPathInTitle -bool NO
$ killall Finder

Using a Seperate Browser for Selenium with Cucumber

December 30th, 2009 0 Comments

If you’re using Selenium with Cucumber on a Mac you probably know that Firefox 3.5.3 is that latest version that works with Selenium. I was getting fed up with not being able to update to the latest version of Firefox so here’s what I did. Simply install Firefox 3.5.3 (the latest Selenium compatible browser at the time of this writting) and name it /Applications/Firefox-3.5.3.app

This will be the Firefox installation Selenium will use and now you’re free to upgrade your /Applications/Firefox.app install.

Now add the following code to your RAILS_ROOT/features/environments/selenium.rb file.

Webrat.configure do |config|

config.mode = :selenium

# Selenium defaults to using the selenium environment. Use the following to override this.

config.application_environment = :test

config.selenium_browser_key = *firefox /Applications/Firefox-3.5.3.app/Contents/MacOS/firefox-bin

end

Don’t forget to do this hack:

$ cd /Applications/Firefox-3.5.3.app/Contents/MacOS
$ mv libsqlite3.dylib _libsqlite3.dylib

For more help setting up Cucumber and Selenium, check my other post Setting Up Cucumber to Use Webrat and Selenium with Rails.

My GTD Tools

November 17th, 2009 0 Comments

The following is a list of tools that I use on a daily basis to support my way of Getting Things Done:

  • Remember the Milk – My main inbox and list manager.
  • Concentrate – My Pomodoro timer for bursts of highly concentrated work.
  • Wallet notepad and mini pen – For writing down “stuff” that comes to mind.
  • MacVim – Text Editor for editing files of projects, goals, and accomplishments.
  • Dropbox – For syncing project files and folders between multiple computers.
  • Two Tray Inbox – One tray for incoming and one for ‘to read’.
  • Pen and paper – For mind mapping and collecting.
  • Books, Blogs, and Audiobooks – For sharpening the axe.

Installing Ruby Oracle Libraries on Cygwin, OSX, and Linux.

July 22nd, 2009 2 Comments

A month or so ago I needed to connect a Rails site to an Oracle database from cygwin, osx, and linux (both 32 and 64 bit).

I’ve release the fruits of my labors as a collection of rakes files for each OS on github:

http://github.com/kevincolyar/ruby_oracle_libs/tree/master

Hopefully this will help someone else out.  Feel free to fork and let me know of any updates and improvements that are needed.

Forcing Yourself to Use the Keyboard in OSX

July 9th, 2009 0 Comments

In an effort to force myself to use the keyboard more, I’ve turned off the trackpad on my Mac Book Pro.  I did this by opening the Trackpad section in System Preferences and checked the ‘Ignore trackpad when mouse is present’ option, plugging in a usb mouse, and finally hiding the mouse out of reach.

Using Vi with Bash and Readline Applications

June 15th, 2009 0 Comments

This weekend I came across a couple posts on Daily Vim about using vi in other applications such as bash, irb, mysql, or any other readline application.

To use vi mode for all readline applications, including bash, put the following line in your ~/.inputrc file.

set editing-mode vi

To use vi mode for bash only, put the following line in your ~/.bash_profile.

set -o vi

With these features enable, you’re dropped into insert mode and from there you can hit Esc or Ctrl-[ to change to command mode.  Enjoy.

Syncing Your SSH Keys with Ruby

June 4th, 2008 0 Comments
 1 #!/usr/bin/env ruby
 2 
 3 def sync_ssh_key
 4 
 5   # Default servers
 6   servers = ['my.server.com']
 7 
 8   # Use passed in list of servers.
 9   servers = $* unless $*.empty?
10 
11   servers.each do |server|
12     puts "---------------#{server}----------------"
13 
14     puts "Touching .ssh/authorized_keys on #{server}"
15     next unless system("ssh #{server} \"mkdir -p .ssh; touch .ssh/authorized_keys; touch .ssh/authorized_keys2\" ")
16 
17     puts "Copying public key to #{server}"
18     next unless system("scp ~/.ssh/id_rsa.pub #{server}:.ssh/authorized_keys")
19     next unless system("scp ~/.ssh/id_rsa.pub #{server}:.ssh/authorized_keys2")
20 
21     puts 'Setting public key permissions'
22     next unless system("ssh #{server} \"chmod 700 .ssh; chmod 600 .ssh/authorized_keys; chmod 600 .ssh/authorized_keys2\"")
23   end
24 
25 end
26 
27 
28 sync_ssh_key if __FILE__ == $0