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

[bundler/bundler] Move local variable to only branch where it's used

https://github.com/bundler/bundler/commit/3995b3345d
This commit is contained in:
David Rodríguez 2019-08-16 15:56:19 +02:00 committed by Hiroshi SHIBATA
parent d80f5399ad
commit 7659f00a8d

View file

@ -14,10 +14,10 @@ module Bundler
editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? } editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }
return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor
return unless spec = Bundler::CLI::Common.select_spec(name, :regex_match) return unless spec = Bundler::CLI::Common.select_spec(name, :regex_match)
path = spec.full_gem_path
if spec.default_gem? if spec.default_gem?
Bundler.ui.info "Unable to open #{name} because it's a default gem, so the directory it would normally be installed to does not exist." Bundler.ui.info "Unable to open #{name} because it's a default gem, so the directory it would normally be installed to does not exist."
else else
path = spec.full_gem_path
Dir.chdir(path) do Dir.chdir(path) do
command = Shellwords.split(editor) + [path] command = Shellwords.split(editor) + [path]
Bundler.with_original_env do Bundler.with_original_env do