bundler-patch 1.1.0.pre3 → 1.1.0.pre4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67617245f2ccb603b4e769123cfeca8c1651b7ed
4
- data.tar.gz: '0318430c3f11b8a769bba339aeebb869e94fe3e2'
3
+ metadata.gz: df6792e5e314e509f2cc1d71baed6900e77a175d
4
+ data.tar.gz: e3ee93884719854d29bd5feba495fc8099af6984
5
5
  SHA512:
6
- metadata.gz: 47a5029a627739791d69d9e5ea8b4098ed7339b44501c438158d7402ff40e8a972e07578d5182b9fc30b16a3db9dd8d0f6c4cb11d0c3963492546189ab846d2f
7
- data.tar.gz: a1f27bc6462f64e0d7ba846e507e0bf24212b3f5180ed78ada81af96a98613d479ed1b7b8a76e627631d850b343f98ab825af84f77a23b836c3777b0f0a74368
6
+ metadata.gz: a9360b34b07c2b4733b97cb72d9305cf1264520732b43bdf18e53a96b98ae16ab89a1da4322ced5d14dd3c8c97350cbe9bceceace9b36c67506e7bd668c5407f
7
+ data.tar.gz: adb7f5871ad2cb7b6a6d9778d301b4ca08f2e7367e09bc6533fd7443898bb1d68faf8756a3fecc893d1719ac3fcf35616aa1af659405e372ef19594de8a412fb
@@ -65,14 +65,9 @@ module Bundler::Patch
65
65
 
66
66
  options = Bundler::Patch::CLI::Options.new.normalize_options(options)
67
67
 
68
- if options[:use_target_ruby] # TODO: && different_ruby_found
69
- tb = options[:target]
70
- ruby = tb.ruby_bin_exe
71
- tb.install_bundler_patch_in_target
72
- bundler_patch = File.join(tb.ruby_bin, 'bundler-patch') # uses 'latest' bundler-patch, which can work after we've installed ours.
73
- full_command = "#{ruby} #{bundler_patch} #{options[:original_command].gsub(/use_target_ruby/, '')}"
74
- result = shell_command(full_command)
75
- puts result[:stdout] unless ENV['BP_DEBUG']
68
+ tb = options[:target]
69
+ if options[:use_target_ruby] && tb.target_ruby_is_different?
70
+ launch_target_bundler_patch(options)
76
71
  else
77
72
  return list(options) if options[:list]
78
73
 
@@ -82,6 +77,16 @@ module Bundler::Patch
82
77
  end
83
78
  end
84
79
 
80
+ def launch_target_bundler_patch(options)
81
+ tb = options[:target]
82
+ ruby = tb.ruby_bin_exe
83
+ tb.install_bundler_patch_in_target
84
+ bundler_patch = File.join(tb.ruby_bin, 'bundler-patch')
85
+ full_command = "#{ruby} #{bundler_patch} #{options[:original_command].gsub(/use_target_ruby/, '')}"
86
+ result = shell_command(full_command)
87
+ puts result[:stdout] unless ENV['BP_DEBUG']
88
+ end
89
+
85
90
  private
86
91
 
87
92
  def list(options)
@@ -152,9 +157,9 @@ module Bundler::Patch
152
157
  end
153
158
 
154
159
  def shell_command(command)
160
+ puts "-command: #{command}" if ENV['BP_DEBUG']
155
161
  stdout, stderr, status = Open3.capture3(command)
156
162
  if ENV['BP_DEBUG']
157
- puts "-command: #{command}"
158
163
  puts "--stdout:#{indent(stdout)}"
159
164
  puts "--stderr:#{indent(stderr)}"
160
165
  end
@@ -71,6 +71,10 @@ class TargetBundle
71
71
  File.join(ruby_bin, "#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}")
72
72
  end
73
73
 
74
+ def target_ruby_is_different?
75
+ !(ruby_bin == RbConfig::CONFIG['bindir'])
76
+ end
77
+
74
78
  # Have to run a separate process in the other Ruby, because Gem.default_dir depends on
75
79
  # RbConfig::CONFIG which is all special data derived from the active runtime. It could perhaps
76
80
  # be redone here, but I'd rather not copy that code in here at the moment.
@@ -1,5 +1,5 @@
1
1
  module Bundler
2
2
  module Patch
3
- VERSION = '1.1.0.pre3'
3
+ VERSION = '1.1.0.pre4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler-patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.pre3
4
+ version: 1.1.0.pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - chrismo