Skip to content

Commit

Permalink
Merge pull request #965 from heroku/schneems/fix-node-which
Browse files Browse the repository at this point in the history
[changelog skip] Fix `\n` in export path
  • Loading branch information
schneems committed Mar 17, 2020
2 parents b9d0465 + 992c2dc commit 2018053
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/language_pack/ruby.rb
Expand Up @@ -1099,7 +1099,7 @@ def node_preinstall_bin_path
return @node_preinstall_bin_path if defined?(@node_preinstall_bin_path)

legacy_path = "#{Dir.pwd}/#{NODE_BP_PATH}"
path = run("which node")
path = run("which node").chomp
if path && $?.success?
@node_preinstall_bin_path = path
elsif run("#{legacy_path}/node -v") && $?.success?
Expand All @@ -1117,7 +1117,7 @@ def node_not_preinstalled?
def yarn_preinstall_bin_path
return @yarn_preinstall_bin_path if defined?(@yarn_preinstall_bin_path)

path = run("which yarn")
path = run("which yarn").chomp
if path && $?.success?
@yarn_preinstall_bin_path = path
else
Expand Down
12 changes: 11 additions & 1 deletion spec/hatchet/node_spec.rb
Expand Up @@ -2,7 +2,17 @@

describe "Node" do
it "works with node buildpack" do
Hatchet::Runner.new("node_multi", buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git").deploy do |app|
before_deploy = Proc.new do
run!("rm .buildpacks")
run!("echo https://github.com/heroku/heroku-buildpack-nodejs.git >> .buildpacks")
run!("echo #{Hatchet::App.default_buildpack} >> .buildpacks")
end

Hatchet::Runner.new(
"node_multi",
before_deploy: before_deploy,
buildpack_url: "https://github.com/heroku/heroku-buildpack-multi.git"
).deploy do |app|
expect(app.output).to match("Node Version in Ruby buildpack is: v4.1.2")
expect(app.run("node -v")).to match("v4.1.2")
end
Expand Down

0 comments on commit 2018053

Please sign in to comment.