diff options
author | ojab <ojab@ojab.ru> | 2016-07-16 13:39:20 +0000 |
---|---|---|
committer | ojab <ojab@ojab.ru> | 2016-07-16 16:14:57 +0000 |
commit | 5077d5eaf2acf96164f0fbd1d1b6dfb0a132b853 (patch) | |
tree | d37845e4db90d112b89829025eedf20a96e504d8 | |
parent | c90329aef3d0ff4b5e3d4434fd522c4e626c109c (diff) | |
download | bundler-5077d5eaf2acf96164f0fbd1d1b6dfb0a132b853.tar.gz |
Add JRuby shebang to ruby_shebang? check
It allows commands to be executed via `.kernel_load` on JRuby
-rw-r--r-- | lib/bundler/cli/exec.rb | 1 | ||||
-rw-r--r-- | spec/install/gemfile/git_spec.rb | 1 | ||||
-rw-r--r-- | spec/install/gemfile/path_spec.rb | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 4 | ||||
-rw-r--r-- | spec/support/builders.rb | 7 |
5 files changed, 7 insertions, 8 deletions
diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb index 4371887f2a..f8cd35b140 100644 --- a/lib/bundler/cli/exec.rb +++ b/lib/bundler/cli/exec.rb @@ -77,6 +77,7 @@ module Bundler def ruby_shebang?(file) possibilities = [ "#!/usr/bin/env ruby\n", + "#!/usr/bin/env jruby\n", "#!#{Gem.ruby}\n", ] first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) } diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index 4f24a0b162..577a13a1b5 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -70,7 +70,6 @@ describe "bundle install with git sources" do end it "sets up git gem executables on the path" do - pending_jruby_shebang_fix bundle "exec foobar" expect(out).to eq("1.0") end diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb index 50fc1abac5..9f2893a01c 100644 --- a/spec/install/gemfile/path_spec.rb +++ b/spec/install/gemfile/path_spec.rb @@ -265,8 +265,6 @@ describe "bundle install with explicit source paths" do end it "sets up executables" do - pending_jruby_shebang_fix - build_lib "foo" do |s| s.executables = "foobar" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d780a3f27b..a9266bf8cc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -85,10 +85,6 @@ RSpec.configure do |config| original_wd = Dir.pwd original_env = ENV.to_hash - def pending_jruby_shebang_fix - pending "JRuby executables do not have a proper shebang" if RUBY_PLATFORM == "java" - end - config.expect_with :rspec do |c| c.syntax = :expect end diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 00024db7cf..2491f87b77 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -534,8 +534,13 @@ module Spec @spec.executables = Array(val) @spec.executables.each do |file| executable = "#{@spec.bindir}/#{file}" + shebang = if Bundler.current_ruby.jruby? + "#!/usr/bin/env jruby\n" + else + "#!/usr/bin/env ruby\n" + end @spec.files << executable - write executable, "#!/usr/bin/env ruby\nrequire '#{@name}' ; puts #{Builders.constantize(@name)}" + write executable, "#{shebang}require '#{@name}' ; puts #{Builders.constantize(@name)}" end end |