summaryrefslogtreecommitdiff
path: root/lib/bundler/cli
diff options
context:
space:
mode:
authoryoka <jesse.ikonen@gmail.com>2022-12-22 08:39:00 +0200
committergit <svn-admin@ruby-lang.org>2023-01-04 13:13:19 +0000
commit87c17a141dc4491abf5282d164f2cba13ade18c4 (patch)
tree2c296503f3d5257210e9a61c602ae22fc1148429 /lib/bundler/cli
parent3d6500ee6e3676979d5199dc7b5feab0d15235de (diff)
[rubygems/rubygems] Enhance bundle open with --path option
https://github.com/rubygems/rubygems/commit/3bf8e59304
Diffstat (limited to 'lib/bundler/cli')
-rw-r--r--lib/bundler/cli/open.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/bundler/cli/open.rb b/lib/bundler/cli/open.rb
index ea504344f3..ebd86fd4b1 100644
--- a/lib/bundler/cli/open.rb
+++ b/lib/bundler/cli/open.rb
@@ -2,10 +2,11 @@
module Bundler
class CLI::Open
- attr_reader :options, :name
+ attr_reader :options, :name, :path
def initialize(options, name)
@options = options
@name = name
+ @path = options[:path] unless options[:path].nil?
end
def run
@@ -15,10 +16,10 @@ module Bundler
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."
else
- path = spec.full_gem_path
- Dir.chdir(path) do
+ root_path = spec.full_gem_path
+ Dir.chdir(root_path) do
require "shellwords"
- command = Shellwords.split(editor) + [path]
+ command = Shellwords.split(editor) << File.join([root_path, path].compact)
Bundler.with_original_env do
system(*command)
end || Bundler.ui.info("Could not run '#{command.join(" ")}'")