Skip to content

Commit

Permalink
Merge pull request #492 from scotje/fixup_windows_ruby_invocation
Browse files Browse the repository at this point in the history
(FIXUP) Fix issue where PDK was invoking wrong Ruby on Windows
  • Loading branch information
bmjen authored Apr 28, 2018
2 parents 8830115 + 5d07e2d commit e120ca5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/pdk/tests/unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.rake_bin

def self.rake(task, spinner_text, environment = {})
argv = [rake_bin, task]
argv.unshift('ruby') if Gem.win_platform?
argv.unshift(File.join(PDK::Util::RubyVersion.bin_path, 'ruby.exe')) if Gem.win_platform?

command = PDK::CLI::Exec::Command.new(*argv).tap do |c|
c.context = :module
Expand Down Expand Up @@ -183,7 +183,8 @@ def self.list
PDK::Util::Bundler.ensure_binstubs!('rake')

command_argv = [File.join(PDK::Util.module_root, 'bin', 'rake'), 'spec_list_json']
command_argv.unshift('ruby') if Gem.win_platform?
command_argv.unshift(File.join(PDK::Util::RubyVersion.bin_path, 'ruby.exe')) if Gem.win_platform?

list_command = PDK::CLI::Exec::Command.new(*command_argv)
list_command.context = :module
output = list_command.execute!
Expand Down
2 changes: 1 addition & 1 deletion lib/pdk/validate/base_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def self.invoke(report, options = {})

targets.each do |invokation_targets|
cmd_argv = parse_options(options, invokation_targets).unshift(cmd_path)
cmd_argv.unshift('ruby', '-W0') if Gem.win_platform?
cmd_argv.unshift(File.join(PDK::Util::RubyVersion.bin_path, 'ruby.exe'), '-W0') if Gem.win_platform?

command = PDK::CLI::Exec::Command.new(*cmd_argv).tap do |c|
c.context = :module
Expand Down
3 changes: 2 additions & 1 deletion spec/unit/pdk/validate/metadata_json_lint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@

let(:expected_args) do
if Gem.win_platform?
%w[ruby -W0].concat([described_class.cmd_path, described_class.parse_options({}, [])])
[%r{ruby\.exe$}, '-W0'].concat([described_class.cmd_path, described_class.parse_options({}, [])])
else
[described_class.cmd_path, described_class.parse_options({}, [])]
end
Expand All @@ -176,6 +176,7 @@
end

before(:each) do
allow(PDK::Util::RubyVersion).to receive(:bin_path).and_return('')
allow(PDK::Util::Bundler).to receive(:ensure_binstubs!).with(described_class.cmd)
targets.each do |target|
allow(File).to receive(:directory?).with(target).and_return(false)
Expand Down

0 comments on commit e120ca5

Please sign in to comment.