Dr Nic

Get ready for the TextMate “Trundle to Rails 2.0 Bundle”

logo_bundle.png

Have you noticed lately that the Rails TextMate git pull origin two_point_oohbundle (also installed with e – the Text Editor for Windows) isn’t quite as helpful as it once was – guiding and amplifying your rails app development.

Your resourceful/restful rails apps are now filled with named routes, but none of the helpers (link_to, redirect_to, etc) use them. The default view template was still rhtml for a long time (latest svn trunk fixes this to be html.erb, though Marc Jeanson is having a crack at supporting both through a per-project config file).

Or perhaps you were hoping for some snippets for new features of Rails 2.0: assert_difference (asd), assert_select (ass), respond_to (rst).

Or just maybe, you’ve been updating your local bundle to Rails 2.0 already? Please say yes, please say yes. If you are saying “yes”, read at the bottom for how/where to send me the patches. If you are saying “no”, read at the bottom for how/where to start creating patches and sending them to me.

Firstly, DHH didn’t write the Rails bundle

I didn’t know this – I just assumed the guy who created Rails and helped promote TextMate also created the Ruby on Rails TextMate bundle. Instead if was WWF’s “The Rock” himself Duane Johnson (figurines sold separately, and may look different to the real Duane Johnson who writes Rails code instead of prancing around in his underpants with other adult males in confined spaces).

The TextMate SVN logs say that it the bundle was first committed in Jan 2005. Its now Jan 2008. That’s three years of maintaining a suite of code that thousands of people take for granted every day writing Rails code. What a champion.

Like the Australian Cricket team’s wicketkeeper, Adam Gilchrist, he’s also retiring at the top of his game.

New Maintainer… me

Instead of maintaining my own projects, I’ve decided to maintain this one. I love the TextMate bundles. Before I had a Mac, I ported them across to RadRails and many RadRailers entered a golden era of snippet happiness.

My bundle-fu may not be the equivalent of Bruce Lee, but I’m keen to see my favourite Rails tool live on strong.

Bleeding edge bundle

Whilst the TextMate SVN administrators process the maintainer change request (Allan is on holidays somewhere and he took the house keys with him), you might think all is lost!

Never.

The straight-off-the-cow bleeding edge Rails bundle can be accessed via Git. Specifically the branch two_point_ooh.

So, let’s all do away with our pre-existing Rails bundle and live on the edge.

cd ~/"Library/Application Support/TextMate/Bundles/"
mv "Ruby on Rails.tmbundle" "RoR.tmbundle.orig"
git clone git://github.com/drnic/ruby-on-rails-tmbundle.git "Ruby on Rails.tmbundle"
cd "Ruby on Rails.tmbundle"
git checkout --track -b two_point_ooh origin/two_point_ooh
git pull

Now, back in TextMate, go to menu “Bundles” > “Bundle Editor” > “Reload Bundles”.

You, my friend, are sitting pretty.

Upgrading to when newer blood is on the bleeding edge

Coming back for more?

cd ~/"Library/Application Support/TextMate/Bundles/Ruby on Rails.tmbundle"
git checkout two_point_ooh  # optional; only if you changed to another branch etc
git pull

Now, back in TextMate, go to menu “Bundles” > “Bundle Editor” > “Reload Bundles”.

Bathe yourself in glory. Splash it all over yourself.

Submitting patches

If you go into TextMate, launch the Bundle Editor (Cmd+Alt+Ctrl+B) and change something in the Ruby on Rails bundle, then files will added/changed within your local git clone.

What I mean is, you can very simply submit patches now. [When I say "simply", I mean, "I think this is the best approach but I could be completely wrong here..."] Git is so cool that I don’t know what its doing most of the time; but let’s hang in there as a team.

cd ~/"Library/Application Support/TextMate/Bundles/Ruby on Rails.tmbundle"
git add .   # to add any new files/snippets/commands you created; TextMate uses one file per snippet
git commit -a -m "Useful message about this patch goes here"
git diff -p HEAD^ HEAD

[Theoretically] this creates a patch based on your most recent commit. So you can easily create patches for changes even if your repository and the remote/central/bleeding edge repository look different.

If your patch was created over several commits, then replace HEAD^ with HEAD~4, if there were 4 commits.

I think. God I could be wrong about this though.

Just try your best and if it works, let me know and I’ll remove all this “I don’t know what I’m talking about” text and future readers will think I know everything. Web 2.0 rocks.

Send patches to…

Me drnicwilliams@gmail.com [update] or via the new Google Group.

Update: Note there is a new Google Group (rails-textmate) created in Feb 2009 due to Spam and loss of admin control on original group.

Want to fork the git repo? Use a free account at Gitorious or GitHub.

Google Groups
Ruby on Rails: TextMate
Visit this group

Trundle to Rails 2.0 Bundle

