Read my latest article: 8 things I look for in a Ruby on Rails app (posted Thu, 06 Jul 2017 16:59:00 GMT)

Campfire messages in Growl

Posted by Wed, 05 Mar 2008 21:24:00 GMT

Our team has slowly been transitioning from IRC to Campfire (iPhone interface helped with this decision) for internal team discussions. Earlier today, I decided to setup Campfire to connect to Growl. There are a few scripts to do this, but I figured that I’d consolidate the steps here for my teammates and share with everyone else in the process.

Step 1: Get stuff installed

You’ll need to install the following programs on OSX.

  • Growl (install and run it)
  • Fluid.app (run a web site in it’s own desktop app)
    • Follow instructions on their homepage (requires restart of Safari)

Step 2: Setup Campfire

Once you have everything installed, you can go ahead and create your Campfire Fluid application. You’ll need to provide your Campfire URL and a name for the application.

Campfire Fluid
Uploaded with plasq’s Skitch!

Once you get it running, you should be able to run your Campfire application in it’s own window.

Campfire: Blogging
Uploaded with plasq’s Skitch!

Step 3: Install the Campfire Growl script for GreaseKit

Next, you’ll want to install this script, created by Tim Harper, on userscripts.org within your Campfire Fluid.app instance.

Under the Userscripts menu, you’ll see: Browse Userscripts.org.

Userscripts
Uploaded with plasq’s Skitch!

Find your way to the script (search for: “Campfire Growl”) to find and install the script.

Growl Notifications with messages for campfire and fluid 2013 Userscripts.org
Uploaded with plasq’s Skitch!

Once it installs, you’ll then need to activate it in the Fluid applications management interface. Within Campfire application, go to Userscripts > Manage Userscripts.

manage userscripts
Uploaded with plasq’s Skitch!

Then activate it like so:

activate growl
Uploaded with plasq’s Skitch!

..and that’s it! When you’re not focused on Campfire… you should see Growl notifications when other people are talking in the active room.

Installing Ruby on Rails and PostgreSQL on OS X, Third Edition

Posted by Tue, 22 Jan 2008 16:55:00 GMT

3 comments Latest by Scof Fri, 05 Feb 2010 17:03:22 GMT

Over the past few years, I’ve helped you walk through the process of getting Ruby on Rails up and running on Mac OS X. The last version has been getting a lot of comments related to issues with the new Apple Leopard, so I’m going this post will expand on previous installation guides with what’s working for me as of January 2008.

The following guide is how our development team at Planet Argon prefers to setup our development workstations

WARNING: This post contains some outdated instructions. Please read Installing Ruby on Rails, Passenger, PostgreSQL, MySQL, Oh My Zsh on Snow Leopard, Fourth Edition , which is focused on Installing Ruby on Rails on Snow Leopard.

During this installation, we’ll have what we feel is the optimal development stack for building Ruby on Rails applications with our favorite database server, PostgreSQL.

Ready? Let’s get started…

Phase One

During this initial phase, we’re going to install the underlying dependencies that we’ll be building off of.

XCode 3.0

The first thing that you’ll need to install to get far with this process is XCode tools, which is distributed by Apple. You can find this on the DVD that your Leopard installer is on. You can also download the latest version from Apple’s developer site.

The current version (3.0) is 1.1 GB.. so the download time will vary depending on your connection speed. I would encourage you to drink some tea and/or read a book

Once you finish the installation, you can move forward. The rest of these installation will not work until XCode is installed. :-)

MacPorts

In this next step, we’ll install MacPorts (formerly known as DarwinPorts). The MacPorts web site describes itself as, “an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system.”

This tool is about to become one of the most important tools on your operating system as it’ll be used time and time again to maintain your libraries and many of the Unix tools that you’ll be using. If you’re from the Linux or BSD world, you are likely familiar with similar tools… such as: apt-get, port, and yum.

