[rspec-users] TextMate language bindings/modes

Christopher Bailey chris at cobaltedge.com
Sat Jun 28 00:27:17 EDT 2008


Thanks, went through that and nuked any bindings, as well as removed
.rb from the regular Ruby filetypes.  That helped some, but then RSpec
Story Runner still wasn't working.  What I found I had to do there was
tweak it's filetypes, to not just be .rb (since now Rails binding
picks that up), but be story.rb:

	fileTypes = ( 'story.rb' );

Now, as far as I can tell, it properly detects story runner files,
steps files, regular RSpec spec files, plain text stories, and then
all other .rb's get set to Ruby on Rails.  Even plain Ruby scripts get
properly set to Ruby since they have the "firstline" setting that
searches for the ruby executable in the text.  Awesome!  Thanks for
the tip Ben!

Oh, and one note, while the RSpec Story Runner has detection for
"steps_for", my story runner files don't usually start with that, they
usually require some helpers or what not first, so that's why the
standard rule there wasn't picking those up.

On Fri, Jun 27, 2008 at 1:03 PM, Ben Mabey <ben at benmabey.com> wrote:
> Christopher Bailey wrote:
>>
>> I'm wondering if anyone has TextMate working really smoothly where it
>> properly sets the language binding for the given type of file, in
>> relation to Rails, RSpec, RSpec Plain Text Story, RSpec Story Runner,
>> and RSpec Story Steps files?  Mine seems to get confused easily, and
>> I'd like to figure out if there's a solid way to specify which binding
>> to use for what files, etc.?
>>
>> Currently, it seems to detect the Plain Text Story files fine.  But,
>> it is not detecting steps files or the story runner files.  From what
>> I can tell, I've named these according to the usual rules.  e.g. for
>> steps files, I have them in .../stories/steps/theme_steps.rb for
>> example.  And for the plain text story and matching runner file, I
>> have .../stories/themes_story and .../stories/themes_story.rb.
>>
>> Further, if I manually set a file to RSpec Story Runner, then after
>> that every .rb file I open will be that way.  It seems this is one of
>> the core problems - the ".rb" binding is greedy - whoever sets it last
>> sets it for everything, and anytime it changes, it changes for all.
>>
>>
>
> Christopher,
> In the past I have had my bindings messed up so that all my ruby files were
> treated as rspec files.  This post walks through how you can reset your
> bindings:
> http://blog.macromates.com/2007/file-type-detection-rspec-rails/
>
> Hope that helps,
> Ben
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



-- 
Christopher Bailey
Cobalt Edge LLC
http://cobaltedge.com


More information about the rspec-users mailing list