1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Changed gist-method to use Gist.write instead of popen

This commit is contained in:
Mon ouïe 2011-05-15 09:43:08 +02:00
parent 9132003887
commit d157c5a4d6

View file

@ -95,6 +95,8 @@ e.g: stat hello_method
end
command "gist-method", "Gist a method to github. Type `gist-method --help` for more info.", :requires_gem => "gist" do |*args|
require 'gist'
target = target()
opts = Slop.parse!(args) do |opts|
@ -134,9 +136,11 @@ e.g: gist -d my_method
code_type = :plain
end
IO.popen("gist#{' -p' if opts.p?} -t #{type_map[code_type]} -", "w") do |gist|
gist.puts content
end
link = Gist.write([:extension => ".#{type_map[code_type]}",
:input => content],
opts.p?)
output.puts "Gist created at #{link}"
end
end