Sha256: f4d702365bcead65ba26b6ac8a3d980e81c0df6d5d749a13629b7937b276afce
Contents?: true
Size: 779 Bytes
Versions: 2
Compression:
Stored size: 779 Bytes
Contents
class Thor module Actions # launch configured editor to retreive message/string # see http://osdir.com/ml/ruby-talk/2010-06/msg01424.html # see https://gist.github.com/rkumar/456809 # see http://rdoc.info/github/visionmedia/commander/master/Commander/UI.ask_editor def ask_editor(initial_text = '') Tempfile.open('reviewrequest.md') do |f| f << initial_text f.flush editor = repo.config['core.editor'] || ENV['EDITOR'] || 'vi' flags = case editor when 'mate', 'emacs', 'subl' '-w' when 'mvim' '-f' else '' end pid = fork { exec([editor, flags, f.path].join(' ')) } Process.waitpid(pid) File.read(f.path) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thegarage-gitx-2.2.3 | lib/thegarage/gitx/thor_extensions.rb |
thegarage-gitx-2.2.3.pre2 | lib/thegarage/gitx/thor_extensions.rb |