First, you’ll want to download MacPorts and install the “dmg” disk file for Leopard at the following link.

Once downloaded, you’ll want to run the installer and install it on your workstation.

Install MacPorts-1.6.0

Work you way through the installer until successfully installed.

Install MacPorts-1.6.0

Once this finishes, you can open up your favorite terminal application and run the following to test that it installed properly.

In my case, I’m now using Terminal.app.

Issue the command: /opt/local/bin/port version

_opt_local_bin_port version

If it responds with a version number like mine did in the screenshot above, we’re moving along nicely.

Environment Paths

When we install MacPorts, the command to install/update ports installed to /opt/local/bin. We had to provide the entire path as this isn’t currently showing up in the default $PATH on Leopard. Let’s quickly remedy this by modifying the file /etc/profile.

If you have Textmate installed, you can run the following from your terminal: mate /etc/profile

Add the following line to the bottom of /etc/profile.

export PATH=/opt/local/bin:/opt/local/sbin:$PATH
profile

You can use your favorite editor to update this file. Once you save it, you’ll want to restart your terminal application (or open a new tab) to create a new session. When your new terminal opens, run the following to verify that port is showing up in your $PATH.

which port

You should see /opt/local/bin/port show up as the result of this command.

which port

Great, let’s continue to move forward.

Hiding Apple’s Ruby, Gems, and Rails

Before we install Ruby from MacPorts, we’ll go ahead and hide Apple’s Ruby installations.


    :~ robbyrussell$ sudo su -
    Password:
    :~ root# mv /usr/bin/ruby /usr/bin/ruby.orig
    :~ root# mv /usr/bin/gem /usr/bin/gem.orig
    :~ root# mv /usr/bin/rails /usr/bin/rails.orig
    :~ root# logout    
hiding apples ruby

If you ever decide to remove MacPorts, you can just rename ruby.orig back to ruby and you’re back where you started… and the same for the others listed.

Phase Two

During this next phase, we’re going to install Ruby and Ruby on Rails.

Installing Ruby via MacPorts

Now that we have MacPorts up and running, we’re going to use it for the first time. We’ll start by using it to install Ruby and the Rubygems package.

$ sudo port install ruby rb-rubygems

Okay, this will take a little while. I’d suggest that you step out to get some fresh air.

How was it outside? What’s the weather like there today? It’s currently 2:30am PST so it’s dark and an 28F outside so I didn’t stay outside very long.

If you’re still waiting for it to install, perhaps you could watch the following video. I might encourage you to check out more of Jam, which was recommended a few years ago to me by James Adam at Canada on Rails.

Be warned… it’s a strange show, but I find strange things like this funny. :-)

If you prefer something a bit more lighthearted…

Okay… when Ruby finishes installing, you’ll want to test that you can run it.

$ ruby -v

Great, let’s move forward!

Installing Ruby on Rails via RubyGems

We’re now going to install the libraries that make up Ruby on Rails via RubyGems.

$ sudo gem install --include-dependencies rails

This will install the following gems.

  • rails-2.0.2
  • rake-0.8.1
  • activesupport-2.0.2
  • activerecord-2.0.2
  • actionpack-2.0.2
  • actionmailer-2.0.2
  • activeresource-2.0.2

Excellent, let’s move forward…

If you haven’t already purchased it, I recommend that you take a look at The Rails Way (Addison-Wesley Professional Ruby Series) by Obie Fernandez.

Installing Mongrel via RubyGems

Let’s now install Mongrel, which is an excellent Ruby-based web server for Ruby on Rails applications. We use it in development and production at Planet Argon and it’s also what we recommend to our hosting customers.

$ sudo gem install --include-dependencies mongrel mongrel_cluster
  • Note: Be sure to select the proper platform for mongrel. (hint: OS X is NOT mswin32)
My terminal output:

