Created
August 22, 2011 18:53
-
-
Save markbates/1163187 to your computer and use it in GitHub Desktop.
Launch TextMate with Pry (.pryrc)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/md5' | |
require 'fileutils' | |
Pry.config.commands.command "mate" do | |
FileUtils.mkdir_p(File.expand_path('~/tmp/pry')) | |
file = File.expand_path("~/tmp/pry/_#{Digest::MD5.hexdigest(FileUtils.pwd).to_s}.rb") | |
system "mate -w #{file}" | |
Object.class_eval(`cat #{file}`) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should use Pry's editor integration to accomplish this:
In your
.pryrc
:And then in the pry session itself to open a temp file and eval the contents on exit:
See more on the
edit
command here: https://github.com/pry/pry/wiki/Editor-integration#wiki-Edit_command