Yehuda Katz is a member of the Ember.js, Ruby on Rails and jQuery Core Teams; his 9-to-5 home is at the startup he founded, Tilde Inc.. There he works on Skylight, the smart profiler for Rails, and does Ember.js consulting. He is best known for his open source work, which also includes Thor and Handlebars. He travels the world doing open source evangelism and web standards work.

Textmate gem

As I said last week, I created thor while building a binary to handle my textmate bundles.

I wanted a way to install/uninstall/list textmate bundles like gems. Textmate already has a centralized svn repository for its bundles, and there’s a way, through AppleScript, to tell Textmate to reload bundles. The end result: a textmate binary that handles textmate bundles like gems.

$ textmate remote

Marcomates Trunk Remote Bundles
-------------------------------
ANTLR
ASP
ASP_vb_NET
ActionScript
Active4D
Ada
Apache
AppleScript
Bison
Blogging
Bulletin Board
Bundle Development
C++ Qt
C
CSS
CTags
CVS
ColdFusion
Context Free
D
Darcs
... snip ...

$ textmate remote JavaScript

Marcomates Trunk Remote Bundles
-------------------------------
JavaScript MooTools
JavaScript Prototype & Script_aculo_us
JavaScript YUI
JavaScript jQuery
JavaScript

Marcomates Review Remote Bundles
--------------------------------
JavaScript JSDoc
JavaScript MooTools
JavaScript Prototype & Script_aculo_us
JavaScript

$ textmate list

Application Bundles
-------------------
ActionScript
Apache
AppleScript
Blogging
Bundle Development
C
CSS
... snip ...
User Pristine Bundles
---------------------

User Bundles
------------
RSpec
Ruby Haml
Ruby Sass
Ruby
Rucola
Treetop

System Pristine Bundles
-----------------------

System Bundles
--------------
Ragel

$ textmate install

Checking out JavaScript jQuery…
svn co http\://macromates.com/svn/Bundles/trunk/Bundles/JavaScript\ jQuery.tmbundle /Users/wycats/Library/Application\ Support/TextMate/Pristine\ Copy/JavaScript\ jQuery.tmbundle 2>&1
A /Users/wycats/Library/Application Support/TextMate/Pristine Copy/JavaScript jQuery.tmbundle/Commands
A /Users/wycats/Library/Application Support/TextMate/Pristine Copy/JavaScript jQuery.tmbundle/Commands/Documentation for Word : Selection.tmCommand
A /Users/wycats/Library/Application Support/TextMate/Pristine Copy/JavaScript jQuery.tmbundle/Snippets
A /Users/wycats/Library/Application Support/TextMate/Pristine Copy/JavaScript jQuery.tmbundle/Snippets/each.tmSnippet
A /Users/wycats/Library/Application Support/TextMate/Pristine Copy/JavaScript jQuery.tmbundle/Snippets/clone.tmSnippet
… snip …
Checked out revision 9623.
Reloading Bundles…
Done.

$ textmate uninstall "JavaScript Prototype & Script_aculo_us"

Removing bundle...
Reloading bundles...
Done.

Pretty cool, huh? If you want it, do gem install wycats-textmate --source http://gems.github.com.

20 Responses to “Textmate gem”

Cool idea.

A bunch of tm bundles are now being cloned onto github and/or being hosted only on github. I name all mine xxx-tmbundle (e.g. hobo-tmbundle).

Perhaps a search of github projects by *-tmbundle might be a bonus too? The UI might need to prompt for the actual bundle’s name (e.g. hobo-tmbundle -> Hobo.tmbundle folder)

Might be fun.

Another bonus feature might be a bash autocompletion script for the textmate command. So many cool features :)

This looks like a great tool, thanks for writing it.

Nice. Can it be configured to use /Library/Application Support/Textmate instead of ~/Library/Application Support/Textmate?

Thanks!
Hit a bug though: the textmate file in the gem directory had permission 733 (rwx-wx-wx) instead of 755 (rwxr-xr-x) which causes /usr/bin/textmate to not load it.

No worky… what am I doing wrong??

/usr/bin/textmate:19:in `load’: no such file to load — textmate (LoadError)
from /usr/bin/textmate:19

Andrew — chinclow was correct about the permissions of the textmate file in the gem directory. To fix your problem cd to your textmate gem directory and run “sudo chmod 755 bin/textmate”. On my system all gems are under “/usr/local/lib/ruby/gems/1.8/gems”. Your system may vary.

To Follow up on what Jason Said, on mac the gems are stored in /Library/Ruby/Gems/1.8/gems/

Thanks,
Clayton Yocom

problem:
textmate remote

GitHub Remote Bundles
———————
/Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:29:in `remote’: undefined method `[]‘ for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:25:in `map’
from /Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:25:in `remote’
from /Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:16:in `each’
from /Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:16:in `remote’
from /Library/Ruby/Gems/1.8/gems/thor-0.9.9/lib/thor/task.rb:27:in `send’
from /Library/Ruby/Gems/1.8/gems/thor-0.9.9/lib/thor/task.rb:27:in `run’
from /Library/Ruby/Gems/1.8/gems/thor-0.9.9/lib/thor/task.rb:20:in `parse’
from /Library/Ruby/Gems/1.8/gems/thor-0.9.9/lib/thor.rb:78:in `start’
from /Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:218
from /usr/bin/textmate:19:in `load’
from /usr/bin/textmate:19

any ideas?

Same problem as Werner here. :-(

If you’re getting a load error it might be a permission issue.

If you installed the gem as root and then try to run the binary as an unprivileged user ruby will report the file doesn’t exist.

You can chown the file to give you full access or better make it world executable.

HTH,
James

Where is thor/textmate referencing the uri to the svn repository? Alan changed the repository location to “http://svn.textmate.org/trunk/” so the command ‘textmate remote’ generates an error due the use of the old uri.

What about versioning and update command?

Is this project dead?

Leave a Reply

Archives

Categories

Meta