Select which gem to install for your platform (i686-darwin9.1.0)
 1. mongrel 1.1.3 (java)
 2. mongrel 1.1.3 (i386-mswin32)
 3. mongrel 1.1.3 (ruby)
 4. mongrel 1.1.2 (ruby)
 5. mongrel 1.1.2 (mswin32)
 6. mongrel 1.1.2 (java)
 7. Skip this gem
 8. Cancel installation
> 3
Select which gem to install for your platform (i686-darwin9.1.0)
 1. fastthread 1.0.1 (mswin32)
 2. fastthread 1.0.1 (ruby)
 3. Skip this gem
 4. Cancel installation
> 2
Building native extensions.  This could take a while...
Building native extensions.  This could take a while...
Successfully installed mongrel-1.1.3
Successfully installed gem_plugin-0.2.3
Successfully installed daemons-1.0.9
Successfully installed fastthread-1.0.1
Successfully installed cgi_multipart_eof_fix-2.5.0
Installing ri documentation for mongrel-1.1.3...
Installing ri documentation for gem_plugin-0.2.3...
Installing ri documentation for daemons-1.0.9...
Installing ri documentation for fastthread-1.0.1...

No definition for dummy_dump

No definition for dummy_dump

No definition for rb_queue_marshal_load

No definition for rb_queue_marshal_dump
Installing ri documentation for cgi_multipart_eof_fix-2.5.0...
Installing RDoc documentation for mongrel-1.1.3...
Installing RDoc documentation for gem_plugin-0.2.3...
Installing RDoc documentation for daemons-1.0.9...
Installing RDoc documentation for fastthread-1.0.1...

No definition for dummy_dump

No definition for dummy_dump

No definition for rb_queue_marshal_load

No definition for rb_queue_marshal_dump
Installing RDoc documentation for cgi_multipart_eof_fix-2.5.0...
Successfully installed mongrel_cluster-1.0.5

Great, you have almost all of the essentials.. except a database.

Phase Three

In this phase, we’re going to get our database server, PostgreSQL, installed and the libraries that Ruby needs to communicate with it.

Installing PosgreSQL with MacPorts

At Planet Argon, we design and develop our applications on top of PostgreSQL. I’ve been advocating the adoption of this awesome open source database in the Rails community for quite some time now.

The current version available of PostgreSQL via MacPorts is 8.3, which is what we’ll now install with the port command.

$ sudo port install postgresql83 postgresql83-server

This will download and install the necessary libraries to run PostgreSQL server and the client utilities.

Configuring PostgreSQL

When PostgreSQL is finished installing, it’ll tell you to run the following commands to create a new database instance.


 sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb
 sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb
 sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb'

Adding PostgreSQL to launchd

If you’d like to have PostgreSQL automatically startup after a system restart, you can load it into launchd, which comes with OS X. By running the following command, PostgreSQL will startup automatically on the next system restart.

sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist

Adding PostgreSQL to your $PATH

For some reason, the MacPort for PostgreSQL doesn’t get the programs in your path automatically, so we’ll it now.

mate /etc/profile

Modify the PATH that we changed earlier to include /opt/local/lib/postgresql83/bin@.

export PATH=/opt/local/bin:/opt/local/sbin:/opt/local/lib/postgresql83/bin:$PATH

Save the file and then open a new terminal. To test this, you should get the following output when you run which psql.


  $ which psql
  /opt/local/lib/postgresql83/bin/psql    

Creating a new PostgreSQL user

When I’m working on Rails applications in my development environment, I really don’t want to have to specify a username and password in every config/database.yml file for each of our ongoing client projects. When PostgreSQL was installed, it created a superuser named postgres, which is great, but I’d like one that matches my system username, so that I’m not prompted at all for a username or password to connect to PostgreSQL.

To do this, we’ll use the createuser command, which comes with PostgreSQL. As you can see, I’m creating a new user with superuser privileges (and will hopefully be the last time I have to do a -U postgres).


  $ createuser --superuser robbyrussell -U postgres
  CREATE ROLE    
