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