Arguably, we just keep patching the bundle forever and bleeding edges will continue to live happily within the blood and muck of said existence.

But, lots of other people want nicely zipped up bundles. No doubt “e – the Text Editor” will want a “released” version so they can clean it of all the ugly things they can’t yet replicate like Macros. And eventually I’ll push it all down to the SVN repo and it will be released with future TextMate upgrades.

So, there will be a “Rails 2.0 compatible” grand opening one day soon. Probably before 14th of March 2008, when I’m giving a “What’s new in Rails 2.0?” talk at QCON London. Showing off the new bundle will be sweet.

That gives us 6 wks to refactor this bundle to make it a shining example of all that is wonderful in Rails 2.0. Every patch helps.

[Please consider Rails 1.2.6 and before developers when conceiving of patches, and please consult your doctor if pain persists.]

Related posts:

  1. Instant new Rails applications with the App Scrolls When I start a new project I want to start...
  2. Packaging TextMate bundles in OS X DMGs Last week Engine Yard released a CLI for their Engine...
  3. Validate and Save your Ruby in TextMate – with secret Rubinus superpowers In some TextMate bundles, if you save a file it...
  4. Using CoffeeScript in Rails and even on Heroku I’m pretty excited about CoffeeScript as a clean-syntax replacement for...
  5. First look at rails 3.0.pre This article is out of date in some aspects....

62 Responses to “Get ready for the TextMate “Trundle to Rails 2.0 Bundle””

  1. Dr Nic says:

    @Mikael check that you’re in “Ruby on Rails” mode and not “Ruby” mode (its in the bottom status bar). You can select your mode explicitly by typing Shift+Ctrl+Alt+R and selecting the one you want.

  2. Mikael says:

    Thank you Dr Nic, that solved my problem. :)

  3. lowell says:

    hey there.. thanks for making this available to everyone..

    umm.. you know.. a blog is a real weird place for support.. and, as you know, your google group has issues.. is lighthouseapp free? or is there anything like it that would be more appropriate for support and bug reporting that you could move it to?

    thanks.

  4. Dr Nic says:

    @lowell – 2 weird things happened; i) the google group was destroyed somehow; ii) my google groups account was banned from all groups for no known reason.

    My plan is to create lighthouse accounts for this and all other projects. Hopefully I get to it soon.

  5. Billy says:

    I seem to be having the same problem as Jonathan. I am actually following the peepcode cast for textmate and when running the generator to create a new model, controller, etc. It brings up a blank confirmation box and does nothing. Since the google sites are gone, I was hoping someone could provide some insight on this.

  6. Billy says:

    Scratch my last comment, I figured out how to fix this issue. In the latest version of the TextMate screen cast @ peepcode it also goes through this.

    In your terminal:

    cd /Applications/TextMate.app/Contents/SharedSupport/Support/lib
    mv Builder.app Builder.app.off

    There is a version conflict between the built in builder and your current installed ruby version. Restart TextMate and this should fix the issue.

  7. Marty McGee says:

    Hey – I’m having the same issue that Johnathan and Billy have commented on…

    Running Rails generator scripts does not produce any generated code. I tried renaming my Builder.rb (not Builder.app) file under “/Applications/TextMate.app/Contents/SharedSupport/Support/lib” as Billy suggested, but that did not work completely. By renaming Builder.rb to Builder.rb.off, TextMate now allows the script generation of Models and Controllers, but not Scaffolds. AND you have to minimize TextMate and go back into it to see the generated scripts.

    So overall, still quite buggy with the Rails script generation within TextMate using the Ruby on Rails.tmbundle downloaded from GitHub.

    I’m quite hesitant to update my Ruby installation to 1.9 just to see if the TextMate bundle script generations will work, so until then, I recommend using the good-ol’ Terminal to run “script/generate model post” as you watch this peepcode screencast.

  8. Elfred Pagan says:

    Marty,
    I was able to get the generators to work by renaming the Builder.rb file in ~/Library/Application Support/Pristine Copy/Support/lib.

  9. bitbutter says:

    Getting stuck following the install instructions here. (Git n00b)

    When i run:

    my-computer-2:/library/Application Support/TextMate/Bundles/Ruby on Rails.tmbundle me$ git checkout –track -b two_point_ooh origin/two_point_ooh

    I get:

    git checkout: updating paths is incompatible with switching branches/forcing
    Did you intend to checkout ‘origin/two_point_ooh’ which can not be resolved as commit?

  10. Dr Nic says:

    @bitbutter – use the master branch; two_point_ooh is no more.

  11. [...] I mention Textmate has its own Ruby on Rails bundle? Mac + Textmate + Ruby on Rails = a lot of [...]

  12. [...] generator, it would run but no actually generate anything. I found the comment #56 by Billy on this post to do the trick. However that did affect another bundle, but nothing I was using (forgot which [...]