Let’s take a quick moment to test this out.

  # create a new database
  $ createdb my_test_db
  CREATE DATABASE

  # drop the database
  $ dropdb my_test_db
  DROP DATABASE

Great, everything looks good here.

We now have a running installation of PostgreSQL with a new user account. All we need to do now is install the appropriate RubyGem to allow our Ruby applications to connect to it.

Installing PostgreSQL Libraries for Ruby

You can install postgres gem by running the following command.

$  sudo gem install --include-dependencies postgres

Great. We’ve now built a professional development environment for working with Ruby on Rails. Can you feel the excitement? :-)

Closing Thoughts

Like the previous versions, I hope that a few people find this useful. I didn’t have to make a lot of changes from the second edition, but there were enough to warrant a new post. I’ve been setting up my workstation like this for about three years now and I’m looking forward to seeing how a fresh install on Leopard works out for me.

If you have any problems, feel free to ask a question in the comments below.

Skitch... my favorite desktop application of 2007?

Posted by Tue, 20 Nov 2007 18:04:00 GMT

It just occurred to me that my first Skitch was on July 7th, 2007. 7/7/7. I’ve been meaning to post an article about how Skitch has changed the way our team approaches reporting bugs and communicating ideas visually.

First of all, the Skitch web site advertises it (see video) as a fun tool for playing with photos and sharing stuff with friends/family. While this is true, I think their bigger market could be those of us who work in the web design and development community. It took a less than a week for Skitch to become a tool that I rely on the most during my day to day work and since it keeps surprising me that people aren’t using it and/or haven’t heard about it… I thought that I’d share how we’re using it at Planet Argon.

Introducing “LOLBUGZ”

Our team is currently using Lighthouse for managing bugs/tickets for internal and client projects. If there is one way to slow down bug fixing cycle.. .it’s the ticket submission process. It takes a lot of time and commitment to try and communicate some problems that you’ll find in a web application. This is why screenshots can be so useful to helping speed up the process. Skitch allows us to not only provide a screenshot really quickly, but it gives us the ability to focus our attention with shapes and text, which provides more context when viewing an image.

For example, here are a few real-world Skitches that I’ve used to report some problems.

What happened to this drop down?

This pagination needs some CSS-Love!

Oh no! Tags are getting grouped together…

Styling has gone crazy…

I mastered an unordered list! (hooray!!)

This list isn’t scaling anymore…

Side note: LOL BUGZ was a term coined by Rick Olson at Active Reload to describe the tickets that I post for Lighthouse. ;-)

Trying out 15 during the initial releases for the iPhone… bug report sent via twitter to Erik Kastner.

As you can see, using Skitch helps communicate some very specific things without needing to type a huge description. Of course, we do try our best to add more context with our tickets. For example, here is a real-world example of a ticket that I posted on Lighthouse. As you’ll see, there are a few skitches embedded in the tickets, which works much better than attaching screenshots to tickets.

One of the best features of Skitch is it’s work-flow. Within a few seconds, I can do the following tasks.

  • Take a screenshot of a specific region of my screen
  • Add some arrows and text
  • Click on Webpost, which will upload directly to myskitch.com
  • Click on Share to navigate to the new upload
  • Click on the embed textfield and it uses JS to copy the embed html into my paste buffer
  • Paste the html snippet directly into the ticket that I’m reporting
  • Submit my LOL BUG

Side note: it also allows you to upload to Flickr, a ftp account, etc.

Over the past four months, Skitch has become one of my favorite OS X tools. The interface is lightweight and the workflow is almost perfect (feature request: providing the embed code in my paste buffer without needing to go to myskitch would be A+++)

I’ve also used Jing, which works on Windows and OS X and does video. I’ve not found it to be as intuitive for working in this manner. In fact, the work-flow leaves a lot to be desired. However! It does do video and this has come in handy a few times for showing people some “live” interaction-type bugs that can’t be communicated as easily through text/images.

