Skip to content

Commit 024bfd2

Browse files
committed
Merge pull request #63 from nruth/master
Update switch_command.rb
2 parents 2d85738 + b48e860 commit 024bfd2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Support/lib/rspec/mate/switch_command.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,11 @@ def klass(relative_path, content=nil)
176176

177177
def write_and_open(path, content)
178178
`mkdir -p "#{File.dirname(path)}"`
179-
`touch "#{path}"`
179+
File.open(path, 'w') do |f|
180+
f.write "# -*- encoding : utf-8 -*-
181+
require 'spec_helper'"
182+
end
180183
`"$TM_SUPPORT_PATH/bin/mate" "#{path}"`
181-
`osascript &>/dev/null -e 'tell app "SystemUIServer" to activate' -e 'tell app "TextMate" to activate'`
182-
183-
escaped_content = content.gsub("\n","\\n").gsub('$','\\$').gsub('"','\\\\\\\\\\\\"')
184-
185-
`osascript &>/dev/null -e "tell app \\"TextMate\\" to insert \\"#{escaped_content}\\" as snippet true"`
186184
end
187185
end
188186
end

0 commit comments

Comments
 (0)