Skip to content

Commit

Permalink
Merge pull request #63 from nruth/master
Browse files Browse the repository at this point in the history
Update switch_command.rb
  • Loading branch information
pcasaretto committed Dec 31, 2013
2 parents 2d85738 + b48e860 commit 024bfd2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Support/lib/rspec/mate/switch_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,11 @@ def klass(relative_path, content=nil)

def write_and_open(path, content)
`mkdir -p "#{File.dirname(path)}"`
`touch "#{path}"`
File.open(path, 'w') do |f|
f.write "# -*- encoding : utf-8 -*-
require 'spec_helper'"
end
`"$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
end
end
Expand Down

0 comments on commit 024bfd2

Please sign in to comment.