If you’re not using Skitch yet and are on OS X… I highly recommend that you try it out for a few weeks during a bug fixing sprint. We’ve gotten our clients and almost everybody on the team using it in this fashion. The productivity increases haven’t gone unnoticed.

That’s not to say that it’s not fun for point out things that aren’t related to your project bugs. ;-)

Happy Skitching!

UPDATE

Plasq liked the writeup and gave me 50 extra invites to pass out for Skitch. So, if you’re in need of one… ask me via email. Thanks Plasq team!

Starting MySQL after upgrading to OS X Leopard

Posted by Sat, 27 Oct 2007 10:13:00 GMT

If you upgraded to OS X Leopard and are running MySQL from the MySQL.com installer1, you might be having some problems with starting it from the GUI interface. There isn’t a fix from MySQL yet, so to get around that… you can run it from the command-line.

Start MySQL from the command line

cd /usr/local/mysql; ./bin/mysqld_safe &

This should get MySQL up and running for you. If someone wants to share a tip on how to get this to start automatically on reboot, please post a comment and I’ll help get the word out.

1 I didn’t have this problem as I installed MySQL via MacPorts... but this came up for a few members of PLANET ARGON after they upgraded to Leopard.

Using MacPorts Ruby and Rails after Upgrading to OS X Leopard

Posted by Sat, 27 Oct 2007 09:43:00 GMT

If you previously followed my article, Installing Ruby on Rails and PostgreSQL on OS X, second edition and are now upgrading to OS X Leopard, you’ll want to make a few adjustments to your setup.

First of all, it’s great that Apple has decided to provide Ruby on Rails out of the box.


~ > gem list rails                                                                                                                                                                   
  *** LOCAL GEMS ***

  rails (1.2.3)
      Web-application framework with template engine, control-flow layer,
      and ORM.
How many gems does it come with?

~ > gem list|grep '^[a-z]'|wc -l                                                                                                                                                     
      29

It’s really great that Apple shipped Leopard pre-installed with 29 gems, especially if you don’t have your entire Rails stack setup already. In my case and for those that have followed my installation process, you don’t need to switch over to this new development stack (yet). I have a lot of time invested in my fully-functionaly MacPorts installation process (PostgreSQL, MySQL, RMagick, Subversion, Git, etc. Since this all working fine on my machine, I’m not ready to make the switch to Apple’s installation.

Don’t Fix it… if it’s not broken!

So, the the first thing that I did was modify my PATH environment variable, which has /usr/bin as the first path that it’ll look at when you try to run commands like ruby, mongrel_rails, gem, etc. You’ll want to modify this and prepend /opt/local/bin: to the front of PATH in your shell configuration. If you’re using bash, this would be… ~/.bashrc. If you’re using zshell like me, ~/.zshrc.

Now, when you start a new Terminal and run gem list, you’ll see all of the gems that you already have installed.


~ > gem list rails                                                                                                                                   < new-host

*** LOCAL GEMS ***

rails (1.2.5, 1.2.4, 1.2.3, 1.1.6)
    Web-application framework with template engine, control-flow layer,
    and ORM.

Back to my happy gems…


~ > gem list|grep '^[a-z]'|wc -l                                                                                                                                                              < new-host
      72

Great! Now I can get back to work and spend time playing with the new features in Finder, Mail.app, and iChat instead of installing all of the software dependencies that our development projects have. :-)

OS X Leopard Tip: Skitch on Every Space

Posted by Sat, 27 Oct 2007 02:43:00 GMT

If you’re using Skitch and the new Spaces in OS X Leopard, I would encourage you to set the following up.

This will allow you to use Skitch on any Space without needing to move it around. Took me a few minutes to figure out that I could set it up like this.

As you can see… I’m on Leopard now… only took three tries.

Older posts: 1 2 3