Archive

Posts Tagged ‘Ruby’

Jabber Bot

October 9, 2011 Leave a comment

I’ve been inspired many times by reading through developer blogs from various companies: Atlassian, GitHub, Google, Etsy, etc.  I love to hear from other developers, how they work and how their company works.  I have borrowed many of these ideas and incorporated them into our workflow at Sentry.

I recently came across this blog post by Zach Holman from GitHub:
http://zachholman.com/posts/why-github-hacks-on-side-projects/

I’m no n00b to jabber bots.  Sentry has been using them for years, but mainly for alerting and error reporting.  I love being jabbered, with a full stack trace and supporting data, any time a problem occurs in our system.  It makes fixing things 10x easier.

I’ve also been using the jabber bot that Jenkins (fka Hudson) provides for several years and have always liked the idea of it.

I finally decided to make a bot to do our bidding at work.  We decided to call her GLaDOS, which many of you will recognize from the famous Portal game.

GLaDOS can now deploy to remote systems (via capistrano recipes), merge/commit changes to our various svn repositories, jabber other users, run caching scripts, and hopefully much more in the near future.

Advertisements
Categories: Uncategorized Tags: ,

Gem Bundler to the Rescue

August 12, 2011 1 comment

About 6 months ago we converted all of our Ruby applications (Rails and non-rails) to utilize Gem Bundler : “The best way to manage your application’s dependencies”

This immediately did 3 things for us:

  1. Removed our sysadmins from the picture. No more bothering them to install or update gems.
  2. Removed conflicts at the system level. We are no longer fighting with multiple installed versions of the same gem.
  3. All dependencies are documented right along side the code.
You can visit http://gembundler.com for the details but I’ll comment on a few things we do often.

By default bundler installs gems to the default system location (needing root access), to install to an alternate location use the –path argument.

$ bundle install ––path=vendor

Once installed Bundler will remember this location (.bundle/config) and you just need to run bundle install whenever your Gemfile changes.

Want to use gems that aren’t available from rubygems?  We do.  If it’s stored in git and has a .gemspec at its root you can specify the URL and bundler will install the gem directly from the source.

gem “nokogiri”, :git => “git://github.com/tenderlove/nokogiri.git”

Creating Gems

Use bundler to get a quick start on your own gem. Bundler will create the basic layout with all the necessary files and even initialize it as a git repository.  Just ‘git add remote’ and push.  You can now reference your new gem in the Gemfile as shown above.

jheth@server:~$ bundle gem example
      create  example/Gemfile
      create  example/Rakefile
      create  example/.gitignore
      create  example/example.gemspec
      create  example/lib/example.rb
      create  example/lib/example/version.rb
Initializating git repo in /home/jheth/example

I use Bundler for every Ruby project I work on.  Deployments are a breeze and I can be confident my code will work wherever it goes.

Categories: Uncategorized Tags: