2012-11-14 03:17:30 -05:00
|
|
|
class Pry
|
2012-12-25 16:35:17 -05:00
|
|
|
class Command::GemOpen < Pry::ClassCommand
|
|
|
|
match 'gem-open'
|
2012-11-14 03:17:30 -05:00
|
|
|
group 'Gems'
|
2014-05-05 03:49:45 -04:00
|
|
|
description 'Opens the working directory of the gem in your editor.'
|
2018-10-12 15:09:29 -04:00
|
|
|
command_options argument_required: true
|
2012-11-14 03:17:30 -05:00
|
|
|
|
2013-01-09 15:23:19 -05:00
|
|
|
banner <<-'BANNER'
|
2012-11-14 03:17:30 -05:00
|
|
|
Usage: gem-open GEM_NAME
|
|
|
|
|
2013-01-09 15:23:19 -05:00
|
|
|
Change the current working directory to that in which the given gem is
|
|
|
|
installed, and then opens your text editor.
|
|
|
|
|
|
|
|
gem-open pry-exception_explorer
|
2012-11-14 03:17:30 -05:00
|
|
|
BANNER
|
|
|
|
|
|
|
|
def process(gem)
|
2013-01-08 17:24:53 -05:00
|
|
|
Dir.chdir(Rubygem.spec(gem).full_gem_path) do
|
2014-09-10 14:45:02 -04:00
|
|
|
Pry::Editor.new(_pry_).invoke_editor(".", 0, false)
|
2012-11-14 03:17:30 -05:00
|
|
|
end
|
|
|
|
end
|
2012-11-14 04:50:27 -05:00
|
|
|
|
|
|
|
def complete(str)
|
2013-01-08 17:24:53 -05:00
|
|
|
Rubygem.complete(str)
|
2012-11-14 04:50:27 -05:00
|
|
|
end
|
2012-11-14 03:17:30 -05:00
|
|
|
end
|
2012-12-25 16:35:17 -05:00
|
|
|
|
|
|
|
Pry::Commands.add_command(Pry::Command::GemOpen)
|
2012-11-14 03:17:30 -05:00
|
|
|
end
|