Skip to content

Loading…

Creating of "Alternate File" when not existing breaks in TM2 #38

Closed
tobstarr opened this Issue · 26 comments
@tobstarr

The Problem seems to be, that the format of the *.tmSnippet files changed from plain XML to "Apple binary property list".

https://github.com/rspec/rspec-tmbundle/blob/master/Support/lib/rspec/mate/switch_command.rb#L121

Is there anyone working on that already?

@dchelimsky
RSpec member

Nope.

@pcasaretto

+1 on this issue, it would be great if you could solve that @tobstarr

@tobstarr

tobstarr/rspec-tmbundle@61a70bb

Does not raise an encoding-error any more (at least I got one) but it is also not using the snippet yet. I still did not look into when the plists are actually "compiled".

@pcasaretto

hey @tobstarr did you ever get this working?

@OutlawAndy

Is it safe to say that this project has been abandoned?
I have run into this error as well, but it doesn't appear that this repo has seen any activity at all in 6months.

I absolutely respect busy devs, with lives outside of open source. Just trying to get an idea of what to expect. Thank you.

@dchelimsky
RSpec member

@jperkins - you asked about maintaining this a while back. Still interested?

cc @myronmarston

@alindeman

I do think this project needs a Textmate + RSpec developer to help maintain it.

@myronmarston
RSpec member

Yep. I haven't used Textmate in years. We need someone who actually uses textmate to help maintain this.

@dchelimsky
RSpec member

@myronmarston was CC'ing you to get this on your radar - not to get you to maintain it ;)

@myronmarston
RSpec member

I know, I was just agreeing with @alindeman :).

@pcasaretto
@pcasaretto

Know what?
If @jperkins is not interested I'll give it a shot.
Dont want this repo to die.

@jperkins
@jperkins jperkins was assigned
@jperkins

I've created a pull request #48 with some work that came up during exploratory coding that I was doing. I'm looking for comments, suggestions, etc. If we can, let's comment on that pull request there. Also, @pcasaretto do you have commit access?

@dchelimsky
RSpec member

@pcasaretto you do now :)

@alindeman

@pcasaretto you do now :)

:thumbsup:

@pcasaretto

I'm feeling a bit like Tweek from South Park here:

  • Oh man, i'ts too much pressure!

Jokes aside, thanks!

@jperkins

For those interested: I've setup a Google Group for us to discuss release planning, etc. Please join at:
https://groups.google.com/forum/#!forum/rspec-tmbundle

@bowsersenior

Not sure if a fix is in the works for this.

I found a hack to work around the issue. Comment out lines 181-185 (the last 3 lines of code in write_and_open in ~/Library/Application Support/Avian/Bundles/RSpec.tmbundle/Support/lib/rspec/mate/switch_command.rb and textmate 2 won't crash anymore.

      def write_and_open(path, content)
        `mkdir -p "#{File.dirname(path)}"`
        `touch "#{path}"`
        `"$TM_SUPPORT_PATH/bin/mate" "#{path}"`
        # `osascript &>/dev/null -e 'tell app "SystemUIServer" to activate' -e 'tell app "TextMate" to activate'`
        #
        # escaped_content = content.gsub("\n","\\n").gsub('$','\\$').gsub('"','\\\\\\\\\\\\"')
        #
        # `osascript &>/dev/null -e "tell app \\"TextMate\\" to insert \\"#{escaped_content}\\" as snippet true"`
      end

This hack will create a blank new spec file in the right place, but won't have the template filled in, since that's the part of the code that causes the crash.

Hope this helps someone and hope a real fix will be possible.

@pcasaretto

Think I'm gonna remove the snippets for now. Or hard code it.
At least the command will the useful again.
Anyone against it?

@simonc

@pcasaretto nope, go ahead :)

@nruth

Following the work-around you found I removed the 3 lines mentioned and replaced the "touch" shell call (why aren't they done in Ruby?) with:

File.open(path, 'w') do |f|
  f.write "# -*- encoding : utf-8 -*-
  require 'spec_helper'
"
end

Not a general solution and doesn't insert any of the class names etc, but it's enough for me, and nice to get this very handy feature working again :)

@noniq

It this still an issue for anybody with the current versions of TextMate and the bundle?

@elia elia referenced this issue
Closed

A bunch of stuff 🐸 #79

12 of 12 tasks complete
@noniq noniq added the need info label
@noniq

Closing this now. Please reopen if it’s still an issue.

@noniq noniq closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.