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

ShortURL on Github

Posted by Thu, 24 Jul 2008 14:56:00 GMT

After noticing a few patch requests on Rubyforge.. I decided that I’d put the ShortURL gem up on GitHub as I spend quite a bit of my time there these days. :-)

I’ve also thrown up a few lines of code so that you can get the gist of the gem. ;-)

RubyURL meets Zombies!

Posted by Tue, 22 Apr 2008 15:43:00 GMT

Last Friday, Greg Borenstein sent me a link to ZombieURL after it got launched. The folks at Bottlecap Labs took RubyURL and threw in Zombies… the rest you’ll have to see for yourself.

There… I warned you.

You can check out the source code for ZombieURL on GitHub

You can also grab the underlying source code for RubyURL on GitHub.

I’d love to see what other fun things people come up with to do with RubyURL.

git-svn is a gateway drug

Posted by Fri, 11 Apr 2008 02:28:00 GMT

As we’re migrating away from Subversion to Git, I’m having to learn a lot about git-svn. Andy has posted a few articles on this topic, but I wanted to share a quick tip that I find myself forgetting.

Working with Subversion branches

While you’re hopefully already familiar with how great local branches are with Git, you might not know that you can connect local branches to remote branches in your Subversion repository. This allows those of us who are using Git locally to work against Subversion branches.

I’m going to assume the following:

  • Your team is using Subversion
  • Your team already has a branch that you’re working in
  • Your team is following Subversion directory conventions (branches/, tags/, and trunk/)
  • You have Git installed (with SVN extensions)

Checkout the Subversion project with Git

Please visit Andy’s tutorial, Git SVN Workflow, for a more detailed explanation of the following commands.

First, we’ll initialize your new local Git repository with git-svn.


  git svn init -s http://svn.yourdomain.com/repos/project_name

Now, you’ll change directories to your new Git repository.


  cd project_name

Let’s fetch all previous revisions into your local repository1.


  git svn fetch

Great, once this is done… you’re master (local) branch is linked to trunk/.

Mapping a local repository to a remote branch

Assuming that your team is working in a Subversion branch on the current iteration of work. Our team has a naming convention for branches for each iteration. For example, if we’re in Iteration 18, we’ll write this as ITER-018 everywhere (Basecamp, Lighthouse, Subversion, etc…). At the start of each iteration, we create a new branch with this naming convention.

For ITER-018, the Subversion branch would be located at:

  • http://svn.yourdomain.com/repos/project_name/branches/ITER-018

If you were to do a git branch -r, you should see ITER-018 show up in the list. Now, the one thing that wasn’t clear when I first read the git-svn documentation was that you can’t just checkout that branch with one command. In fact, this has tripped me up a few times.

First, you’ll need to checkout a new local branch. I’ve opted to come up with my own convention for local branches and in this case, I’ll name it iter_018.


  git co -b iter_018

So, now I’m in the iter_018 branch, which is local. I’m currently still mapped to trunk/, which isn’t what we want. However, all we need to do is reset where Git is currently pointed to. We can run git reset to point this to the ITER-018 branch.


  git reset --hard ITER-018

That’s it! Now, the local iter_018 branch will point to branches/ITER-018 in your Subversion repository. This will allow you to work with your existing repository branch and still reap the benefits of local Git repositories.

What about master?

Good question. The git reset command that you ran will ONLY apply that that individual local branch. So, master is still pointing to trunk/. This will allow you to have several local branches that map to remote branches.

Next Steps…

If you’re working with Git already.. great!

If you’re working in an environment that using Subversion, git svn provides you the ability to start exploring Git without making your entire team switchover. Perhaps your a consultant and working for a client that uses Subversion… no problem!

We’re still using Subversion for past client projects and are considering GitHub, which just launched (to the public) today for future projects. A few of us are already using GitHub for open source projects.

Fun.. I just saw the following tweet pass by as I began to wrap up this post.

rails on github
Uploaded with plasq’s Skitch!

Check out Rails on GitHub!

The Gateway Drug… Git reminds me of Cake

Questions?

I know that I glossed over a few things, so feel free to post questions and/or tips for others who are looking to dabble with Git.

1 You’ll likely have problems if you don’t have a Git authors file specified in your git config.

I am forking Rails

Posted by Wed, 02 Apr 2008 19:01:00 GMT

...well, creating a fork on GitHub. ;-)

fork rails
Uploaded with plasq’s Skitch!

It appears that Rails is moving from Subversion to Git!

Courtenay posted this a little while ago.


git clone git://github.com/rails/rails.git

Check it out the Ruby on Rails project on GitHub.

Start working on your next patch with git…


git clone git://github.com/rails/rails.git
cd rails
git br -a
git br my_patch
git co my_patch

This is cool news. :-)

Launch your own RubyURL

Posted by Sat, 01 Mar 2008 23:31:00 GMT

A few weeks ago, I moved RubyURL from subversion to git. During that process, I decided to use my invite to GitHub and have decided to go ahead and open up the source code.

It’s currently a whopping 92 LOC with a 1:2.5 code to spec ratio. (I had a goal to keep is below 100 LOC)

Feel free to grab it and help contribute. This has served almost 14 million redirects since August 2007 and is running on a Rails Boxcar.

To grab it with git.. run: git clone git://github.com/robbyrussell/rubyurl.git.

Feel free to submit tickets to the Rubyurl ticket system.

Enjoy!

UPDATE Ryan McGeary was kind enough to be the first person to help track down a bug and submit patches. :-)

Older posts: 1 2 3