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

Sharing Custom TextMate Bundles with Subversion

Posted by Mon, 12 Feb 2007 04:35:00 GMT

Early last year, I began to start creating a bunch of snippets and such for TextMate, all of which were lost several months ago due to Hurricane iSight. I recently decided to start building some again, especially some that sped up my RSpec writing. After creating a few, I wondered, “would anybody else on my team want to help me write some?” So, I thought that it was time to figure out how to share my bundle with others and allow them to add stuff to it… which seems like a good job for Ms. Subversion.

I couldn’t find a quick walk-through online and found myself in the #textmate IRC channel getting proper instructions. (thank you Allan!)

Create Your Bundle

In TextMate, you can open up the Bundle Editor and create a new bundle. Let’s call our custom bundle, RSpec. Go ahead and begin adding some snippets, commands, etc to your new custom bundle. Once you have something in your Bundle, you’ll want to reload your bundles, by going to Bundles > Bundle Editor > Reload Bundles. This will write your new bundle to disk to ~/Library/Application\ Support/TextMate/Bundles/.

    $ ls -al ~/Library/Application\ Support/TextMate/Bundles/
    total 0
    drwxr-xr-x   5 robbyrus  robbyrus  170 Feb 11 21:10 .
    drwxr-xr-x   4 robbyrus  robbyrus  136 Feb 11 20:11 ..
    drwxr-xr-x   5 robbyrus  robbyrus  170 Jan 12 16:58 PLANET ARGON.tmbundle
    drwxr-xr-x   3 robbyrus  robbyrus  102 Feb 11 21:10 RSpec.tmbundle
    drwxr-xr-x   4 robbyrus  robbyrus  136 Oct 21 13:38 Robby Russell???s Bundle.tmbundle

Importing your Bundle into Subversion

You’ll want to first import your new bundle into Subversion.

    $ cd ~/Library/Application\ Support/TextMate/Bundles/
    $ svn import RSpec.tmbundle/ -m "Initial import of RSpec (test) bundle" http://{respository_url}/{repository_name}/RSpec.tmbundle/
    Adding         RSpec.tmbundle/info.plist
    Adding         RSpec.tmbundle/Snippets
    Adding         RSpec.tmbundle/Snippets/new specification.tmSnippet

Great, now it’s in Subversion. Now, you’ll want to check it back out so that TextMate is running off of the version from Subversion.

The simplest way to do this is to delete your local copy and checkout the latest from Subversion.

    $ rm -rf RSpec.tmbundle/; svn co http://{respository_url}/{repository_name}/RSpec.tmbundle/
    A    RSpec.tmbundle/Snippets
    A    RSpec.tmbundle/Snippets/new specification.tmSnippet
    A    RSpec.tmbundle/info.plist
    Checked out revision 5.

All that you need to do now, is relaod your bundles again. Now that you know where the bundle files are stored, you can commit any changes as they are made.

Committing Bundle Changes

When you make changes to your TextMate bundle, you can do the following to commit your updates to the Subversion repository.

See Your Pending Changes

You can change directories to your custom bundle and run svn status.

    $ cd ~/Library/Application\ Support/TextMate/Bundles/RSpec.tmbundle/
    $ svn status
    ?      Snippets/new context.tmSnippet

You’ll see that the new snippet that I created needs to be added to Subversion.

    $ svn add Snippets/new\ context.tmSnippet 
    A         Snippets/new context.tmSnippet

Now, let’s commit it to the repository.

$ svn ci -m "Adding new context snippet" 
Adding         Snippets/new context.tmSnippet
Transmitting file data .
Committed revision 6.

At this point, all Subversion tips and tricks apply… so… it’s time to leave it to you to figure out the rest. :-)

TIP: Always reload your bundles before and after running svn update or svn commit

...and there you have it! You and your friends can (with a little work) share and develop your own custom bundles for TextMate. I’m hoping to get my teammates at PLANET ARGON to help me build a bunch for RSpec, which I’ll try to release into the wild soon. If anybody is already working on RSpec snippets and other TextMate hacks, please let me know.


Aslak kindly commented on this post and has pointed me to bundle available in the RSpec subversion repository, which I blogged about.) :-)

Happy hacking!

Install Ruby, Rails, and PostgreSQL on OSX

Posted by Mon, 29 May 2006 13:46:00 GMT

15 comments Latest by Manjoor Thu, 13 Jul 2006 10:00:30 GMT

WARNING: This post contains some outdated instructions. Please read Installing Ruby on Rails and PostgreSQL on OS X, Second Edition.

Our Creative Director, Allison Beckwith, picked up a new black MacBook this weekend and I had the luxury of getting it setup to model our standard setup. We all try to keep our setups fairly similar so that we don’t hit too many issues when working together on projects.

