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

Posted by Dr Nic on January 31, 2008 and blessed with 62 comments

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. First look at rails 3.0.pre This article is out of date in some aspects....
  2. Rails themes can remember things I was getting annoyed at having to remember all the...
  3. Install any HTML theme/template into your Rails app Have you ever even bothered to Google for “rails...
  4. Closing in on The Dream: “one-click-to-deploy Rails apps” Got a simple app you want to build? Allocate...
  5. Need Rails Developers? Hire Australians There’s been some malarky very recently about “how do...
Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. Ilya Sabanin Thu, 31 Jan 2008 13:45:59 UTC

    I trying to clone repo using your command (git clone git@github.com:drnic/ruby-on-rails-tmbundle.git “Ruby on Rails.tmbundle”) but it keep asking me password.

    I use Git version 1.5.3.1

  2. Dr Nic Thu, 31 Jan 2008 13:51:02 UTC

    oops, sorry – I pasted the wrong git url.

    Try git clone git://github.com/drnic/ruby-on-rails-tmbundle.git "Ruby on Rails.tmbundle"

    Sorry about that

  3. Ruby Thu, 31 Jan 2008 14:16:21 UTC

    Nic,

    You also forgot the step of cd “Ruby on Rails.tmbundle”
    between the git clone and the git checkout

  4. http://marcjeanson.myopenid.com/ Thu, 31 Jan 2008 14:18:00 UTC

    To create the patch that I sent you I used:
    git-format-patch

  5. lawrence Thu, 31 Jan 2008 15:36:25 UTC

    Holy waves of bliss, I’m bathing alright! Love you, mean it, great hair, hope you win!

  6. Nathan Sutton Thu, 31 Jan 2008 15:43:50 UTC

    It’s no longer detecting file types for me in rails… hrm, I must have changed something else, maybe?

  7. lawrence Thu, 31 Jan 2008 16:03:12 UTC

    btw, isn’t the whole point of git that now anyone can maintain the bundle… instead of sending drnic patches, consider commiting to your own branch, make it public, possibly hosted by github.com. Then drnic can pull from there if he likes. That way everyone gets to see the patches you created, instead of only drnic. Perhaps drnic doesn’t quite like what you do, and therefor doesn’t include it in his master branch, but who knows, maybe a band of others do like what you’ve come up with… no problem, we just pull it in and merge it in our own branch.

    PS. I’ve send you a patch drnic ;)

  8. Dr Nic Thu, 31 Jan 2008 16:15:36 UTC

    @Ruby [via] – thx fixed

    @Nathan Sutton [via] – weird. um. not sure why that might have happened. I’m a ex-Windows user so I suggest you do a reboot… :)

  9. Dr Nic Thu, 31 Jan 2008 16:17:25 UTC

    @lawrence [via] – that’s all true; I’m not sure how easy it easy to get github accounts, nor how many people have setup public repos for me to pull from, so it might be an adoption hurdle.

    But yes, if anyone runs a public clone on github or gitorious or elsewhere, and has goodies, let me know.

  10. Dr Nic Thu, 31 Jan 2008 16:18:25 UTC

    Perhaps it other people do start forks, we can add a FORKS file of repos.

  11. Matt Aimonetti Thu, 31 Jan 2008 16:20:36 UTC

    cool stuff, note that some people might find their “Ruby on Rails.tmbundle” in ~/Library/Application Support/TextMate/Pristine Copy/Bundles

  12. Dr Nic Thu, 31 Jan 2008 16:23:10 UTC

    @Matt Aimonetti [via] – I think no changes ever made to the Pristine Copy, so if that’s your only copy of the Bundle, any changes you make are added into the Bundles area, not onto the Pristine Copy. Makes patching a little harder, but if you’re not using an SCM, its the way to go to manage local changes. [that is, it was built that way]

  13. toolmantim Thu, 31 Jan 2008 17:27:41 UTC

    Nice one Nic!

  14. johan Thu, 31 Jan 2008 19:44:28 UTC

    There’s also an updated git bundle here http://gitorious.org/projects/git-tmbundle for textmate, for those who’re into that sort of thing

  15. Dr Nic Thu, 31 Jan 2008 20:12:19 UTC

    @johan [via] – oh this gives some nicer outputs now. Cool.

  16. macournoyer Thu, 31 Jan 2008 23:14:31 UTC

    ooooh a Git TM bundle ^^, I’ve been dreaming of this for days.

    And an updated Rails bundle.

    Is this christmas?

  17. Ben Thu, 31 Jan 2008 23:52:58 UTC

    Excellent! Thanks, Dr Nic – and @johan! I’m the happiest guy in … well, my office, at least.

  18. New Textmate Ruby on Rails Maintainer Fri, 01 Feb 2008 00:16:28 UTC

    [...] in good open source manner, the maintainership is being passed on to one Dr. Nic Williams of Australia (he’s a good guy, you’ll like him). Thanks to Dr. Nic, we should be seeing [...]

  19. Dr Nic Fri, 01 Feb 2008 09:57:51 UTC

    As a special treat from the makers of GitHub – if you contribute to the TM bundle, you can have a beta GitHub account so you can easily fork my repository and I’ll pull your changes from there (instead of sending patches).

    Of course there is also the free Gitorious by famous Norwegian explorer Johan Sørensen.

  20. Dr Nic Fri, 01 Feb 2008 11:02:57 UTC
  21. A Fresh Cup » Blog Archive » Double Shot #136 Fri, 01 Feb 2008 23:44:08 UTC

    [...] Get ready for the TextMate “Trundle to Rails 2.0 Bundle” – Dr. Nic takes over maintenance. [...]

  22. Damjan Mozetic Sat, 02 Feb 2008 19:31:20 UTC

    Thanks for that! I mean, a lot.

  23. James O'Kelly Sun, 03 Feb 2008 12:10:10 UTC

    Awesome! I am so glad you took this over Nic. I have been hacking away at my bundle since 1.2.1 to get things to work properly and add all the cool new stuff and color formatting.

    I’ll get some changesets ready for ya! :)

  24. Josh Nichols Tue, 05 Feb 2008 05:18:49 UTC

    You might want to quote the file path for the line:

    cd ~/Library/Application Support/TextMate/Bundles/

    Otherwise, it tries to cd into ~/Library/Application.

  25. Dr Nic Tue, 05 Feb 2008 07:31:34 UTC

    @Josh Nichols [via] – thx, fixed.

  26. James Deville Thu, 07 Feb 2008 08:05:47 UTC

    For patches, another nice option is git format-patch -n where n is the number of commits to make patches for.

  27. [...] Behold and keep your eyes on this! [...]

  28. Rails Podcast Brasil - Episódio 4 Thu, 07 Feb 2008 22:34:04 UTC

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

  29. [...] Bundle Editor (here and here). A better option is the new TextMate Rails 2.0 bundle now under development by Dr Nic Williams. Right now, it’s only available for download using git but maybe by the time you read this it [...]

  30. Anonymouse Fri, 29 Feb 2008 15:36:59 UTC

    How about hosting it on SVN — essentially the STANDARD RoR repository, instead of fucking git?

    Why the fuck should I have to download git just to get an updated copy of the rails 2.0 bundle. Come on, man.

  31. Dr Nic Fri, 29 Feb 2008 17:52:49 UTC

    @Anonymouse [via] – when the large changeset is initially done it will be committed to the SVN repo in one patch. The Rails 2.0 upgrade was done outside of SVN to ensure we never broke the SVN repo version for Rails 1.2 apps.

    Please ask questions politely though if you can.

  32. marcin Mon, 10 Mar 2008 06:22:55 UTC

    I think preparing a cheat sheet for this will be good idea.

  33. gohanlon Wed, 19 Mar 2008 04:43:57 UTC

    You can also execute this command instead of manually telling TextMate to reload bundles: osascript -e 'tell app "TextMate" to reload bundles'.

  34. Paul Tue, 01 Apr 2008 12:19:53 UTC

    This does not work:

    cd “~/Library/Application Support/TextMate/Bundles/”

    Quoting the ~ prevents the shell from expanding it. Do this instead:

    cd ~/”Library/Application Support/TextMate/Bundles/”

  35. Dr Nic Tue, 01 Apr 2008 19:34:57 UTC

    @Paul [via] – thx, fixed

  36. bondibox Wed, 02 Apr 2008 06:56:51 UTC

    I’ve tried with the default Ruby on Rails bundle that came with TextMate, as well as this new bundle with 245 items. Even though I can see the Rails bundle available in the bundle editor and all the drop down GUI commands work for it, CTRL-CMD-T does not list the Rails bundle items and the key equivalents don’t work. I installed the RSpec bundle in the same location and it works o.k.

  37. Dr Nic Wed, 02 Apr 2008 17:32:22 UTC

    @bondibox [via] – the items shown in the CTRL+CMD+T popup depend on the scope where the cursor is. So first, it requires you have a document open, and then it depends on the “language” or “syntax” that you select for that document. By default, a *.rb file might be allocated Ruby or “Ruby on Rails” syntax; but you can manually change it with SHIFT+CTRL+ALT+R and select “Ruby on Rails”. The CTRL+CMD+T popup should work for you then.

  38. James Wigs Mon, 19 May 2008 21:56:49 UTC

    Excellent; for some reason the TextMate folder was missing in Application Support, as I have only used bundles that were included in the base installation (that were oddly not added to the Application Support folder…).

    Debugged using Command-R was throwing errors because of use of Ruby 1.2.6; this bundle was the perfect solution.

    So – for others who may have this problem, I just created the required folders (/TextMate/Bundles) and ran through the commands (mv didn’t work obviously) and all is working fine, so fresh!

    Thanks for the maintenance of this bundle – making things much easier :)

    James

  39. jOe Tue, 03 Jun 2008 11:56:08 UTC

    I am receiving the below message when I attempt to perform a simple tasks, such as creating a view via the navigation menu:

    /Users//Library/Application Support/TextMate/Bundles/Ruby on Rails.tmbundle/Support/lib/rails/text_mate.rb:54:in ‘method_missing’: undefined method ‘rescan_project’ for TextMate:Module (NoMethodError)
    from /Users//Library/Application Support/TextMate/Bundles/Ruby on Rails.tmbundle/Support/lib/rails/command_go_to_file.rb:15:in ‘alternate’
    from /Users//Library/Application Support/TextMate/Bundles/Ruby on Rails.tmbundle/Support/bin/go_to_alternate_file.rb:13

    The new file eventually displays within the tree. Any help would be greatly appreciated.

    Thank you,

    jOe

  40. Dr Nic Tue, 03 Jun 2008 12:44:14 UTC

    @joe – post any bugs to the google group: http://groups.google.com/group/rubyonrails-textmate

  41. Rev. Dan Thu, 10 Jul 2008 10:48:33 UTC

    <3 Dr. Nic!

  42. Deke Sun, 14 Sep 2008 18:02:20 UTC

    The link to http://groups.google.com/group/rubyonrails-textmate doesn’t seem to be working. I am following along on the peepcode textmate tutorial and when I select a div to turn into a partial, then press shift, control, H, it creates the partial, but in the show.html.erb I get the error:

    /Users//Library/Application Support/TextMate/Bundles/Ruby on Rails.tmbundle/Support/lib/rails/text_mate.rb:54:in `method_missing’: undefined method `rescan_project’ for TextMate:Module (NoMethodError)
    from /Users//Library/Application Support/TextMate/Bundles/Ruby on Rails.tmbundle/Support/bin/create_partial_from_selection.rb:46

    Any ideas?
    Also, when I went to ~/Library/Application Support/. There was no TextMate directory. I found a TextMate directory at Users/username/Library/Application Support/Textmate. but there was no Bundle directory so I created one and ran the git command from there. Was that the correct thing to do? I’m afraid I’m a bit of a noob when it comes to all of this. I’m a .Net developer whose seen the light.

  43. Dr Nic Sun, 14 Sep 2008 18:09:44 UTC

    @Deke – there is something wrong with the group, and others have reported it too. Unfortunately my google groups account is plagued by “The owner of this group has banned you from this group.” in all groups, even those I’ve never visited before. I’ve tried emailing google groups support, but haven’t heard anything. So this makes it impossible for me even begin to investigate a solution. Its been a few weeks now for both issues so we may just need to move all tickets + discussion elsewhere.

    ~/Library/Application Support/ and /Users/username/Library/Application Support/ should be the same folder. But, yes add the Bundles folder if it doesn’t already exist. Typically this folder is created when you first extend any bundle or create a new bundle yourself via TextMate.

  44. Matthias Wed, 17 Sep 2008 19:16:04 UTC

    @Deke
    If you have cloned the Bundle from the git repo,
    open a terminal and run the following commands:

    cd ~/Library/Application Support/TextMate/Bundles/Ruby on Rails.tmbundle
    git reset --hard a89dcbfd6bb37f827df

    This will undo some recent changes.
    It is not an elegant solution but the
    commands in the Rails bundle will work again.

  45. Matthias Wed, 17 Sep 2008 19:17:51 UTC

    The engine has eaten a dash!

    There must be TWO DASHES before the hard in the second command.

  46. Dr Nic Wed, 17 Sep 2008 19:21:25 UTC

    @Matthias – I’m confused which commit you are rolling back to. On http://github.com/drnic/ruby-on-rails-tmbundle/commits/master which commit is this? That is, which subsequent commit is causing the problem?

  47. Dr Nic Wed, 17 Sep 2008 19:29:58 UTC

    @Mattias – fixed.

  48. Jonathan Mon, 22 Sep 2008 09:27:15 UTC

    Hi – the generator scripts aren’t working. They’re pulling up the window saying successfully generated model, but with no output and no result. Any tips on how to debug the problem if not solve it?

  49. Mikael Fri, 03 Oct 2008 09:17:47 UTC

    Sorry if this is not related in any way but I’ve replaced my original bundle with this one (following the guide) but is there a difference between bundles and themes? Because I thought I would have my “belongs_to” in red (like my friend has in his TM theme, and we’re using the same versions and theme)..

    Maybe I’m thinking of this the wrong way but isn’t this one suppose to do that for me?

    Thanks

  50. Dr Nic Fri, 03 Oct 2008 09:50:11 UTC

    @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.

  51. Mikael Fri, 03 Oct 2008 11:50:44 UTC

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

  52. lowell Sat, 04 Oct 2008 14:13:19 UTC

    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.

  53. Dr Nic Sat, 04 Oct 2008 22:07:27 UTC

    @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.

  54. Billy Thu, 09 Oct 2008 01:02:02 UTC

    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.

  55. Billy Thu, 09 Oct 2008 03:23:01 UTC

    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.

  56. Marty McGee Wed, 10 Dec 2008 02:07:45 UTC

    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.

  57. Elfred Pagan Thu, 18 Dec 2008 08:52:12 UTC

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

  58. bitbutter Tue, 27 Jan 2009 07:50:28 UTC

    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?

  59. Dr Nic Wed, 28 Jan 2009 21:04:46 UTC

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

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

  61. Rspec beginnings « it'sthe.damncarousel Sat, 29 Aug 2009 07:24:25 UTC

    [...] 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 [...]

Comments