I’ll try to keep this short and to the point… because if you’re like me… you just want to start playing with Rails! ;-)

The steps I followed to get her setup like the rest of the development team at PLANET ARGON went something like this.

XCode and DarwinPorts

  • Download and install iterm (the Universal dmg)
  • Download and install XCode tools from Apple (dmg)
  • Download and install DarwinPorts (dmg)
  • Start up iterm.
In this step we are going to modify the default bash profile so that every user on the machine that uses bash will get the path for darwinports in their bash_profile.
sudo vi /etc/profile

Modify the following line to include /opt/local/bin in the PATH… save the file (see vim documentation for details)


Ruby and Rails

  • Open up a new iterm tab (apple-t)
  • Install ruby with darwinports with: sudo port install ruby rb-rubygems
  • Install Ruby on Rails and all its dependencies with: sudo gem install -y rails

PostgreSQL and Ruby libs

  • Install PostgreSQL8 with: sudo port install postgresql8
  • We need to modify the /etc/profile file again because the postgresql8 install doesn’t add programs like pg_ctl to /opt/local/bin. Change the PATH to now look like this and save.

  • Install the postgres gem with: sudo gem install postgres
    • Oh NO!!! You should see an error about it not finding libraries… what will we do?

  cd /opt/local/lib/ruby/gems/1.8/gems/postgres-0.7.1
  sudo ruby extconf.rb --with-pgsql-include=/opt/local/include/pgsql8 --with-pgsql-lib=/opt/local/lib/pgsql8
  sudo make && sudo make install
  # for good measure...
  sudo gem install postgres

Successfully installed postgres-0.7.1

Configure PostgreSQL for single user

In our development environments, we don’t find it necessary to keep PostgreSQL running all the time on our servers. We only want it running when we’re doing development. We also typically install it per user on a machine to keep us from needing things like usernames and passwords to connect to it from an application we’re running on the machine. Let’s setup PostgreSQL the PLANET ARGON way!

  • Open up iterm and go to your home directory
  • Init your new PostgreSQL database with: initdb -D pgdata
  • Start up PostgreSQL with: pg_ctl -D pgdata -l pgdata/psql.log start
  • Create a new database with: createdb argon_development
  • Test the new database with: psql argon_development
  • Did it load up your new database? If so, great! If not… check your steps… :-)

Test Rails + PostgreSQL

  • Navigate to a directory where you don’t mind sticking projects… mkdir development; cd development
  • Generate a new Rails application with: rails -d postgresql argon
  • Navigate to new Rails application directory. cd argon
  • Generate a new model to test with: ./script/generate model Argonista
  • Edit and save the migration that was generated ( db/migrate/001_create_argonistas.rb ) file with your favorite editor…

  class CreateArgonistas < ActiveRecord::Migration
    def self.up
      create_table :argonistas do |t|
        t.column :name, :string
        t.column :blog_url, :string

    def self.down
      drop_table :argonistas
  • Edit config/database.yml to look like the following… you’ll notice that we don’t need to supply a username or password.

    adapter: postgresql
    database: argon_development

    adapter: postgresql 
    database: argon_test

    adapter: postgresql
    database: argon_production
* Run the migration with: rake db:migrate

  $ rake db:migrate
  (in /Users/allisonbeckwith/development/argon)
  == CreateArgonistas: migrating ================================================
  -- create_table(:argonistas)
  NOTICE:  CREATE TABLE will create implicit sequence "argonistas_id_seq" for serial column "" 
  NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "argonistas_pkey" for table "argonistas" 
     -> 0.0399s
  == CreateArgonistas: migrated (0.0402s) =======================================
* Test your new model from console

  $ ./script/console 
  Loading development environment.
  >> a =
  => #<Argonista:0x24569dc @attributes={"name"=>nil, "blog_url"=>nil}, @new_record=true>
  >> = 'Robby'
  => "Robby" 
  >> a.blog_url = ''
  => "" 
  => true
  >> exit
* Great, let’s go look at our database table…

  $ psql argon_development
  Welcome to psql 8.1.3, the PostgreSQL interactive terminal.

  Type:  \copyright for distribution terms
         \h for help with SQL commands
         \? for help with psql commands
         \g or terminate with semicolon to execute query
         \q to quit

  argon_development=# SELECT * FROM argonistas;
   id | name  |          blog_url           
    1 | Robby |
  (1 row)

There we go, we’ve setup Ruby, Rails, and PostgreSQL on a brand new Intel MacBook without breaking a sweat!

Extra Goodies

  • Subversion: sudo port install subversion
  • Lighttpd: sudo port install lighttpd
  • ImageMagick: sudo port install ImageMagick (known to take a while…)
  • GraphicsMagick: sudo port install GraphicsMagick
  • Install the rmagick gem: sudo gem install rmagick

Have fun!

Older posts: 1 2